else: torrent = response.read() except Exception, e: logger.warn('Error fetching data from %s: %s' % (site, e)) return "fail" with open(filepath, 'wb') as the_file: the_file.write(torrent) logger.info("saved.") #logger.fdebug('torrent file saved as : ' + str(filepath)) if mylar.TORRENT_LOCAL: return "pass" #remote_file = urllib2.urlopen(linkit) #if linkit[-7:] != "torrent": # filename += ".torrent" #local_file = open('%s' % (os.path.join(mylar.CACHE_DIR,filename)), 'w') #local_file.write(remote_file.read()) #local_file.close() #remote_file.close() elif mylar.TORRENT_SEEDBOX: tssh = ftpsshup.putfile(filepath, filename) return tssh if __name__ == '__main__': #torrents(sys.argv[1]) #torrentdbsearch(sys.argv[1], sys.argv[2], sys.argv[3]) nzbs(sys.argv[1])
elif mylar.USE_DELUGE: try: dc = deluge.TorrentClient() if not dc.connect(mylar.DELUGE_HOST, mylar.DELUGE_USERNAME, mylar.DELUGE_PASSWORD): return "fail" logger.info('Not connected to Deluge! (rsscheck)') else: logger.info('Connected to Deluge! Will try to add torrent now! (rsscheck)') if dc.load_torrent(filepath): return "pass" else: return "fail" logger.info('Unable to connect to Deluge (rsscheck)') except Exception as e: logger.error(e) return "fail" elif mylar.USE_WATCHDIR: if mylar.TORRENT_LOCAL: return "pass" else: tssh = ftpsshup.putfile(filepath, filename) return tssh if __name__ == '__main__': #torrents(sys.argv[1]) #torrentdbsearch(sys.argv[1], sys.argv[2], sys.argv[3]) nzbs(provider=sys.argv[1])