From 3d4893061ccf6099ee2a912404ff785474ca0799 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Mon, 29 Nov 2021 10:28:23 +0100 Subject: [PATCH] Fix File .nfo in libreria --- platformcode/xbmc_videolibrary.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 21776e75..cfff9235 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -377,19 +377,20 @@ def set_watched_on_kod(data): filename = 'tvshow.nfo' path = filetools.join(path, filename) - head_nfo, item = videolibrarytools.read_nfo(path) - if item.library_playcounts: - item.library_playcounts.update({title: playcount}) - else: - item.library_playcounts = {title: playcount} - filetools.write(path, head_nfo + item.tojson()) + if filetools.exists(path): + head_nfo, item = videolibrarytools.read_nfo(path) + if item.library_playcounts: + item.library_playcounts.update({title: playcount}) + else: + item.library_playcounts = {title: playcount} + filetools.write(path, head_nfo + item.tojson()) - if item.infoLabels['mediatype'] == "tvshow": - for season in item.library_playcounts: - if "season" in season: - season_num = int(scrapertools.find_single_match(season, r'season (\d+)')) - item = videolibrary.check_season_playcount(item, season_num) - filetools.write(path, head_nfo + item.tojson()) + if item.infoLabels['mediatype'] == "tvshow": + for season in item.library_playcounts: + if "season" in season: + season_num = int(scrapertools.find_single_match(season, r'season (\d+)')) + item = videolibrary.check_season_playcount(item, season_num) + filetools.write(path, head_nfo + item.tojson()) def mark_content_as_watched_on_kod(path): from specials import videolibrary