Exemple #1
0
                    self.checkTheseMovies.pop(0)
            except Exception, e:
                log.error('Something went wrong with checkTheseMovies: %s' % e)

            #check all movies
            try:
                now = time.time()
                if (self.lastChecked + self.intervalSec) < now: # and not self.debug:
                    self.lastChecked = now
                    self.searchAll()
            except Exception, e:
                log.error('Something went wrong with searchAll: %s' % e)

            time.sleep(wait)

        log.info('YarrCron has shutdown.')

    def setInterval(self, interval):
        self.intervalSec = int(interval) * 60 * 60

    def forceCheck(self, movie = None):
        if movie == None:
            self.lastChecked = time.time() - self.intervalSec + 10
        else:
            self.checkTheseMovies.append(movie)

    def stopCheck(self):
        log.info('Forcing search to stop.')
        self.stop = True

    def searchAll(self):
Exemple #2
0
            except Exception, e:
                log.error('Something went wrong with checkTheseMovies: %s' % e)

            #check all movies
            try:
                now = time.time()
                if (self.lastChecked +
                        self.intervalSec) < now:  # and not self.debug:
                    self.lastChecked = now
                    self.searchAll()
            except Exception, e:
                log.error('Something went wrong with searchAll: %s' % e)

            time.sleep(wait)

        log.info('YarrCron has shutdown.')

    def setInterval(self, interval):
        self.intervalSec = int(interval) * 60 * 60

    def forceCheck(self, movie=None):
        if movie == None:
            self.lastChecked = time.time() - self.intervalSec + 10
        else:
            self.checkTheseMovies.append(movie)

    def stopCheck(self):
        log.info('Forcing search to stop.')
        self.stop = True

    def searchAll(self):
Exemple #3
0
        except IOError, e:
            log.error(
                u"Warning: Couldn't contact Popcorn Hour on host %s: %s" %
                (host, e))
            return False

        try:
            et = etree.fromstring(response)
            result = et.findtext("returnValue")
        except SyntaxError, e:
            log.error(
                u"Unable to parse XML returned from the Popcorn Hour: %s" %
                (e))
            return False

        if int(result) > 0:
            log.error(u"Popcorn Hour returned an errorcode: %s" % (result))
            return False
        else:
            log.info("NMJ started background scan")
            return True

    def test(self, host, database, mount):

        self.enabled = True
        self.host = host
        self.database = database
        self.mount = mount

        self.updateLibrary()
Exemple #4
0
            else:
                log.error("Protocol Error: " + e.errmsg)
            return False

        try:
            if nzb.download:
                r = nzb.download(nzb.id)

                if not r:
                    return False
            else:
                r = urllib2.urlopen(nzb.url).read().strip()
        except Exception, e:
            log.error('Unable to get NZB file: %s' % e)
            return False

        nzbcontent64 = standard_b64encode(r)

        if nzbGetRPC.append(nzb.name + ".nzb", self.conf('category'), False, nzbcontent64):
            log.info("NZB sent successfully to nzbGet")
            return True
        else:
            log.error("nzbGet could not add %s to the queue" % (nzb.name + ".nzb"))
            return False

    def isDisabled(self):
        if self.conf('host'):
            return False
        else:
            return True
Exemple #5
0
            log.debug(u"Sending NMJ scan update command via url: %s" % (updateUrl))
            handle = urllib2.urlopen(req)
            response = handle.read()
        except IOError, e:
            log.error(u"Warning: Couldn't contact Popcorn Hour on host %s: %s" % (host, e))
            return False

        try:
            et = etree.fromstring(response)
            result = et.findtext("returnValue")
        except SyntaxError, e:
            log.error(u"Unable to parse XML returned from the Popcorn Hour: %s" % (e))
            return False

        if int(result) > 0:
            log.error(u"Popcorn Hour returned an errorcode: %s" % (result))
            return False
        else:
            log.info("NMJ started background scan")
            return True


    def test(self, host, database, mount):

        self.enabled = True
        self.host = host
        self.database = database
        self.mount = mount

        self.updateLibrary()
Exemple #6
0
            return False

        try:
            if nzb.download:
                r = nzb.download(nzb.id)

                if not r:
                    return False
            else:
                r = urllib2.urlopen(nzb.url).read().strip()
        except Exception, e:
            log.error('Unable to get NZB file: %s' % e)
            return False

        nzbcontent64 = standard_b64encode(r)

        if nzbGetRPC.append(nzb.name + ".nzb", self.conf('category'), False,
                            nzbcontent64):
            log.info("NZB sent successfully to nzbGet")
            return True
        else:
            log.error("nzbGet could not add %s to the queue" %
                      (nzb.name + ".nzb"))
            return False

    def isDisabled(self):
        if self.conf('host'):
            return False
        else:
            return True