Skip to content

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddavo committed Jan 3, 2017
1 parent 254bbba commit d1aaedb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
9 changes: 5 additions & 4 deletions resources/lib/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ def getMediaType():
return None

def onPlayBackStarted(self):
self.onPlayBackStopped()
def onPlayBackSeek(self, *args):
#self.onPlayBackStopped()
pass
def onPlayBackSeek(self, *args):
self.onPlayBackStopped()
def onPlayBackResumed(self):
#self.onPlayBackStopped()
pass
self.onPlayBackStopped()
def onPlayBackEnded(self):
xbmc.log("Simkl: ONPLAYBACKENDED")
self.onPlayBackStopped()
Expand Down Expand Up @@ -119,3 +118,5 @@ def onPlayBackStopped(self):

except RuntimeError:
pass
except ZeroDivisionError:
self.onPlayBackStopped()
21 changes: 12 additions & 9 deletions resources/lib/simklapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,22 @@ def is_user_logged(self):

### SCROBBLING OR CHECKIN
def lock(self, fname, duration):
d = self.scrobbled_dict
d[fname] = time.time() + (100 - int(__addon__.getSetting("scr-pct"))) / 100 * duration
xbmc.log("Simkl: Locking {}".format(d))
xbmc.log("Duration: %s" %duration)
exp = self.scrobbled_dict
exp[fname] = int(time.time() + (105 - float(__addon__.getSetting("scr-pct"))) / 100 * duration)
xbmc.log("Simkl: Locking {}".format(exp))

def is_locked(self, fname):
d = self.scrobbled_dict
if not (fname in d.keys()): return 0
if d[fname] < time.time():
xbmc.log("Simkl: Can't scrobble, file locked")
xbmc.log(str(d))
exp = self.scrobbled_dict
if not (fname in exp.keys()): return 0
xbmc.log("Time: {}, exp: {}, Dif: {}".format(int(time.time()), exp[fname], int(exp[fname]-time.time())))
#When Dif reaches 0, scrobble.
if time.time() < exp[fname]:
xbmc.log("Simkl: Can't scrobble, file locked (alredy scrobbled)")
xbmc.log(str(exp))
return 1
else:
del d[fname]
del exp[fname]
return 0

def watched(self, filename, mediatype, duration, date=time.strftime('%Y-%m-%d %H:%M:%S')): #OR IDMB, member: only works with movies
Expand Down
Binary file modified script.simkl.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions tozip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#Creates a zip file compatible with Kodi

mkdir script.simkl
rsync -rv --progress ./ ./script.simkl --exclude-from .gitignore --exclude tozip.sh

rm script.simkl.zip
zip [email protected] script.simkl.zip script.simkl/*
rm -Rf script.simkl

rsync -rv --progress ./ ./script.simkl --exclude-from .gitignore --exclude tozip.sh
zip [email protected] script.simkl.zip script.simkl/* -x script.simkl/script.simkl/
rm -Rf script.simkl

0 comments on commit d1aaedb

Please sign in to comment.