Changeset 366
- Timestamp:
- 28.02.2010 01:39:26 (5 months ago)
- Location:
- artig
- Files:
-
- 1 added
- 7 edited
-
artig.py (modified) (2 diffs)
-
handlers.conf (modified) (1 diff)
-
plugins/__init__.py (modified) (1 diff)
-
plugins/archive.py (modified) (1 diff)
-
plugins/ard.py (modified) (1 diff)
-
plugins/arte.py (modified) (1 diff)
-
plugins/tele-task.py (added)
-
plugins/zdf.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
artig/artig.py
r347 r366 1 1 #!/usr/bin/env python 2 #import os3 2 import sys 4 #import fakeua5 #UserAgent = fakeua.UserAgent()6 #UserAgent.new()7 3 4 ## import base plugin class 8 5 from plugins import base 6 ## import all plugins from ./plugins .. see ./plugins/__init__.py for a wierd hack. 9 7 from plugins import * 10 11 #class Config:12 # import string13 # import ConfigParser14 #15 # def __init__(self):16 # self.load()17 #18 # def load(self):19 # self.config = self.ConfigParser.ConfigParser()20 # self.config.read('handlers.conf')21 #22 # def handler(self,handler):23 # return self.string.Template(self.config.get('handlers',handler))24 #25 # def sites(self,site):26 # return self.string.Template(self.config.get('sites',site))27 #28 #class Download(Config):29 # import os30 # import string31 #32 # def get(self, handler, url, file='dump'):33 # self.os.system(self.handler(handler).substitute(ua = UserAgent.ua(), f=file, u=url))34 #35 #class Web:36 # import urllib237 #38 # def getpage(url):39 # request = self.urllib2.Request(url)40 # request.add_header('user-agent',UserAgent.ua())41 #42 # file = self.urllib2.build_opener()43 #44 # content = file.open(request)45 #46 # return content47 8 48 9 class Fetcher(): … … 58 19 yay = plugin() 59 20 yay.fetch(url) 60 21 22 def help(self): 23 for plugin in base.Plugin.__subclasses__(): 24 print '%s:\n%s\n' % (plugin.domain, plugin.help) 61 25 62 26 if __name__ == "__main__": 63 27 test = Fetcher() 64 test.fetch(sys.argv[1]) 28 if sys.argv[1] in ['-h','-?']: 29 test.help() 30 else: 31 test.fetch(sys.argv[1]) 65 32 -
artig/handlers.conf
r346 r366 1 1 [handlers] 2 #mplayer=mplayer -really-quiet -user-agent "$ua" -dumpstream -dumpfile "$f" "$u" 3 wget=wget --user-agent "$ua" -O "$f" "$u" 2 4 mplayer=mplayer -user-agent "$ua" -dumpstream -dumpfile "$f" "$u" 3 wget=wget --user-agent "$ua" -O "$f" "$u" -
artig/plugins/__init__.py
r347 r366 1 1 import os 2 2 3 ## imports everything ending in .py 3 4 for module in os.listdir(os.path.dirname(__file__)): 4 5 if module == '__init__.py' or module[-3:] != '.py': -
artig/plugins/archive.py
r349 r366 5 5 6 6 domain = 'www.archive.org' 7 help = '''Downloads music from archive.org, eg. Grateful Dead 8 soundboard recordings. Call artig with the url of the page which 9 has the embedded player. 10 example: http://www.archive.org/details/gd1985-03-21.sbd.unknown.82311.sbeok.flac16''' 7 11 8 12 def __init__(self): -
artig/plugins/ard.py
r349 r366 5 5 6 6 domain = 'www.ardmediathek.de' 7 help = '''tv-shows from the "mediathek" of ard. needs some more work to work.''' 7 8 8 9 def __init__(self): -
artig/plugins/arte.py
r347 r366 5 5 6 6 domain = 'plus7.arte.tv' 7 help = '''shows from plus7.arte.tv''' 7 8 8 9 def __init__(self): -
artig/plugins/zdf.py
r349 r366 5 5 6 6 domain = 'www.zdf.de' 7 help = 'shows from the zdf-mediathek' 7 8 8 9 def __init__(self): … … 12 13 web = base.Web() 13 14 page = web.getpage(url) 14 title = self.re.findall('<h1 class="beitragHeadline"> "(.*)"</h1>',page)[0]15 title = self.re.findall('<h1 class="beitragHeadline">(?:")?(.*)(?:")?</h1>',page)[0] 15 16 16 17 xmlurl = self.re.findall('<a href="(http://wstreaming\.zdf\.de/zdf/veryhigh/.*)" class="play"',page)[0] 17 18 18 19 xmlpage = web.getpage(xmlurl) 19 print xmlpage20 20 wmvurl = self.re.findall('"(mms://ondemand\.msmedia\.zdf\.newmedia\.nacamar\.net/zdf/data/msmedia/zdf/.*\.wmv)"',xmlpage)[0] 21 21
Note: See TracChangeset
for help on using the changeset viewer.

