def joinTVSs(joinPaths, mainTVSPath, newName, linkTable): fname = TAG_PAR_TVSPACK_FILE if newName : newFormName = CMP.create_name_once(newName, TAG_TYP_FOLDER) if not newFormName : return TAG_ERR_INCINPUT, Empty, Empty mainPath = LIB.tvs(newName) DOS.mkdirs(mainPath) isFound = False else: mainPath = mainTVSPath isFound = True try : joinPaths.remove(mainPath) except : pass mainTVS = CTVS.TVS(fname, mainPath, isFound) for path in joinPaths: targetTVS = CTVS.TVS(fname, path, True) mainTVS.join_tvs(targetTVS) linkTable.chpath(targetTVS.lib_path, mainTVS.lib_path, False) DOS.delf(DOS.join(path, fname)) DOS.copyfls(path, mainPath, move=True) del targetTVS mainTVS.dexport() linkTable.save() name = mainTVS.lib_name path = mainTVS.lib_path del mainTVS return TAG_ERR_OK, path, name
def excludeUPDPlug(plugin): fname = TAG_PAR_TVSPACK_FILE tvsNames, tvsPaths = getAllTVS() if not tvsNames : return [] for path in tvsPaths: tvs = CTVS.TVS(fname, path, True) episodes, fsources, sources = tvs.get_direct() fsources_upd = [] sources_upd = [] for src in sources: prefix = call.getURLPrefix(src['src_link']) if prefix != plugin and src['src_upd'] == True : sources_upd.append(src['src_name']) for frc in fsources: prefix = call.getURLPrefix(frc['fsrc_link']) if prefix != plugin and frc['fsrc_upd'] == True : fsources_upd.append(frc['fsrc_name']) tvs.set_upd(fsources_upd, sources_upd) tvs.dexport() del tvs return TAG_ERR_OK
def getTVSsPlugs(): fname = TAG_PAR_TVSPACK_FILE tvsNames, tvsPaths = getAllTVS() if not tvsNames : return [] prefixes = [] for path in tvsPaths: tvs = CTVS.TVS(fname, path, True) episodes, fsources, sources = tvs.get_direct() for src in sources: prefix = call.getURLPrefix(src['src_link']) if prefix not in prefixes and src['src_upd'] == True : prefixes.append(prefix) for frc in fsources: prefix = call.getURLPrefix(frc['fsrc_link']) if prefix not in prefixes and frc['fsrc_upd'] == True : prefixes.append(prefix) del tvs return prefixes
def srcRenamer(): fname = TAG_PAR_TVSPACK_FILE tvsNames, tvsPaths = getAllTVS() if not tvsNames : return progress = CProgress(len(tvsNames), bg=addon.BGUPD) progress.show(tla(TAG_SET_RENAMER)) for path in tvsPaths: tvs = CTVS.TVS(fname, path, True) episodes, fsources, sources = tvs.get_direct() progress.step(normName(tvs.lib_name), 1) for src in sources: src_oldname = src['src_name'] src_id = src['src_id'] eps_name = Empty for eps in episodes: if eps['src_id'] == src_id : eps_name = eps['new_name']; break if eps_name: src_newname = CMP.create_name_once (eps_name, TAG_TYP_SRC, srcFolder=src_oldname, season=Empty) if src_newname : tvs.rensource(src_oldname, src_newname) tvs.dexport() del tvs del progress
def rebuildLinkTable(): fname = TAG_PAR_TVSPACK_FILE linkTable = CTVS.CLinkTable(TAG_PAR_STL_FILE, LIB.lib, load=False) tvsPaths = getAllTVS()[1] for path in tvsPaths: TVS = CTVS.TVS(fname, path, Import=True) x,srcLinks,y,frcLinks = TVS.get_names_and_links(); del TVS for link in srcLinks+frcLinks : linkTable.add(path, link, save=False) linkTable.save(); del linkTable return TAG_ERR_OK
def restoreAllTVS(prefix): fname = TAG_PAR_TVSPACK_FILE tvss = DOS.listdir(LIB.tvsf)[0] progress = CProgress(len(tvss), bg=addon.BGUPD) progress.show(tla(TAG_TTL_RESTOREALL)) for deftvs in tvss: tvs = CTVS.TVS(fname, DOS.join(LIB.tvsf, deftvs), True) progress.step(normName(tvs.lib_name), 1) tvs.os_create(prefix, overwrite=True) del tvs del progress return TAG_ERR_OK
def globalUpdateCheck(shadbg=False): fname = TAG_PAR_TVSPACK_FILE tmplist = DOS.listdir(LIB.tvsf)[0] bgmode = addon.BGUPD if not shadbg else True progress = CProgress(len(tmplist)*100, bg=bgmode) if not addon.HIDEAUPD or not addon.SILENTUPD or not addon.ALLOWSHADOW : progress.show(tla(TAG_TTL_CHKUPDGL)) sList = []; fList = [] for itm in tmplist: path = LIB.tvs(itm) TVS = CTVS.TVS(fname, path, True) u_sNames, u_sLinks, u_fNames, u_fLinks = TVS.check_new_eps(globp=progress, globmsg=normName(TVS.lib_name)) if u_sNames : ustvs = dict() ustvs['name'] = itm ustvs['path'] = path ustvs['pack'] = DOS.join(path, fname) ustvs['ups'] = [u_sNames, u_sLinks] sList.append(ustvs) del ustvs if u_fNames : uftvs = dict() uftvs['name'] = itm uftvs['path'] = path uftvs['pack'] = DOS.join(path, fname) uftvs['ups'] = [u_fNames, u_fLinks] fList.append(uftvs) del uftvs del TVS del progress return sList, fList