Changeset 366 for artig/artig.py


Ignore:
Timestamp:
02/28/10 01:39:26 (6 months ago)
Author:
shiml
Message:

artig: added plugin for tele-task.de

File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.