Exemplo n.º 1
0
    def periodical(self):
        def normalizefiletitle(filename):
            filename = filename.replace('.', ' ')
            filename = filename.replace('_', ' ')
            filename = filename.lower()
            return filename

        shows = [s.strip() for s in self.getConfig("shows").split(",")]

        feed = feedparser.parse("http://feeds.feedburner.com/ev0in/%s?format=xml" % self.getConfig("quality"))

        showStorage = {}
        for show in shows:
            showStorage[show] = int(self.getStorage("show_%s_lastfound" % show, 0))

        found = False
        for item in feed['items']:
            for show, lastfound in showStorage.iteritems():
                if show.lower() in normalizefiletitle(item['title']) and lastfound < int(mktime(item.date_parsed)):
                    links = self.filterLinks(item['description'].split("<br />"))
                    packagename = item['title'].encode("utf-8")
                    self.logInfo("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show))
                    self.core.api.addPackage(packagename, links, 1 if self.getConfig("queue") else 0)
                    self.setStorage("show_%s_lastfound" % show, int(mktime(item.date_parsed)))
                    found = True
        if not found:
            #self.logDebug("Ev0InFetcher: no new episodes found")
            pass

        for show, lastfound in self.getStorage().iteritems():
            if int(lastfound) > 0 and int(lastfound) + (3600 * 24 * 30) < int(time()):
                self.delStorage("show_%s_lastfound" % show)
                self.logDebug("Ev0InFetcher: cleaned '%s' record" % show)
    def periodical(self):
        self.interval = self.getConfig("interval") * 60                                                # Re-set the interval if it has changed (need to restart pyload otherwise)
        feed = feedparser.parse("http://directdownload.tv/rss/"+self.getConfig("rssnumber"))           # This is your personal feed Number from directdownload.tv
       
        lastupdate = 0                  # The last timestamp of a downloaded file
        try:
            lastupdate = int(self.getStorage("lastupdate", 0))  # Try to load the last updated timestamp   
        except:
            pass
       
       
        maxtime =lastupdate
        for item in feed['entries']:                                                                                # Thats a single Episode item in the feed
            currenttime = int(mktime(item['updated_parsed']))                         
            if ( currenttime > lastupdate):                                                                         # Take only those not already parsed                                                                           
                links = str(item['summary'].replace("\n","").replace("<br /><br />","<br />")).split("<br />")      # Get all links (first element is the name)
                title = links.pop(0).strip()
                links = filter (lambda x:x.startswith("http://") , links)                                           # remove all non-links (Empty lines, and whatnot)
                self.core.log.info("DDFetcher: New Episode found: %s" % (title))
                if (len(self.filterLinks(links)) > 0) :
                    self.core.api.addPackage(title.encode("utf-8"), self.filterLinks(links), 1 if self.getConfig("queue") else 0)
                    maxtime = max(maxtime, currenttime)                                                             # no links found. Try again next time.
                else:
                    self.core.log.info("DDFetcher: Couldn't parse any valid links from this episode. Check allowed hosters. Available links are: %s" % (links))

        if (maxtime == lastupdate):
            self.core.log.debug("DDFetcher: No new Episodes found")
        else:
            self.setStorage("lastupdate",int(maxtime))
Exemplo n.º 3
0
    def periodical(self):
        def normalizefiletitle(filename):
            filename = filename.replace('.', ' ')
            filename = filename.replace('_', ' ')
            filename = filename.lower()
            return filename

        shows = [s.strip() for s in self.getConfig("shows").split(",")]

        feed = feedparser.parse(
            "http://feeds.feedburner.com/ev0in/%s?format=xml" %
            self.getConfig("quality"))

        showStorage = {}
        for show in shows:
            showStorage[show] = int(
                self.getStorage("show_%s_lastfound" % show, 0))

        found = False
        for item in feed['items']:
            for show, lastfound in showStorage.iteritems():
                if show.lower() in normalizefiletitle(
                        item['title']) and lastfound < int(
                            mktime(item.date_parsed)):
                    links = self.filterLinks(
                        item['description'].split("<br />"))
                    packagename = item['title'].encode("utf-8")
                    self.logInfo(
                        "Ev0InFetcher: new episode '%s' (matched '%s')" %
                        (packagename, show))
                    self.core.api.addPackage(
                        packagename, links,
                        1 if self.getConfig("queue") else 0)
                    self.setStorage("show_%s_lastfound" % show,
                                    int(mktime(item.date_parsed)))
                    found = True
        if not found:
            #self.logDebug("Ev0InFetcher: no new episodes found")
            pass

        for show, lastfound in self.getStorage().iteritems():
            if int(lastfound) > 0 and int(lastfound) + (3600 * 24 * 30) < int(
                    time()):
                self.delStorage("show_%s_lastfound" % show)
                self.logDebug("Ev0InFetcher: cleaned '%s' record" % show)