def test_update(self): tmpfile = unicode(tempfile.mkstemp('.json')[1]) os.remove(tmpfile) shutil.copyfile('tests/tvShowList3.json',tmpfile) self.loadFullConfig() myList = tvShowList.tvShowList(banner_dir=self.tmpdirBanner,tvShows=tmpfile,verbosity=DEBUG_TVSHOWLIST) self.assertEqual(myList[0]['status'],0) # 321 S1E2 0 => 10 self.assertEqual(myList[1]['status'],0) # 123 S1E1 0 => 22 myList.update(downloader=self.downloader,transferer=self.transferer,searcher=self.torrentSearch,wait=True,force=True) self.assertEqual(myList[0]['status'],10) # 321 S1E2 0 => 10 self.assertEqual(myList[1]['status'],22) # 123 S1E1 0 => 22 myList[0].set(season=1,episode=1,status=10) myList[1].set(status=0) self.assertEqual(myList[0]['status'],10) # 321 S1E1 10 => 22 self.assertEqual(myList[1]['status'],0) # 123 S1E1 0 => 30 myList.update(wait=True,force=True) self.assertEqual(myList[0]['status'],22) # 321 S1E1 10 => 22 self.assertEqual(myList[1]['status'],30) # 123 S1E1 0 => 30 myList[1].set(season=1,episode=1,status=10) self.assertEqual(myList[0]['status'],22) # 321 S1E1 22 => 30 self.assertEqual(myList[1]['status'],10) # 123 S1E1 10 => 30 myList.update(wait=True,force=True) self.assertEqual(myList[0]['status'],30) # 321 S1E1 22 => 30 self.assertEqual(myList[1]['status'],30) # 123 S1E1 10 => 30 os.remove(tmpfile)
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 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()
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 creation(self): self.l1 = tvShowList.tvShowList(banner_dir=self.tmpdirBanner,verbosity=DEBUG) self.tvShowSchedule1 = tvShowSchedule.tvShowSchedule(seriesid=self.id1, verbosity=DEBUG)
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)
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)