Fix Played Time

This commit is contained in:
Alhaziel01
2021-09-09 20:18:49 +02:00
parent 4350a593d7
commit 293f9e15c6

View File

@@ -1727,18 +1727,16 @@ 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 item.contentType == 'movie':
result = db['viewed'].get(ID)
elif S and E:
result = db['viewed'].get(ID, {}).get(str(S)+'x'+str(E))
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())
@@ -1759,22 +1757,23 @@ 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 e:
newDict = db['viewed'].get(ID, {})
newDict['{}x{}'.format(s, e)] = played_time
db['viewed'][ID] = newDict
if item.contentType == 'movie':
db['viewed'][ID] = played_time
elif E:
newDict = db['viewed'].get(ID, {})
newDict[str(S) + 'x' + str(E)] = played_time
db['viewed'][ID] = newDict
except:
import traceback
logger.error(traceback.format_exc())
del db['viewed'][ID]
def prevent_busy(item):
logger.debug()
if not item.autoplay and not item.window: