コード例 #1
0
ファイル: newzbin.py プロジェクト: cscattaglia/CouchPotato
                                'username' : self.conf('username'),
                                'password' : self.conf('password'),
                                'reportid' : str(new.id)
                            })
                            nzburl = urllib2.Request(self.downloadUrl, newzbindata)

                            return urllib2.urlopen(nzburl).read().strip()
                        except Exception, e:
                            log.error('Failed downloading from newzbin, check credit: %s' % e)
                            return False

                    new.download = download

                    if self.isCorrectMovie(new, movie, type, imdbResults = True, singleCategory = singleCat):
                        results.append(new)
                        log.info('Found: %s' % new.name)

                return results
            except:
                log.error('Failed to parse XML response from newzbin.com: %s' % traceback.format_exc())

        return results

    def getFormatId(self, format):
        for id, quality in self.formatIds.iteritems():
            for q in quality:
                if q == format:
                    return id

        return self.catBackupId
コード例 #2
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
コード例 #3
0
ファイル: nmj.py プロジェクト: Belgar/CouchPotato
        updateUrl = UPDATE_URL % {"host": self.host, "params": params}

        try:
            req = urllib2.Request(updateUrl)
            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
コード例 #4
0
ファイル: nzbget.py プロジェクト: CybeTech/CouchPotato
            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
コード例 #5
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