Changeset 366


Ignore:
Timestamp:
28.02.2010 01:39:26 (5 months ago)
Author:
shiml
Message:

artig: added plugin for tele-task.de

Location:
artig
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • artig/artig.py

    r347 r366  
    11#!/usr/bin/env python 
    2 #import os 
    32import sys 
    4 #import fakeua 
    5 #UserAgent = fakeua.UserAgent() 
    6 #UserAgent.new() 
    73 
     4## import base plugin class 
    85from plugins import base 
     6## import all plugins from ./plugins .. see ./plugins/__init__.py for a wierd hack. 
    97from plugins import * 
    10  
    11 #class Config: 
    12 #    import string 
    13 #    import ConfigParser 
    14 # 
    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 os 
    30 #    import string 
    31 # 
    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 urllib2 
    37 # 
    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 content 
    478 
    489class Fetcher(): 
     
    5819                yay = plugin() 
    5920                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) 
    6125 
    6226if __name__ == "__main__": 
    6327    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]) 
    6532 
  • artig/handlers.conf

    r346 r366  
    11[handlers] 
     2#mplayer=mplayer -really-quiet -user-agent "$ua" -dumpstream -dumpfile "$f" "$u" 
     3wget=wget --user-agent "$ua" -O "$f" "$u" 
    24mplayer=mplayer -user-agent "$ua" -dumpstream -dumpfile "$f" "$u" 
    3 wget=wget --user-agent "$ua" -O "$f" "$u" 
  • artig/plugins/__init__.py

    r347 r366  
    11import os 
    22 
     3## imports everything ending in .py 
    34for module in os.listdir(os.path.dirname(__file__)): 
    45    if module == '__init__.py' or module[-3:] != '.py': 
  • artig/plugins/archive.py

    r349 r366  
    55 
    66    domain = 'www.archive.org' 
     7    help = '''Downloads music from archive.org, eg. Grateful Dead 
     8soundboard recordings. Call artig with the url of the page which 
     9has the embedded player. 
     10example: http://www.archive.org/details/gd1985-03-21.sbd.unknown.82311.sbeok.flac16''' 
    711 
    812    def __init__(self): 
  • artig/plugins/ard.py

    r349 r366  
    55 
    66    domain = 'www.ardmediathek.de' 
     7    help = '''tv-shows from the "mediathek" of ard. needs some more work to work.''' 
    78 
    89    def __init__(self): 
  • artig/plugins/arte.py

    r347 r366  
    55 
    66    domain = 'plus7.arte.tv' 
     7    help = '''shows from plus7.arte.tv''' 
    78 
    89    def __init__(self): 
  • artig/plugins/zdf.py

    r349 r366  
    55 
    66    domain = 'www.zdf.de' 
     7    help = 'shows from the zdf-mediathek' 
    78 
    89    def __init__(self): 
     
    1213        web = base.Web() 
    1314        page = web.getpage(url) 
    14         title = self.re.findall('<h1 class="beitragHeadline">&quot;(.*)&quot;</h1>',page)[0] 
     15        title = self.re.findall('<h1 class="beitragHeadline">(?:&quot;)?(.*)(?:&quot;)?</h1>',page)[0] 
    1516         
    1617        xmlurl = self.re.findall('<a href="(http://wstreaming\.zdf\.de/zdf/veryhigh/.*)" class="play"',page)[0] 
    1718 
    1819        xmlpage = web.getpage(xmlurl) 
    19         print xmlpage 
    2020        wmvurl = self.re.findall('"(mms://ondemand\.msmedia\.zdf\.newmedia\.nacamar\.net/zdf/data/msmedia/zdf/.*\.wmv)"',xmlpage)[0] 
    2121         
Note: See TracChangeset for help on using the changeset viewer.