commit
52aaa80714
6 changed files with 62 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
||||||
[![stable version](https://img.shields.io/badge/stable_version-2.10.0-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip)
|
[![stable version](https://img.shields.io/badge/stable_version-2.10.1-blue.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/stable/repository.plexkodiconnect/repository.plexkodiconnect-1.0.2.zip)
|
||||||
[![beta version](https://img.shields.io/badge/beta_version-2.10.0-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip)
|
[![beta version](https://img.shields.io/badge/beta_version-2.10.1-red.svg?maxAge=60&style=flat) ](https://github.com/croneter/binary_repo/raw/master/beta/repository.plexkodiconnectbeta/repository.plexkodiconnectbeta-1.0.2.zip)
|
||||||
|
|
||||||
[![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation)
|
[![Installation](https://img.shields.io/badge/wiki-installation-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/Installation)
|
||||||
[![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)
|
[![FAQ](https://img.shields.io/badge/wiki-FAQ-brightgreen.svg?maxAge=60&style=flat)](https://github.com/croneter/PlexKodiConnect/wiki/faq)
|
||||||
|
|
13
addon.xml
13
addon.xml
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.10.0" provider-name="croneter">
|
<addon id="plugin.video.plexkodiconnect" name="PlexKodiConnect" version="2.10.1" provider-name="croneter">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.requests" version="2.9.1" />
|
<import addon="script.module.requests" version="2.9.1" />
|
||||||
<import addon="script.module.defusedxml" version="0.5.0"/>
|
<import addon="script.module.defusedxml" version="0.5.0"/>
|
||||||
<import addon="plugin.video.plexkodiconnect.movies" version="2.1.2" />
|
<import addon="plugin.video.plexkodiconnect.movies" version="2.1.3" />
|
||||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.1.2" />
|
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.1.3" />
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||||
<provides>video audio image</provides>
|
<provides>video audio image</provides>
|
||||||
|
@ -83,7 +83,12 @@
|
||||||
<summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary>
|
<summary lang="lt_LT">Natūralioji „Plex“ integracija į „Kodi“</summary>
|
||||||
<description lang="lt_LT">Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika!</description>
|
<description lang="lt_LT">Prijunkite „Kodi“ prie „Plex Medija Serverio“. Šiame papildinyje daroma prielaida, kad valdote visus savo vaizdo įrašus naudodami „Plex“ (ir nė vieno su „Kodi“). Galite prarasti jau saugomus „Kodi“ vaizdo įrašų ir muzikos duomenų bazių duomenis (kadangi šis papildinys juos tiesiogiai pakeičia). Naudokite savo pačių rizika!</description>
|
||||||
<disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer>
|
<disclaimer lang="lt_LT">Naudokite savo pačių rizika</disclaimer>
|
||||||
<news>version 2.10.0:
|
<news>version 2.10.1:
|
||||||
|
- Fix resume for Kodi on low powered devices, e.g. Raspberry Pi
|
||||||
|
- Fix resume when using an external player
|
||||||
|
- Fix UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
|
||||||
|
|
||||||
|
version 2.10.0:
|
||||||
- version 2.9.12 - 2.9.14 for everyone
|
- version 2.9.12 - 2.9.14 for everyone
|
||||||
- Get rid of some obsolete code for the ContextMonitor we dropped
|
- Get rid of some obsolete code for the ContextMonitor we dropped
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
version 2.10.1:
|
||||||
|
- Fix resume for Kodi on low powered devices, e.g. Raspberry Pi
|
||||||
|
- Fix resume when using an external player
|
||||||
|
- Fix UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
|
||||||
|
|
||||||
version 2.10.0:
|
version 2.10.0:
|
||||||
- version 2.9.12 - 2.9.14 for everyone
|
- version 2.9.12 - 2.9.14 for everyone
|
||||||
- Get rid of some obsolete code for the ContextMonitor we dropped
|
- Get rid of some obsolete code for the ContextMonitor we dropped
|
||||||
|
|
|
@ -35,7 +35,8 @@ class PlayState(object):
|
||||||
'volume': 100,
|
'volume': 100,
|
||||||
'muted': False,
|
'muted': False,
|
||||||
'playmethod': None,
|
'playmethod': None,
|
||||||
'playcount': None
|
'playcount': None,
|
||||||
|
'external_player': False # bool - xbmc.Player().isExternalPlayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -349,6 +349,11 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
status['plex_type'] = plex_type
|
status['plex_type'] = plex_type
|
||||||
status['playmethod'] = item.playmethod
|
status['playmethod'] = item.playmethod
|
||||||
status['playcount'] = item.playcount
|
status['playcount'] = item.playcount
|
||||||
|
try:
|
||||||
|
status['external_player'] = app.APP.player.isExternalPlayer() == 1
|
||||||
|
except AttributeError:
|
||||||
|
# Kodi version < 17
|
||||||
|
pass
|
||||||
LOG.debug('Set the player state: %s', status)
|
LOG.debug('Set the player state: %s', status)
|
||||||
if not app.SYNC.direct_paths:
|
if not app.SYNC.direct_paths:
|
||||||
_notify_upnext(item)
|
_notify_upnext(item)
|
||||||
|
@ -403,17 +408,22 @@ def _record_playstate(status, ended):
|
||||||
LOG.debug('No playstate update due to Plex id not found: %s', status)
|
LOG.debug('No playstate update due to Plex id not found: %s', status)
|
||||||
return
|
return
|
||||||
totaltime = float(timing.kodi_time_to_millis(status['totaltime'])) / 1000
|
totaltime = float(timing.kodi_time_to_millis(status['totaltime'])) / 1000
|
||||||
if ended:
|
if status['external_player']:
|
||||||
progress = 0.99
|
_external_player_correct_plex_watch_count(db_item)
|
||||||
time = v.IGNORE_SECONDS_AT_START + 1
|
progress = 0.0
|
||||||
|
time = 0.0
|
||||||
else:
|
else:
|
||||||
time = float(timing.kodi_time_to_millis(status['time'])) / 1000
|
if ended:
|
||||||
try:
|
progress = 0.99
|
||||||
progress = time / totaltime
|
time = v.IGNORE_SECONDS_AT_START + 1
|
||||||
except ZeroDivisionError:
|
else:
|
||||||
progress = 0.0
|
time = float(timing.kodi_time_to_millis(status['time'])) / 1000
|
||||||
LOG.debug('Playback progress %s (%s of %s seconds)',
|
try:
|
||||||
progress, time, totaltime)
|
progress = time / totaltime
|
||||||
|
except ZeroDivisionError:
|
||||||
|
progress = 0.0
|
||||||
|
LOG.debug('Playback progress %s (%s of %s seconds)',
|
||||||
|
progress, time, totaltime)
|
||||||
playcount = status['playcount']
|
playcount = status['playcount']
|
||||||
last_played = timing.kodi_now()
|
last_played = timing.kodi_now()
|
||||||
if playcount is None:
|
if playcount is None:
|
||||||
|
@ -455,6 +465,22 @@ def _record_playstate(status, ended):
|
||||||
backgroundthread.BGThreader.addTasksToFront([task])
|
backgroundthread.BGThreader.addTasksToFront([task])
|
||||||
|
|
||||||
|
|
||||||
|
def _external_player_correct_plex_watch_count(db_item):
|
||||||
|
"""
|
||||||
|
Kodi won't safe playstate at all for external players
|
||||||
|
|
||||||
|
There's currently no way to get a resumpoint if an external player is
|
||||||
|
in use We are just checking whether we should mark video as
|
||||||
|
completely watched or completely unwatched (according to
|
||||||
|
playcountminimumtime set in playercorefactory.xml)
|
||||||
|
See https://kodi.wiki/view/External_players
|
||||||
|
"""
|
||||||
|
with kodi_db.KodiVideoDB() as kodidb:
|
||||||
|
playcount = kodidb.get_playcount(db_item['kodi_fileid'])
|
||||||
|
LOG.debug('External player detected. Playcount: %s', playcount)
|
||||||
|
PF.scrobble(db_item['plex_id'], 'watched' if playcount else 'unwatched')
|
||||||
|
|
||||||
|
|
||||||
def _clean_file_table():
|
def _clean_file_table():
|
||||||
"""
|
"""
|
||||||
If we associate a playing video e.g. pointing to plugin://... to an existing
|
If we associate a playing video e.g. pointing to plugin://... to an existing
|
||||||
|
|
|
@ -27,6 +27,7 @@ from . import app
|
||||||
LOG = getLogger('PLEX.playback')
|
LOG = getLogger('PLEX.playback')
|
||||||
# Do we need to return ultimately with a setResolvedUrl?
|
# Do we need to return ultimately with a setResolvedUrl?
|
||||||
RESOLVE = True
|
RESOLVE = True
|
||||||
|
TRY_TO_SEEK_FOR = 300 # =30 seconds
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -586,7 +587,7 @@ def threaded_playback(kodi_playlist, startpos, offset):
|
||||||
# PKC needs to quit
|
# PKC needs to quit
|
||||||
return
|
return
|
||||||
i += 1
|
i += 1
|
||||||
if i > 200:
|
if i > TRY_TO_SEEK_FOR:
|
||||||
LOG.error('Could not seek to %s', offset)
|
LOG.error('Could not seek to %s', offset)
|
||||||
return
|
return
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -594,10 +595,12 @@ def threaded_playback(kodi_playlist, startpos, offset):
|
||||||
while 'error' in answ:
|
while 'error' in answ:
|
||||||
# Kodi sometimes returns {u'message': u'Failed to execute method.',
|
# Kodi sometimes returns {u'message': u'Failed to execute method.',
|
||||||
# u'code': -32100} if user quickly switches videos
|
# u'code': -32100} if user quickly switches videos
|
||||||
i += 1
|
if app.APP.monitor.waitForAbort(0.1):
|
||||||
if i > 10:
|
# PKC needs to quit
|
||||||
LOG.error('Failed to seek to %s', offset)
|
return
|
||||||
|
i += 1
|
||||||
|
if i > TRY_TO_SEEK_FOR:
|
||||||
|
LOG.error('Failed to seek to %s. Error: %s', offset, answ)
|
||||||
return
|
return
|
||||||
app.APP.monitor.waitForAbort(0.1)
|
|
||||||
answ = js.seek_to(offset * 1000)
|
answ = js.seek_to(offset * 1000)
|
||||||
LOG.debug('Seek to offset %s successful', offset)
|
LOG.debug('Seek to offset %s successful', offset)
|
||||||
|
|
Loading…
Reference in a new issue