def deletetorrent(): rawdata = Webpost.get_json() torrentid = rawdata['deleteinstruction'] if torrentmanager.validatetorrentid(torrentid) == True: torrentmanager.processonetorrent(torrentid, "Delete") else: print("Deleting unknown torrent ", torrentid) return Jsondata(deletedata="Done")
def edittorrentconfiguration(): rawdata = Webpost.get_json() torrentid = rawdata['torrentid'] if torrentmanager.validatetorrentid(torrentid) == True: wastetime() torrentdata = torrentmanager.gettorrentdata(torrentid, "prepareedit") return Jsondata(selectedtorrent=torrentdata, listitems=librarymanager.getdropdownlists( torrentdata['tvshowname'])) else: print("Edit unknown torrent ", torrentid)
def reconfiguretorrentconfiguration(): rawdata = Webpost.get_json() torrentid = rawdata['torrentid'] wastetime() if torrentmanager.validatetorrentid(torrentid) == True: torrentmanager.reconfiguretorrent(torrentid, rawdata['newconfiguration']) FileManager.saveconfigs(torrentmanager.getconfigs()) return Jsondata(selectedtorrent=torrentmanager.gettorrentdata( torrentid, "reconfigure")) else: print("Reconfiguring unknown torrent ", torrentid)
def updatelistpage(): rawdata = Webpost.get_json() bulkaction = rawdata["bulkaction"] if (bulkaction == "Start") or (bulkaction == "Stop"): torrentmanager.bulkprocessalltorrents(bulkaction) elif bulkaction == "RescanFileServer": print("Rescanning File-Server for TV Shows & Seasons") librarymanager.discovertvshows() elif bulkaction != "Refresh": print("Unknown Torrents List Update Action ", bulkaction) torrentmanager.refreshtorrentlist() return Jsondata(torrents=torrentmanager.gettorrentlistdata("refresh"), stats=torrentmanager.getstats())
def updatetorrentpage(): rawdata = Webpost.get_json() torrentid = rawdata['torrentid'] if torrentmanager.validatetorrentid(torrentid) == True: torrentaction = rawdata['torrentaction'] if (torrentaction == "Start") or (torrentaction == "Stop"): torrentmanager.processonetorrent(torrentid, torrentaction) elif torrentaction != "Refresh": print("Unknown Torrent Update Action ", torrentaction) torrentmanager.refreshtorrentdata(torrentid) return Jsondata(selectedtorrent=torrentmanager.gettorrentdata( torrentid, "refresh")) else: print("Updating unknown torrent ", torrentid)
def copytorrent(): rawdata = Webpost.get_json() torrentid = rawdata['copyinstruction'] if torrentid != "!!! CONTINUE EXISTING COPY PROCESS !!!": if torrentmanager.validatetorrentid(torrentid) == True: librarymanager.queuefilecopy( torrentmanager.getcopyactions(torrentid)) else: print("Copying unknown torrent ", torrentid) refreshmode = False else: wastetime() refreshmode = librarymanager.processfilecopylist() return Jsondata(copydata=librarymanager.getcopyprocessinfo(), refreshmode=refreshmode)
def updatetvshowseasonslist(): rawdata = Webpost.get_json() wastetime() return Jsondata(seasons=librarymanager.gettvshowseasons(rawdata['tvshow']))