use eTag to determin changes in item to detect dirty cache
This commit is contained in:
@@ -12,6 +12,7 @@ import xbmc
|
||||
|
||||
from downloadutils import DownloadUtils
|
||||
from simple_logging import SimpleLogging
|
||||
from utils import getChecksum
|
||||
|
||||
log = SimpleLogging("EmbyCon." + __name__)
|
||||
|
||||
@@ -35,8 +36,20 @@ class DataManager():
|
||||
dataHashString = "";
|
||||
|
||||
for item in result:
|
||||
item_hash_string = getChecksum(item)
|
||||
item_hash_string = str(itemCount) + "_" + item.get("Name", "-") + "_" + item_hash_string + "|"
|
||||
log.debug("ITEM_HASH: " + item_hash_string)
|
||||
dataHashString += item_hash_string
|
||||
|
||||
itemCount = itemCount + 1
|
||||
|
||||
'''
|
||||
userData = item.get("UserData")
|
||||
if(userData != None):
|
||||
|
||||
dataHashString += getChecksum(item)
|
||||
|
||||
|
||||
if(item.get("IsFolder") == False):
|
||||
itemCount = itemCount + 1
|
||||
itemPercent = 0.0
|
||||
@@ -62,7 +75,8 @@ class DataManager():
|
||||
itemString = str(itemCount) + "_" + item.get("Name", "name") + "_" + str(int(PlayedPercentage)) + "-" + str(unwatchedItemCount) + "|"
|
||||
log.debug(itemString)
|
||||
dataHashString = dataHashString + itemString
|
||||
|
||||
'''
|
||||
|
||||
# hash the data
|
||||
dataHashString = dataHashString.encode("UTF-8")
|
||||
m = hashlib.md5()
|
||||
|
||||
@@ -86,6 +86,22 @@ def getKodiVersion():
|
||||
return version
|
||||
|
||||
def getDetailsString():
|
||||
detailsString = "EpisodeCount,SeasonCount,Path,Genres,Studios,CumulativeRunTimeTicks,MediaStreams,Overview"
|
||||
detailsString = "EpisodeCount,SeasonCount,Path,Genres,Studios,CumulativeRunTimeTicks,MediaStreams,Overview,Etag"
|
||||
#detailsString = "EpisodeCount,SeasonCount,Path,Genres,CumulativeRunTimeTicks"
|
||||
return detailsString
|
||||
|
||||
def getChecksum(item):
|
||||
# Use the etags checksum and userdata
|
||||
userdata = item['UserData']
|
||||
|
||||
checksum = "%s_%s_%s_%s_%s_%s" % (
|
||||
item['Etag'],
|
||||
userdata['Played'],
|
||||
userdata['IsFavorite'],
|
||||
userdata.get('Likes', "-"),
|
||||
userdata['PlaybackPositionTicks'],
|
||||
userdata.get('UnplayedItemCount', "-")#,
|
||||
#userdata.get('LastPlayedDate', "-")
|
||||
)
|
||||
|
||||
return checksum
|
||||
|
||||
@@ -108,7 +108,6 @@ class WebSocketThread(threading.Thread):
|
||||
result = json.loads(message)
|
||||
|
||||
messageType = result.get("MessageType")
|
||||
playCommand = result.get("PlayCommand")
|
||||
data = result.get("Data")
|
||||
|
||||
if(messageType != None and messageType == "Play" and data != None):
|
||||
|
||||
Reference in New Issue
Block a user