Fix Ricerca Globale

This commit is contained in:
Alhaziel01
2021-09-09 20:10:04 +02:00
parent b84f682461
commit dd309c307e
40 changed files with 185 additions and 211 deletions

View File

@@ -1783,6 +1783,7 @@ def get_platform():
def get_played_time(item):
logger.debug()
from core import db
# from core.support import dbg;dbg()
played_time = 0
if not item.infoLabels:
@@ -1791,18 +1792,15 @@ def get_played_time(item):
if not ID:
return 0
S = item.infoLabels.get('season', 0)
E = item.infoLabels.get('episode')
s = item.infoLabels.get('season',0)
e = item.infoLabels.get('episode')
result = None
try:
if S and E:
result = db['viewed'].get(ID, {}).get(str(S)+'x'+str(E))
else:
result = db['viewed'].get(ID)
if result:
played_time = result
result = db['viewed'].get(ID)
if type(result) == dict:
result = db['viewed'].get(ID, {}).get('{}x{}'.format(s, e), 0)
played_time = result
except:
import traceback
logger.error(traceback.format_exc())
@@ -1814,6 +1812,7 @@ def get_played_time(item):
def set_played_time(item):
logger.debug()
from core import db
# from core.support import dbg;dbg()
played_time = item.played_time
if not item.infoLabels:
@@ -1823,15 +1822,15 @@ def set_played_time(item):
if not ID:
return
S = item.infoLabels.get('season', 0)
E = item.infoLabels.get('episode')
s = item.infoLabels.get('season',0)
e = item.infoLabels.get('episode')
try:
if item.contentType == 'movie':
db['viewed'][ID] = played_time
elif E:
elif e:
newDict = db['viewed'].get(ID, {})
newDict[str(S) + 'x' + str(E)] = played_time
newDict['{}x{}'.format(s, e)] = played_time
db['viewed'][ID] = newDict
except:
import traceback