def setUp(self): self.downloader = Downloader.Downloader(verbosity=DEBUG) self.transferer = Transferer.Transferer(id="transferer", verbosity=DEBUG_TRANSFERER) self.configFileTransmission = "tests/downloaderTransmission.json" self.configFileSynology = "tests/downloader3.json" self.configFileNone = "tests/downloaderNone.json" self.configFileTvShowSchedule = "tests/tvShowSchedule.json" self.testTransmission = os.path.isfile(self.configFileTransmission) self.tmpdir1 = unicode(tempfile.mkdtemp()) self.tmpdir2 = unicode(tempfile.mkdtemp()) self.transfererData = { "enable": True, "source": { "path": self.tmpdir1, "protocol": "file" }, "destination": { "path": self.tmpdir2, "protocol": "file" }, "delete_after": False, "pathPattern": "{seriesname}/season {seasonnumber}" } self.ts = torrentSearch.torrentSearch( id="torrentSearch", dataFile="tests/torrentSearch2.json", verbosity=DEBUG_TORRENT_SEARCH) self.t = myTvDB.myTvDB(debug=DEBUG, cache=False)
def setUp(self): wwwoman.wwwomanScenario.scenario_path = "tests/wwwoman/scenario" self.ts = torrentSearch.torrentSearch(id="torrentSearch",verbosity=DEBUG) self.configFile2 = "tests/torrentSearch2.json" self.conf1 = {u'keywords': [u'720p'], u'providers': [{u'provider_type': u'kat',"keywords":["lang_id:2 verified:1"]}]} self.conf1['providers'].insert(0,{'provider_type':'t411','authentification':{"username":"******","password":"******"}}) self.conf2 = dict(self.conf1) self.conf2['keywords'] = []
def loadFullConfig(self): self.confFilename = "tests/fullConfig.json" self.downloader = Downloader.Downloader(verbosity=DEBUG_DOWNLOADER) self.downloader.loadConfig(self.confFilename) self.transferer = Transferer.Transferer(id="transferer",verbosity=DEBUG) self.transfererData = {"enable":True,"source": {"path": self.tmpdir1, "protocol": "file"}, "destination": {"path": self.tmpdir2, "protocol": "file"}} self.transferer.addData(self.confFilename) self.transferer.setValue(self.transfererData) self.torrentSearch = torrentSearch.torrentSearch(id="torrentSearch",dataFile=self.confFilename,verbosity=DEBUG)
def run(): logging.error('run!') curPath = os.path.dirname(os.path.realpath(__file__)) torrentsearch = torrentSearch.torrentSearch("torrentSearch",dataFile=curPath+"/config.json") downloader = Downloader.Downloader("downloader",dataFile=curPath+"/config.json") transferer = Transferer.Transferer("transferer",dataFile=curPath+"/config.json") #while not self.stopped.wait(60): tvshowlist = tvShowList.tvShowList(id="tvShowList",tvShows=curPath+"/series.json",verbosity=False) tvshowlist.update(downloader=downloader,transferer=transferer,searcher=torrentsearch,force=False) tvshowlist.save()
def handleSelect(self): # Reset label information for downloads list self.titleLabel.setText('') self.infoLabel.setText('') self.listWidget.clear() QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) if self.episode_number[0] == '0': self.episode_number = self.episode_number[1] # Get the selected episode information from seasons result = self.seasons[int(self.selected_season) ][int(self.episode_number)] title, release, imdb_id = result[0], result[1], result[2] plot, title = episodeBuilder(imdb_id) # formatting issues for single digit episode numbers temp1, temp2 = self.selected_season, self.episode_number if int(self.selected_season) in range(0, 10): temp1 = '0' + self.selected_season[0] if int(self.episode_number) in range(0, 10): temp2 = '0' + self.episode_number[0] # Get torrents based on episode self.torrents = torrentSearch( self.searched_name, 'S' + temp1 + 'E' + temp2) #if torrents == {}: # no torrents # pass torrents on to download list widget to handle selection of torrent for t in self.torrents: self.listWidget.addItem(self.torrents[t][0] + " --- " + self.torrents[t][1] + ' --- ' + self.torrents[t][2]) # Set the appropraite labels with information self.titleLabel.setText('S' + temp1 + 'E' + temp2 + ': ' + title) self.infoLabel.setText(plot) self.downloadButton.setEnabled(True) QtGui.QApplication.restoreOverrideCursor()
def run(): logging.error('run!') curPath = os.path.dirname(os.path.realpath(__file__)) torrentsearch = torrentSearch.torrentSearch("torrentSearch", dataFile=curPath + "/config.json") downloader = Downloader.Downloader("downloader", dataFile=curPath + "/config.json") transferer = Transferer.Transferer("transferer", dataFile=curPath + "/config.json") #while not self.stopped.wait(60): tvshowlist = tvShowList.tvShowList(id="tvShowList", tvShows=curPath + "/series.json", verbosity=False) tvshowlist.update(downloader=downloader, transferer=transferer, searcher=torrentsearch, force=False) tvshowlist.save()
def setUp(self): self.downloader = Downloader.Downloader(verbosity=DEBUG) self.transferer = Transferer.Transferer(id="transferer",verbosity=DEBUG_TRANSFERER) self.configFileTransmission = "tests/downloaderTransmission.json" self.configFileSynology = "tests/downloader3.json" self.configFileNone = "tests/downloaderNone.json" self.configFileTvShowSchedule = "tests/tvShowSchedule.json" self.testTransmission = os.path.isfile(self.configFileTransmission) self.tmpdir1 = unicode(tempfile.mkdtemp()) self.tmpdir2 = unicode(tempfile.mkdtemp()) self.transfererData = { "enable":True, "source": {"path": self.tmpdir1, "protocol": "file"}, "destination": {"path": self.tmpdir2, "protocol": "file"}, "delete_after":False, "pathPattern":"{seriesname}/season {seasonnumber}" } self.ts = torrentSearch.torrentSearch(id="torrentSearch",dataFile="tests/torrentSearch2.json",verbosity=DEBUG_TORRENT_SEARCH) self.t = myTvDB.myTvDB(debug=DEBUG,cache=False)
def test_update_10_to_21(self): # not broadcasted to waiting for torrent push tmpfile = unicode(tempfile.mkstemp('.json')[1]) os.remove(tmpfile) emptyTS = torrentSearch.torrentSearch( id="torrentSearch", dataFile=tmpfile, verbosity=DEBUG_TORRENT_SEARCH ) tvShow = tvShowSchedule.tvShowSchedule(seriesid=321,autoComplete=False,verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set( season=1, episode=1, nextUpdate=datetime.datetime.now(), info={'seriesname':'TvShow 2'}, status=10 ) self.assertEqual(tvShow['status'],10) tvShow.update(downloader=self.downloader,transferer=self.transferer,searcher=emptyTS,force=True) self.assertEqual(tvShow['status'],21) os.remove(tmpfile)
def setUp(self): wwwoman.wwwomanScenario.scenario_path = "tests/wwwoman/scenario" self.ts = torrentSearch.torrentSearch(id="torrentSearch", verbosity=DEBUG) self.configFile2 = "tests/torrentSearch2.json" self.conf1 = { u'keywords': [u'720p'], u'providers': [{ u'provider_type': u'kat', "keywords": ["lang_id:2 verified:1"] }] } self.conf1['providers'].insert( 0, { 'provider_type': 't411', 'authentification': { "username": "******", "password": "******" } }) self.conf2 = dict(self.conf1) self.conf2['keywords'] = []
def test_update_22_to_21(self): # Watching torrent from TP but no TP setup tmpfile = unicode(tempfile.mkstemp('.json')[1]) os.remove(tmpfile) emptyTS = torrentSearch.torrentSearch( id="torrentSearch", dataFile=tmpfile, verbosity=DEBUG_TORRENT_SEARCH ) tvShow = tvShowSchedule.tvShowSchedule(seriesid=321,autoComplete=False,verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set( season=1, episode=1, nextUpdate=datetime.datetime.now(), info={'seriesname':'TvShow 2'}, status=22 ) self.assertEqual(tvShow['status'],22) with self.assertLogs(logger=emptyTS.logger,level='ERROR'): tvShow.update(downloader=self.downloader,transferer=self.transferer,searcher=emptyTS,force=True) self.assertEqual(tvShow['status'],21) os.remove(tmpfile)
def test_update_10_to_21( self): # not broadcasted to waiting for torrent push tmpfile = unicode(tempfile.mkstemp('.json')[1]) os.remove(tmpfile) emptyTS = torrentSearch.torrentSearch(id="torrentSearch", dataFile=tmpfile, verbosity=DEBUG_TORRENT_SEARCH) tvShow = tvShowSchedule.tvShowSchedule(seriesid=321, autoComplete=False, verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1, episode=1, nextUpdate=datetime.datetime.now(), info={'seriesname': 'TvShow 2'}, status=10) self.assertEqual(tvShow['status'], 10) tvShow.update(downloader=self.downloader, transferer=self.transferer, searcher=emptyTS, force=True) self.assertEqual(tvShow['status'], 21) os.remove(tmpfile)
def test_update_22_to_21(self): # Watching torrent from TP but no TP setup tmpfile = unicode(tempfile.mkstemp('.json')[1]) os.remove(tmpfile) emptyTS = torrentSearch.torrentSearch(id="torrentSearch", dataFile=tmpfile, verbosity=DEBUG_TORRENT_SEARCH) tvShow = tvShowSchedule.tvShowSchedule(seriesid=321, autoComplete=False, verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1, episode=1, nextUpdate=datetime.datetime.now(), info={'seriesname': 'TvShow 2'}, status=22) self.assertEqual(tvShow['status'], 22) with self.assertLogs(logger=emptyTS.logger, level='ERROR'): tvShow.update(downloader=self.downloader, transferer=self.transferer, searcher=emptyTS, force=True) self.assertEqual(tvShow['status'], 21) os.remove(tmpfile)
import time import JSAG3 import Downloader import torrentSearch import Transferer import Notificator import tvShowList import myTvDB import utils.TSWdirectories curPath = os.path.dirname(os.path.realpath(__file__)) directories = utils.TSWdirectories(curPath + '/utils/directory.conf') webPath = os.path.abspath(directories['web_path']) confPath = os.path.abspath(directories['etc_path']) torrentsearch = torrentSearch.torrentSearch("torrentSearch", dataFile=confPath + "/config.json") downloader = Downloader.Downloader("downloader", dataFile=confPath + "/config.json") transferer = Transferer.Transferer("transferer", dataFile=confPath + "/config.json") tvshowlist = tvShowList.tvShowList(id="tvShowList", tvShows=confPath + "/series.json", banner_dir=webPath + "/static", verbosity=True) notificator = Notificator.Notificator(id="notificator", dataFile=confPath + "/config.json", verbosity=False) tvshowlist.update(downloader=downloader, transferer=transferer, searcher=torrentsearch,
def main(): conf = { "/".encode('utf8'): { 'tools.staticdir.on': True, 'tools.staticdir.root': webPath, 'tools.staticdir.dir': '.', 'tools.staticdir.index': 'index.html', 'tools.trailing_slash.on': False, 'tools.caching.on': False }, "/status.json".encode('utf8'): { "tools.staticfile.on": True, "tools.staticfile.filename": webPath + "/tvShowSchedule/status.json" }, '/favicon.ico'.encode('utf8'): { 'tools.staticfile.on': True, 'tools.staticfile.filename': webPath + '/static/favicon.ico' }, '/api/tvshow'.encode('utf8'): { #'request.dispatch': cherrypy.dispatch.MethodDispatcher(), } } torrentsearch = torrentSearch.torrentSearch("torrentSearch", dataFile=confPath + "/config.json", verbosity=False) downloader = Downloader.Downloader("downloader", dataFile=confPath + "/config.json") transferer = Transferer.Transferer("transferer", dataFile=confPath + "/config.json") tvshowlist = tvShowList.tvShowList(id="tvShowList", tvShows=confPath + "/series.json", banner_dir=webPath + "/static", verbosity=False) notificator = Notificator.Notificator(id="notificator", dataFile=confPath + "/config.json", verbosity=False) activitylog = ActivityLog.ActivityLog(confPath + "/activityLog.db", verbosity=False) root = Root() root.update = Root() root.livesearch = Server.LiveSearch() root.tvshowlist = serv_TvShowList(tvshowlist=tvshowlist, downloader=downloader, searcher=torrentsearch) root.activitylog = Server.ActivityLog(activitylog) root.api = Root() root.api.tvshow = TvShow(tvshowlist=tvshowlist, downloader=downloader, searcher=torrentsearch) root.streamGetSeries = streamGetSeries( tvshowlist=tvshowlist, downloader=downloader, testPath=testPath, testFiles=['torrentSearch', 'Downloader']) root.users = Server.Users() root.groups = Server.Groups() cherrypy.config["tools.encode.on"] = True cherrypy.config["tools.encode.encoding"] = "utf-8" cherrypy.config['engine.autoreload_on'] = False cherrypy.config['server.socket_port'] = 1205 cherrypy.config['server.socket_host'] = '0.0.0.0'.encode('utf8') root = torrentsearch.getRoot(root) conf = torrentsearch.getConf(conf) root.update.torrentSearch = updateData(torrentsearch, testPath) root = downloader.getRoot(root) conf = downloader.getConf(conf) root.update.downloader = updateData(downloader, testPath) root = transferer.getRoot(root) conf = transferer.getConf(conf) root.update.transferer = updateData(transferer) root = notificator.getRoot(root) conf = notificator.getConf(conf) root.update.notificator = updateData(notificator) wd = cherrypy.process.plugins.BackgroundTask( interval=10, function=Server.backgoundProcess, kwargs={ "tvshowlist": tvshowlist, "downloader": downloader, "transferer": transferer, "searcher": torrentsearch, "notificator": notificator, "activitylog": activitylog, "force": False }) wd.start() wd = cherrypy.process.plugins.BackgroundTask(interval=1, function=buffyThreadSlayer) cherrypy.quickstart(root, "/".encode('utf8'), conf)
def setUp(self): self.ts = torrentSearch.torrentSearch( "torrentSearch", dataFile=self.confFile, verbosity=False )
import threading import datetime import tzlocal import tempfile import time import JSAG3 import Downloader import torrentSearch import Transferer import Notificator import tvShowList import myTvDB import utils.TSWdirectories curPath = os.path.dirname(os.path.realpath(__file__)) directories = utils.TSWdirectories(curPath + "/utils/directory.conf") webPath = os.path.abspath(directories["web_path"]) confPath = os.path.abspath(directories["etc_path"]) torrentsearch = torrentSearch.torrentSearch("torrentSearch", dataFile=confPath + "/config.json") downloader = Downloader.Downloader("downloader", dataFile=confPath + "/config.json") transferer = Transferer.Transferer("transferer", dataFile=confPath + "/config.json") tvshowlist = tvShowList.tvShowList( id="tvShowList", tvShows=confPath + "/series.json", banner_dir=webPath + "/static", verbosity=True ) notificator = Notificator.Notificator(id="notificator", dataFile=confPath + "/config.json", verbosity=False) tvshowlist.update( downloader=downloader, transferer=transferer, searcher=torrentsearch, notificator=notificator, force=True, wait=True )
def main(): conf = { "/".encode('utf8') : { 'tools.staticdir.on': True, 'tools.staticdir.root':webPath, 'tools.staticdir.dir': '.', 'tools.staticdir.index': 'index.html', 'tools.trailing_slash.on' : False, 'tools.caching.on' : False }, "/status.json".encode('utf8'): { "tools.staticfile.on": True, "tools.staticfile.filename": webPath + "/tvShowSchedule/status.json" }, '/favicon.ico'.encode('utf8'): { 'tools.staticfile.on': True, 'tools.staticfile.filename': webPath + '/static/favicon.ico' }, '/api/tvshow'.encode('utf8'): { #'request.dispatch': cherrypy.dispatch.MethodDispatcher(), } } torrentsearch = torrentSearch.torrentSearch("torrentSearch",dataFile=confPath+"/config.json",verbosity=False) downloader = Downloader.Downloader("downloader",dataFile=confPath+"/config.json") transferer = Transferer.Transferer("transferer",dataFile=confPath+"/config.json") tvshowlist = tvShowList.tvShowList(id="tvShowList",tvShows=confPath+"/series.json",banner_dir=webPath+"/static",verbosity=False) notificator = Notificator.Notificator(id="notificator",dataFile=confPath+"/config.json",verbosity=False) activitylog = ActivityLog.ActivityLog(confPath+"/activityLog.db",verbosity=False) root = Root() root.update = Root() root.livesearch = Server.LiveSearch() root.tvshowlist = serv_TvShowList(tvshowlist=tvshowlist,downloader=downloader,searcher=torrentsearch) root.activitylog = Server.ActivityLog(activitylog) root.api = Root() root.api.tvshow = TvShow(tvshowlist=tvshowlist,downloader=downloader,searcher=torrentsearch) root.streamGetSeries = streamGetSeries( tvshowlist=tvshowlist, downloader=downloader, testPath =testPath, testFiles =['torrentSearch','Downloader'] ) root.users = Server.Users() root.groups = Server.Groups() cherrypy.config["tools.encode.on"] = True cherrypy.config["tools.encode.encoding"] = "utf-8" cherrypy.config['engine.autoreload_on'] = False cherrypy.config['server.socket_port'] = 1205 cherrypy.config['server.socket_host'] = '0.0.0.0'.encode('utf8') root = torrentsearch.getRoot(root) conf = torrentsearch.getConf(conf) root.update.torrentSearch = updateData(torrentsearch,testPath) root = downloader.getRoot(root) conf = downloader.getConf(conf) root.update.downloader = updateData(downloader,testPath) root = transferer.getRoot(root) conf = transferer.getConf(conf) root.update.transferer = updateData(transferer) root = notificator.getRoot(root) conf = notificator.getConf(conf) root.update.notificator = updateData(notificator) wd = cherrypy.process.plugins.BackgroundTask( interval=10, function=Server.backgoundProcess, kwargs={ "tvshowlist":tvshowlist, "downloader":downloader, "transferer":transferer, "searcher":torrentsearch, "notificator":notificator, "activitylog":activitylog, "force":False } ) wd.start() wd = cherrypy.process.plugins.BackgroundTask( interval=1, function=buffyThreadSlayer ) cherrypy.quickstart(root,"/".encode('utf8'),conf)