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):
xbmcvfs.mkdir(temp)
else:
delete_build(temp)
delete_build()
path = os.path.join(temp, filename)
try:

View File

@ -98,9 +98,9 @@ class Service(xbmc.Monitor):
if self.monitor.player.isPlaying():
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()
if self.waitForAbort(1):

View File

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

View File

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

View File

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