Merge pull request #773 from croneter/fix-direct-paths
Fix playback sometimes not being reported for direct paths
This commit is contained in:
commit
71af3d0ca6
2 changed files with 11 additions and 18 deletions
|
@ -22,12 +22,9 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None):
|
||||||
"""
|
"""
|
||||||
kodi_id = None
|
kodi_id = None
|
||||||
path = utils.try_decode(path)
|
path = utils.try_decode(path)
|
||||||
try:
|
path, filename = path_ops.path.split(path)
|
||||||
filename = path.rsplit('/', 1)[1]
|
# Make sure path ends in either '/' or '\'
|
||||||
path = path.rsplit('/', 1)[0] + '/'
|
path = path_ops.path.join(path, '')
|
||||||
except IndexError:
|
|
||||||
filename = path.rsplit('\\', 1)[1]
|
|
||||||
path = path.rsplit('\\', 1)[0] + '\\'
|
|
||||||
if kodi_type == v.KODI_TYPE_SONG or db_type == 'music':
|
if kodi_type == v.KODI_TYPE_SONG or db_type == 'music':
|
||||||
with KodiMusicDB(lock=False) as kodidb:
|
with KodiMusicDB(lock=False) as kodidb:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -372,19 +372,15 @@ def verify_kodi_item(plex_id, kodi_item):
|
||||||
raise PlaylistError
|
raise PlaylistError
|
||||||
LOG.debug('Starting research for Kodi id since we didnt get one: %s',
|
LOG.debug('Starting research for Kodi id since we didnt get one: %s',
|
||||||
kodi_item)
|
kodi_item)
|
||||||
kodi_id, _ = kodiid_from_filename(kodi_item['file'],
|
# Try the VIDEO DB first - will find both movies and episodes
|
||||||
v.KODI_TYPE_MOVIE)
|
kodi_id, kodi_type = kodiid_from_filename(kodi_item['file'],
|
||||||
kodi_item['type'] = v.KODI_TYPE_MOVIE
|
db_type='video')
|
||||||
if kodi_id is None:
|
if not kodi_id:
|
||||||
kodi_id, _ = kodiid_from_filename(kodi_item['file'],
|
# No movie or episode found - try MUSIC DB now for songs
|
||||||
v.KODI_TYPE_EPISODE)
|
kodi_id, kodi_type = kodiid_from_filename(kodi_item['file'],
|
||||||
kodi_item['type'] = v.KODI_TYPE_EPISODE
|
db_type='music')
|
||||||
if kodi_id is None:
|
|
||||||
kodi_id, _ = kodiid_from_filename(kodi_item['file'],
|
|
||||||
v.KODI_TYPE_SONG)
|
|
||||||
kodi_item['type'] = v.KODI_TYPE_SONG
|
|
||||||
kodi_item['id'] = kodi_id
|
kodi_item['id'] = kodi_id
|
||||||
kodi_item['type'] = None if kodi_id is None else kodi_item['type']
|
kodi_item['type'] = None if kodi_id is None else kodi_type
|
||||||
LOG.debug('Research results for kodi_item: %s', kodi_item)
|
LOG.debug('Research results for kodi_item: %s', kodi_item)
|
||||||
return kodi_item
|
return kodi_item
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue