Adjust for resume settings

With .55 the resume setting is set per library. Instead query server to see if the item is played to offer delete
This commit is contained in:
angelblue05 2018-10-13 01:00:05 -05:00
parent 0d5a89757f
commit c76f19e42d
2 changed files with 18 additions and 20 deletions

View file

@ -154,9 +154,6 @@ class Connect(object):
if 'PrimaryImageTag' in self.user:
window('EmbyUserImage', api.API(self.user, client['auth/server-address']).get_user_artwork(self.user['Id']))
server_info = client['api'].get_system_info()
settings('markPlayed', value=str(server_info.get('MaxResumePct', 90)))
def select_servers(self, state=None):
state = state or self.connect_manager.connect({'enableAutoLogin': False})

View file

@ -344,23 +344,6 @@ class Player(xbmc.Player):
played = 100
item['CurrentPosition'] = int(item['Runtime'])
marker = float(settings('markPlayed')) / 100
LOG.info("Percent played: %s Mark played at: %s", played, marker)
delete = False
if item['Type'] == 'Episode' and settings('deleteTV.bool'):
delete = True
elif item['Type'] == 'Movie' and settings('deleteMovies.bool'):
delete = True
if not settings('offerDelete.bool'):
delete = False
if played >= marker and delete:
if dialog("yesno", heading=_(30091), line1=_(33015), autoclose=120000):
item['Server']['api'].delete_item(item['Id'])
data = {
'ItemId': item['Id'],
'MediaSourceId': item['MediaSourceId'],
@ -386,6 +369,24 @@ class Player(xbmc.Player):
for file in files:
xbmcvfs.delete(os.path.join(path, file.decode('utf-8')))
result = item['Server']['api'].get_item(item['Id']) or {}
if 'UserData' in result and result['UserData']['Played']:
delete = False
if result['Type'] == 'Episode' and settings('deleteTV.bool'):
delete = True
elif result['Type'] == 'Movie' and settings('deleteMovies.bool'):
delete = True
if not settings('offerDelete.bool'):
delete = False
if delete:
if dialog("yesno", heading=_(30091), line1=_(33015), autoclose=120000):
item['Server']['api'].delete_item(item['Id'])
window('emby.external_check', clear=True)
self.played.clear()