diff --git a/main.py b/main.py index 34cb504..ee8b033 100644 --- a/main.py +++ b/main.py @@ -85,6 +85,8 @@ def visit_folder(domain, api, rules, tok): nfo = {} if ('filable' not in info) or ('filable_type' not in info): print('nfo:', info) # le fileable associé a été supprimé + elif('release_date' not in info['filable']) or info['filable']['release_date'] is None: + print('nfo:', info) # le fileable ne possède pas de date de sortie valide else: year = int(info['filable']['release_date'][:4]) nfo['YEAR'] = year @@ -94,7 +96,8 @@ def visit_folder(domain, api, rules, tok): match = filerule.match_rules(F.path + '/' + F.name, rules) if match: F.info = match[1] - F.info['YEAR'] = nfo['YEAR'] # may not work :-( + if 'YEAR' in nfo: # remplace l'année par celle donnée par tmdb (la vraie), si disponible + F.info['YEAR'] = nfo['YEAR'] Lapi.append(F) print('total api for ', domain['server'] + domain['path'], ':', len(Lapi)) @@ -135,7 +138,7 @@ def handle_films(Lfilm_loc, Lfilm_api, domain, api, rules, tok): # Fichiers déplacés (ou copiés) localement Lunref, _, Lrelink = update_find_by_common(Lunref, Lapi, lambda f: f.name) - for floc, fapi in Lrelink: + for floc, fApi in Lrelink: if fApi in Lmissing: Lmissing.remove(fApi) print('moved/copied:', Lrelink) @@ -459,7 +462,6 @@ def post_markers(api, file_, fileid): api.post_file_subtitle(fileid, value=sub) time.sleep(1) - def main(): """ Fonction principale du programme, réalise toute les opérations @@ -473,7 +475,7 @@ def main(): folders = api.get_folders() rules = api.get_paths() - for fold in folders[1:]: + for fold in folders: applicable = [filerule.FileRule(re.escape(fold['path']) + '\\/' + r['regex'], conf) for r in rules if int(r['indexer_folder_id']) == fold['id']] visit_folder(fold, api, applicable, tokens)