From 1bfe457b096c3a2b863f5e4fb0ea4a4d170a193d Mon Sep 17 00:00:00 2001 From: shaun Date: Sat, 14 Mar 2015 22:50:16 +1100 Subject: [PATCH] update service so it only runs at 120 sec full and 30 sec play counts updates also use increment logic as it is easier to follow --- service.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/service.py b/service.py index f9a7dde4..c5da47f9 100644 --- a/service.py +++ b/service.py @@ -49,8 +49,8 @@ class Service(): interval_FullSync = 120 interval_IncrementalSync = 30 - cur_seconds_fullsync = 0 - cur_seconds_incrsync = 0 + cur_seconds_fullsync = interval_FullSync + cur_seconds_incrsync = interval_IncrementalSync while not xbmc.abortRequested: @@ -83,18 +83,18 @@ class Service(): if DownloadUtils().authenticate(retreive=False) != "": #full sync - if((interval_FullSync >= cur_seconds_fullsync)): + if(cur_seconds_fullsync >= interval_FullSync): librarySync.syncDatabase() - cur_seconds_fullsync = interval_FullSync + cur_seconds_fullsync = 0 else: - cur_seconds_fullsync -= 1 + cur_seconds_fullsync += 1 #incremental sync - if((interval_IncrementalSync >= cur_seconds_incrsync)): + if(cur_seconds_incrsync >= interval_IncrementalSync): librarySync.updatePlayCounts() - cur_seconds_incrsync = interval_IncrementalSync + cur_seconds_incrsync = 0 else: - cur_seconds_incrsync -= 1 + cur_seconds_incrsync += 1 utils.logMsg("MB3 Sync Service" "stopping Service",0)