Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bigretromike/nakamori.player
Browse files Browse the repository at this point in the history
  • Loading branch information
bigretromike committed Oct 10, 2018
2 parents ad6fe08 + a667c1c commit 94b39a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<extension point="xbmc.addon.metadata">
<summary lang="en">Nakamori Player Module</summary>
<description lang="en">This module handle all the player related functions inside Nakamori</description>
<news>3.0.6[CR]- more frequent sync calling</news>
<news>3.0.7[CR]- fix for missing onPlayBackStopped</news>
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
<website>https://shokunin.monogatari.pl/</website>
Expand Down
12 changes: 7 additions & 5 deletions lib/nakamoriplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def did_i_watch_entire_episode(current_time, total_time, ep_id, user_rate):
mark = float(nt.addon.getSetting("watched_mark"))
mark /= 100
log('mark = %s * total = %s = %s < current = %s' % (mark, total_time, (total_time*mark), current_time))
if (total_time * mark) < current_time:
if (total_time * mark) <= current_time:
_finished = True
else:
# external set position = 1.0 when it want to mark it as watched (based on configuration of external)
Expand All @@ -53,7 +53,7 @@ def did_i_watch_entire_episode(current_time, total_time, ep_id, user_rate):
class Service(xbmc.Player):
def __init__(self):
log('Init')
# xbmc.Player.__init__(self)
xbmc.Player.__init__(self)
self._t = None # trakt thread
self._s = None # sync thread
self._details = None
Expand Down Expand Up @@ -88,14 +88,16 @@ def onPlayBackStarted(self):
self.Metadata['shoko:current'] = 0
# if I recall k17 give second * 1000 and k18 give only seconds
real_duration = int(self._details['duration'])
self.Metadata['shoko:duration'] = real_duration if real_duration < 1000000 else real_duration/1000
self.Metadata['shoko:duration'] = real_duration/1000 # if real_duration < 1000000 else real_duration/1000
self.Metadata['shoko:epid'] = self._details['epid']
self.Metadata['shoko:movie'] = self._details['movie']
self.Metadata['shoko:fileid'] = self._details['fileid']
self.Metadata['shoko:traktonce'] = True
self.Metadata['shoko:rawid'] = self._details['rawid']

self.PlaybackStatus = 'Playing'
while not self.isPlaying():
xbmc.sleep(100)
duration = self.getTotalTime()
if self.Transcoded:
duration = self.Metadata.get('shoko:duration')
Expand Down Expand Up @@ -160,7 +162,7 @@ def update_trakt(self):
self.Metadata.get('shoko:duration'), self.Metadata.get('shoko:movie'),
self.Metadata.get('shoko:traktonce'))
self.Metadata['shoko:traktonce'] = False
time.sleep(5)
xbmc.sleep(1000)
else:
log("trakt_thread: not playing anything")
return
Expand All @@ -171,7 +173,7 @@ def update_sync(self):
if nt.addon.getSetting("syncwatched") == "true" and self.getTime() > 10:
self.Metadata['shoko:current'] = self.getTime()
nt.sync_offset(self.Metadata.get('shoko:fileid'), self.Metadata.get('shoko:current'))
time.sleep(1)
xbmc.sleep(100)
except:
pass # while buffering
else:
Expand Down

0 comments on commit 94b39a9

Please sign in to comment.