Fix report progress

And other issues
This commit is contained in:
angelblue05 2018-09-06 17:28:51 -05:00
parent 5f9c071c39
commit 77843c7f1d
5 changed files with 20 additions and 11 deletions

View file

@ -301,7 +301,7 @@ def get_objects(src, filename):
if not xbmcvfs.exists(temp): if not xbmcvfs.exists(temp):
xbmcvfs.mkdir(temp) xbmcvfs.mkdir(temp)
else: else:
delete_build(temp) delete_build()
path = os.path.join(temp, filename) path = os.path.join(temp, filename)
try: try:

View file

@ -98,9 +98,9 @@ class Service(xbmc.Monitor):
if self.monitor.player.isPlaying(): if self.monitor.player.isPlaying():
difference = datetime.today() - self.settings['last_progress'] difference = datetime.today() - self.settings['last_progress']
if difference.seconds > 270: if difference.seconds > 10:
event("ReportProgressRequested", None) event('ReportProgressRequested', {'Report': difference.seconds > 270})
self.settings['last_progress'] = datetime.today() self.settings['last_progress'] = datetime.today()
if self.waitForAbort(1): if self.waitForAbort(1):

View file

@ -45,7 +45,8 @@ def set_properties(item, method, server_id=None):
'DeviceId': client.get_device_id(), 'DeviceId': client.get_device_id(),
'SubsMapping': info.get('Subtitles'), 'SubsMapping': info.get('Subtitles'),
'AudioStreamIndex': info.get('AudioStreamIndex'), 'AudioStreamIndex': info.get('AudioStreamIndex'),
'SubtitleStreamIndex': info.get('SubtitleStreamIndex') 'SubtitleStreamIndex': info.get('SubtitleStreamIndex'),
'CurrentPosition': info.get('CurrentPosition')
}) })
window('emby_play.json', current) window('emby_play.json', current)

View file

@ -189,7 +189,7 @@ class Monitor(xbmc.Monitor):
data.get('SubtitleStreamIndex')).start() data.get('SubtitleStreamIndex')).start()
elif method == 'ReportProgressRequested': elif method == 'ReportProgressRequested':
self.player.report_playback() self.player.report_playback(data['Report'])
elif method == 'Playstate': elif method == 'Playstate':
self.playstate(data) self.playstate(data)

View file

@ -100,11 +100,13 @@ class Player(xbmc.Player):
'SubtitleStreamIndex': item['SubtitleStreamIndex'] 'SubtitleStreamIndex': item['SubtitleStreamIndex']
} }
item['Server']['api'].session_playing(data) item['Server']['api'].session_playing(data)
self.set_audio_subs(item['AudioStreamIndex'], item['SubtitleStreamIndex'])
self.detect_audio_subs(item)
window('emby.skip.%s.bool' % item['Id'], True) window('emby.skip.%s.bool' % item['Id'], True)
if monitor.waitForAbort(2):
return
self.set_audio_subs(item['AudioStreamIndex'], item['SubtitleStreamIndex'])
def set_item(self, file, item): def set_item(self, file, item):
''' Set playback information. ''' Set playback information.
@ -131,7 +133,7 @@ class Player(xbmc.Player):
item.update({ item.update({
'File': file, 'File': file,
'CurrentPosition': int(seektime), 'CurrentPosition': item.get('CurrentPosition') or int(seektime),
'Muted': muted, 'Muted': muted,
'Volume': volume, 'Volume': volume,
'Server': Emby(item['ServerId']), 'Server': Emby(item['ServerId']),
@ -244,7 +246,7 @@ class Player(xbmc.Player):
self.report_playback() self.report_playback()
LOG.debug("--[ seek ]") LOG.debug("--[ seek ]")
def report_playback(self): def report_playback(self, report=True):
''' Report playback progress to emby server. ''' Report playback progress to emby server.
''' '''
@ -254,6 +256,12 @@ class Player(xbmc.Player):
return return
item = self.played[current_file] item = self.played[current_file]
if not report:
item['CurrentPosition'] = int(self.getTime())
return
result = JSONRPC('Application.GetProperties').execute({'properties': ["volume", "muted"]}) result = JSONRPC('Application.GetProperties').execute({'properties': ["volume", "muted"]})
result = result.get('result', {}) result = result.get('result', {})
item['Volume'] = result.get('volume') item['Volume'] = result.get('volume')
@ -309,7 +317,7 @@ class Player(xbmc.Player):
if item['CurrentPosition'] and item['Runtime']: if item['CurrentPosition'] and item['Runtime']:
try: try:
if window('emby.external'): if window('emby.external.bool'):
window('emby.external', clear=True) window('emby.external', clear=True)
raise ValueError raise ValueError