Use direct paths - not yet working for music
This commit is contained in:
parent
cd930da509
commit
aaa8ada3ea
10 changed files with 235 additions and 120 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.plexkodiconnect"
|
<addon id="plugin.video.plexkodiconnect"
|
||||||
name="PlexKodiConnect"
|
name="PlexKodiConnect"
|
||||||
version="1.0.11"
|
version="1.0.12"
|
||||||
provider-name="croneter">
|
provider-name="croneter">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
version 1.0.12
|
||||||
|
- Possibility to use direct paths (you need to reset!)
|
||||||
|
- Replicate Plex views in video nodes
|
||||||
|
|
||||||
version 1.0.11
|
version 1.0.11
|
||||||
- Hotfix DB comparison. Sorry for that :-)
|
- Hotfix DB comparison. Sorry for that :-)
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@
|
||||||
<string id="30508">Sync empty TV Shows</string>
|
<string id="30508">Sync empty TV Shows</string>
|
||||||
<string id="30509">Enable Music Library (restart Kodi!)</string>
|
<string id="30509">Enable Music Library (restart Kodi!)</string>
|
||||||
<string id="30510">Direct stream music library</string>
|
<string id="30510">Direct stream music library</string>
|
||||||
<string id="30511">Playback Mode</string>
|
<string id="30511">Playback Mode (resync!)</string>
|
||||||
<string id="30512">Force artwork caching</string>
|
<string id="30512">Force artwork caching</string>
|
||||||
<string id="30513">Limit artwork cache threads (recommended for rpi)</string>
|
<string id="30513">Limit artwork cache threads (recommended for rpi)</string>
|
||||||
<string id="30514">Enable fast startup (requires server plugin)</string>
|
<string id="30514">Enable fast startup (requires server plugin)</string>
|
||||||
|
@ -366,6 +366,14 @@
|
||||||
<string id="39024">[COLOR yellow]Reset PMS and plex.tv connections to re-login[/COLOR]</string>
|
<string id="39024">[COLOR yellow]Reset PMS and plex.tv connections to re-login[/COLOR]</string>
|
||||||
<string id="39025">Automatically log into plex.tv on startup</string>
|
<string id="39025">Automatically log into plex.tv on startup</string>
|
||||||
<string id="39026">Enable constant background sync (restart Kodi!)</string>
|
<string id="39026">Enable constant background sync (restart Kodi!)</string>
|
||||||
|
<string id="39027">Playback Mode</string>
|
||||||
|
<string id="39028">CAUTION! If you choose "Native" mode , you might loose access to certain Plex features such as: Plex trailers and transcoding options. ALL Plex shares need to use direct paths (e.g. smb://myNAS/mymovie.mkv or \\myNAS/mymovie.mkv)!</string>
|
||||||
|
<string id="39029">Network credentials</string>
|
||||||
|
<string id="39030">Add network credentials to allow Kodi access to your content? Note: Skipping this step may generate a message during the initial scan of your content if Kodi can't locate your content.</string>
|
||||||
|
<string id="39031">Kodi can't locate file: </string>
|
||||||
|
<string id="39032">Please verify the path. You may need to verify your network credentials in the add-on settings or use different Plex paths. Stop syncing?</string>
|
||||||
|
<string id="39033">Shall we transform Plex paths from e.g. \\myNas\mymovie.mkv to smb://myNas/mymovie.mkv? (recommended)</string>
|
||||||
|
<string id="39034">Replace Plex paths \\myNas with SMB paths smb://myNas (resync!)</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Plex Entrypoint.py -->
|
<!-- Plex Entrypoint.py -->
|
||||||
|
|
|
@ -302,6 +302,14 @@
|
||||||
<string id="39024">[COLOR yellow]PMS und plex.tv Verbindungen zurücksetzen für erneuten Login[/COLOR]</string>
|
<string id="39024">[COLOR yellow]PMS und plex.tv Verbindungen zurücksetzen für erneuten Login[/COLOR]</string>
|
||||||
<string id="39025">Automatisch beim Starten bei plex.tv einloggen</string>
|
<string id="39025">Automatisch beim Starten bei plex.tv einloggen</string>
|
||||||
<string id="39026">Laufende Synchronisierung im Hintergrund aktivieren (Neustart!)</string>
|
<string id="39026">Laufende Synchronisierung im Hintergrund aktivieren (Neustart!)</string>
|
||||||
|
<string id="39027">Playback Modus</string>
|
||||||
|
<string id="39028">WARNUNG! Mit dem "Native" Modus verlieren Sie Zugang zu Plex Funktionen wie z.B. Trailer und Transkodieren. ALLE Plex Bibliotheken müssen über direkte Plex Pfade für Kodi zugänglich sein (z.B. via \\meinNas\MeinFilm.mkv oder smb://meinNas/MeinFilm.mkv)!</string>
|
||||||
|
<string id="39029">Netzwerk Zugangsdaten</string>
|
||||||
|
<string id="39030">Möchten Sie nun Netzwerk Zugangsdaten eingeben? Wenn Sie diesen Schritt überspringen, wird möglicherweise die Synchronisierung Ihrer Bibliothek fehlschlagen, wenn Kodi nicht auf Ihre Medien zugreifen kann.</string>
|
||||||
|
<string id="39031">Kodi kann die folgende Datei nicht finden: </string>
|
||||||
|
<string id="39032">Bitte verifizieren Sie den Pfad. Möglichweise müssen Sie in den Addon Einstellungen die Netzwerk Zugangsdaten korrekt eingeben, oder Plex muss andere Pfade nutzen. Soll Sync gestoppt werden?</string>
|
||||||
|
<string id="39033">Sollen alle Plex Pfade \\meinNAS\meinFilm.mkv durch smb://meinNAS/meinFilm.mkv ersetzt werden? (empfohlen)</string>
|
||||||
|
<string id="39034">Plex Pfade \\meinNAS durch SMB Pfade smb://meinNAS ersetzen (neu synchen!)</string>
|
||||||
|
|
||||||
<!-- Plex Entrypoint.py -->
|
<!-- Plex Entrypoint.py -->
|
||||||
<string id="39200">Plex Home Benutzer wechseln</string>
|
<string id="39200">Plex Home Benutzer wechseln</string>
|
||||||
|
|
|
@ -53,7 +53,7 @@ import requests
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
from urllib import urlencode, quote_plus
|
from urllib import urlencode, quote_plus, unquote
|
||||||
|
|
||||||
from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled
|
from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled
|
||||||
|
|
||||||
|
@ -1478,7 +1478,7 @@ class API():
|
||||||
"""
|
"""
|
||||||
Returns the type of media, e.g. 'movie' or 'clip' for trailers
|
Returns the type of media, e.g. 'movie' or 'clip' for trailers
|
||||||
"""
|
"""
|
||||||
return self.item.attrib.get('type', None)
|
return self.item.attrib.get('type')
|
||||||
|
|
||||||
def getChecksum(self):
|
def getChecksum(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1493,19 +1493,43 @@ class API():
|
||||||
"""
|
"""
|
||||||
Returns the Plex key such as '246922' as a string
|
Returns the Plex key such as '246922' as a string
|
||||||
"""
|
"""
|
||||||
return self.item.attrib.get('ratingKey', None)
|
return self.item.attrib.get('ratingKey')
|
||||||
|
|
||||||
def getKey(self):
|
def getKey(self):
|
||||||
"""
|
"""
|
||||||
Returns the Plex key such as '/library/metadata/246922'
|
Returns the Plex key such as '/library/metadata/246922'
|
||||||
"""
|
"""
|
||||||
return self.item.attrib.get('key', None)
|
return self.item.attrib.get('key')
|
||||||
|
|
||||||
|
def getFilePath(self):
|
||||||
|
"""
|
||||||
|
Returns the direct path to this item, e.g. '\\NAS\movies\movie.mkv'
|
||||||
|
or None
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
res = self.item[0][0].attrib.get('file')
|
||||||
|
except:
|
||||||
|
res = None
|
||||||
|
if res:
|
||||||
|
res = unquote(res).decode('utf-8')
|
||||||
|
return res
|
||||||
|
|
||||||
|
def getTVShowPath(self):
|
||||||
|
"""
|
||||||
|
Returns the direct path to the TV show, e.g. '\\NAS\tv\series'
|
||||||
|
or None
|
||||||
|
"""
|
||||||
|
res = None
|
||||||
|
for child in self.item:
|
||||||
|
if child.tag == 'Location':
|
||||||
|
res = child.attrib.get('path')
|
||||||
|
return res
|
||||||
|
|
||||||
def getIndex(self):
|
def getIndex(self):
|
||||||
"""
|
"""
|
||||||
Returns the 'index' of an PMS XML reply. Depicts e.g. season number.
|
Returns the 'index' of an PMS XML reply. Depicts e.g. season number.
|
||||||
"""
|
"""
|
||||||
return self.item.attrib.get('index', None)
|
return self.item.attrib.get('index')
|
||||||
|
|
||||||
def getDateCreated(self):
|
def getDateCreated(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -234,6 +234,26 @@ class InitialSetup():
|
||||||
if forcePlexTV:
|
if forcePlexTV:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Direct paths (\\NAS\mymovie.mkv) or addon (http)?
|
||||||
|
if dialog.yesno(heading=self.addonName,
|
||||||
|
line1=string(39027),
|
||||||
|
line2=string(39028),
|
||||||
|
nolabel="Addon (Default)",
|
||||||
|
yeslabel="Native (Direct Paths)"):
|
||||||
|
self.logMsg("User opted to use direct paths.", 1)
|
||||||
|
utils.settings('useDirectPaths', value="1")
|
||||||
|
# Are you on a system where you would like to replace paths
|
||||||
|
# \\NAS\mymovie.mkv with smb://NAS/mymovie.mkv? (e.g. Windows)
|
||||||
|
if dialog.yesno(heading=self.addonName,
|
||||||
|
line1=string(39033)):
|
||||||
|
self.logMsg("User chose to replace paths with smb", 1)
|
||||||
|
|
||||||
|
# Go to network credentials?
|
||||||
|
if dialog.yesno(heading=self.addonName,
|
||||||
|
line1=string(39029),
|
||||||
|
line2=string(39030)):
|
||||||
|
self.logMsg("Presenting network credentials dialog.", 1)
|
||||||
|
utils.passwordsXML()
|
||||||
# Disable Plex music?
|
# Disable Plex music?
|
||||||
if dialog.yesno(heading=self.addonName,
|
if dialog.yesno(heading=self.addonName,
|
||||||
line1=string(39016)):
|
line1=string(39016)):
|
||||||
|
|
|
@ -37,7 +37,10 @@ class Items(object):
|
||||||
self.doUtils = downloadutils.DownloadUtils()
|
self.doUtils = downloadutils.DownloadUtils()
|
||||||
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
||||||
# self.directpath = utils.settings('useDirectPaths') == "1"
|
# self.directpath = utils.settings('useDirectPaths') == "1"
|
||||||
self.directpath = False
|
self.directpath = True if utils.window('useDirectPaths') == 'true' \
|
||||||
|
else False
|
||||||
|
self.replaceSMB = True if utils.window('replaceSMB') == 'true' \
|
||||||
|
else False
|
||||||
# self.music_enabled = utils.settings('enableMusic') == "true"
|
# self.music_enabled = utils.settings('enableMusic') == "true"
|
||||||
# self.contentmsg = utils.settings('newContent') == "true"
|
# self.contentmsg = utils.settings('newContent') == "true"
|
||||||
|
|
||||||
|
@ -68,6 +71,23 @@ class Items(object):
|
||||||
self.kodiconn.close()
|
self.kodiconn.close()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def askToValidate(self, url):
|
||||||
|
"""
|
||||||
|
Displays a YESNO dialog box:
|
||||||
|
Kodi can't locate file: <url>. Please verify the path.
|
||||||
|
You may need to verify your network credentials in the
|
||||||
|
add-on settings or use different Plex paths. Stop syncing?
|
||||||
|
|
||||||
|
Returns True if sync should stop, else False
|
||||||
|
"""
|
||||||
|
import xbmcaddon
|
||||||
|
string = xbmcaddon.Addon().getLocalizedString
|
||||||
|
resp = xbmcgui.Dialog().yesno(
|
||||||
|
heading=self.addonName,
|
||||||
|
line1=string(39031) + url,
|
||||||
|
line2=string(39032))
|
||||||
|
return resp
|
||||||
|
|
||||||
def itemsbyId(self, items, process, pdialog=None):
|
def itemsbyId(self, items, process, pdialog=None):
|
||||||
# Process items by itemid. Process can be added, update, userdata, remove
|
# Process items by itemid. Process can be added, update, userdata, remove
|
||||||
emby = self.emby
|
emby = self.emby
|
||||||
|
@ -394,44 +414,45 @@ class Movies(Items):
|
||||||
"id=%s&mode=play") % extra['key']
|
"id=%s&mode=play") % extra['key']
|
||||||
break
|
break
|
||||||
|
|
||||||
##### GET THE FILE AND PATH #####
|
# GET THE FILE AND PATH #####
|
||||||
playurl = API.getKey()
|
doIndirect = not self.directpath
|
||||||
filename = playurl
|
|
||||||
# if "\\" in playurl:
|
|
||||||
# # Local path
|
|
||||||
# filename = playurl.rsplit("\\", 1)[1]
|
|
||||||
# else: # Network share
|
|
||||||
# filename = playurl.rsplit("/", 1)[1]
|
|
||||||
|
|
||||||
if self.directpath:
|
if self.directpath:
|
||||||
# Direct paths is set the Kodi way
|
# Direct paths is set the Kodi way
|
||||||
if utils.window('emby_pathverified') != "true" and not xbmcvfs.exists(playurl):
|
playurl = API.getFilePath()
|
||||||
# Validate the path is correct with user intervention
|
if playurl is None:
|
||||||
resp = xbmcgui.Dialog().yesno(
|
# Something went wrong, trying to use non-direct paths
|
||||||
heading="Can't validate path",
|
doIndirect = True
|
||||||
line1=(
|
else:
|
||||||
"Kodi can't locate file: %s. Verify the path. "
|
if self.replaceSMB:
|
||||||
"You may to verify your network credentials in the "
|
if playurl.startswith('\\\\'):
|
||||||
"add-on settings or use the emby path substitution "
|
playurl = playurl.replace('\\', '/')
|
||||||
"to format your path correctly. Stop syncing?"
|
playurl = 'smb:' + playurl
|
||||||
% playurl))
|
if (utils.window('emby_pathverified') != "true" and
|
||||||
if resp:
|
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||||
utils.window('emby_shouldStop', value="true")
|
# Validate the path is correct with user intervention
|
||||||
return False
|
if self.askToValidate(playurl):
|
||||||
|
utils.window('emby_shouldStop', value="true")
|
||||||
path = playurl.replace(filename, "")
|
return False
|
||||||
utils.window('emby_pathverified', value="true")
|
if "\\" in playurl:
|
||||||
else:
|
# Local path
|
||||||
|
filename = playurl.rsplit("\\", 1)[1]
|
||||||
|
else:
|
||||||
|
# Network share
|
||||||
|
filename = playurl.rsplit("/", 1)[1]
|
||||||
|
path = playurl.replace(filename, "")
|
||||||
|
utils.window('emby_pathverified', value="true")
|
||||||
|
if doIndirect:
|
||||||
# Set plugin path and media flags using real filename
|
# Set plugin path and media flags using real filename
|
||||||
path = "plugin://plugin.video.plexkodiconnect.movies/"
|
path = "plugin://plugin.video.plexkodiconnect.movies/"
|
||||||
params = {
|
params = {
|
||||||
'filename': filename.encode('utf-8'),
|
'filename': API.getKey().encode('utf-8'),
|
||||||
'id': itemid,
|
'id': itemid,
|
||||||
'dbid': movieid,
|
'dbid': movieid,
|
||||||
'mode': "play"
|
'mode': "play"
|
||||||
}
|
}
|
||||||
filename = "%s?%s" % (path, urllib.urlencode(params))
|
filename = "%s?%s" % (path, urllib.urlencode(params))
|
||||||
##### UPDATE THE MOVIE #####
|
|
||||||
|
# UPDATE THE MOVIE #####
|
||||||
if update_item:
|
if update_item:
|
||||||
self.logMsg("UPDATE movie itemid: %s - Title: %s" % (itemid, title), 1)
|
self.logMsg("UPDATE movie itemid: %s - Title: %s" % (itemid, title), 1)
|
||||||
|
|
||||||
|
@ -1008,38 +1029,38 @@ class TVShows(Items):
|
||||||
studio = None
|
studio = None
|
||||||
|
|
||||||
# GET THE FILE AND PATH #####
|
# GET THE FILE AND PATH #####
|
||||||
playurl = API.getKey()
|
doIndirect = not self.directpath
|
||||||
|
|
||||||
if self.directpath:
|
if self.directpath:
|
||||||
# Direct paths is set the Kodi way
|
# Direct paths is set the Kodi way
|
||||||
if "\\" in playurl:
|
playurl = API.getTVShowPath()
|
||||||
# Local path
|
if playurl is None:
|
||||||
path = "%s\\" % playurl
|
# Something went wrong, trying to use non-direct paths
|
||||||
toplevelpath = "%s\\" % dirname(dirname(path))
|
doIndirect = True
|
||||||
else:
|
else:
|
||||||
# Network path
|
if self.replaceSMB:
|
||||||
path = "%s/" % playurl
|
if playurl.startswith('\\\\'):
|
||||||
toplevelpath = "%s/" % dirname(dirname(path))
|
playurl = playurl.replace('\\', '/')
|
||||||
|
playurl = 'smb:' + playurl
|
||||||
if utils.window('emby_pathverified') != "true" and not xbmcvfs.exists(path):
|
if "\\" in playurl:
|
||||||
# Validate the path is correct with user intervention
|
# Local path
|
||||||
resp = xbmcgui.Dialog().yesno(
|
path = "%s\\" % playurl
|
||||||
heading="Can't validate path",
|
toplevelpath = "%s\\" % dirname(dirname(path))
|
||||||
line1=(
|
else:
|
||||||
"Kodi can't locate file: %s. Verify the path. "
|
# Network path
|
||||||
"You may to verify your network credentials in the "
|
path = "%s/" % playurl
|
||||||
"add-on settings or use the emby path substitution "
|
toplevelpath = "%s/" % dirname(dirname(path))
|
||||||
"to format your path correctly. Stop syncing?"
|
if (utils.window('emby_pathverified') != "true" and
|
||||||
% playurl))
|
not xbmcvfs.exists(path.encode('utf-8'))):
|
||||||
if resp:
|
# Validate the path is correct with user intervention
|
||||||
utils.window('emby_shouldStop', value="true")
|
if self.askToValidate(playurl):
|
||||||
return False
|
utils.window('emby_shouldStop', value="true")
|
||||||
|
return False
|
||||||
utils.window('emby_pathverified', value="true")
|
utils.window('emby_pathverified', value="true")
|
||||||
else:
|
if doIndirect:
|
||||||
# Set plugin path
|
# Set plugin path
|
||||||
toplevelpath = "plugin://plugin.video.plexkodiconnect.tvshows/"
|
toplevelpath = "plugin://plugin.video.plexkodiconnect.tvshows/"
|
||||||
path = "%s%s/" % (toplevelpath, itemid)
|
path = "%s%s/" % (toplevelpath, itemid)
|
||||||
|
|
||||||
# UPDATE THE TVSHOW #####
|
# UPDATE THE TVSHOW #####
|
||||||
if update_item:
|
if update_item:
|
||||||
self.logMsg("UPDATE tvshow itemid: %s - Title: %s" % (itemid, title), 1)
|
self.logMsg("UPDATE tvshow itemid: %s - Title: %s" % (itemid, title), 1)
|
||||||
|
@ -1312,40 +1333,37 @@ class TVShows(Items):
|
||||||
seasonid = kodi_db.addSeason(showid, season)
|
seasonid = kodi_db.addSeason(showid, season)
|
||||||
|
|
||||||
# GET THE FILE AND PATH #####
|
# GET THE FILE AND PATH #####
|
||||||
playurl = API.getKey()
|
doIndirect = not self.directpath
|
||||||
filename = playurl
|
|
||||||
|
|
||||||
# if "\\" in playurl:
|
|
||||||
# # Local path
|
|
||||||
# filename = playurl.rsplit("\\", 1)[1]
|
|
||||||
# else: # Network share
|
|
||||||
# filename = playurl.rsplit("/", 1)[1]
|
|
||||||
|
|
||||||
if self.directpath:
|
if self.directpath:
|
||||||
# Direct paths is set the Kodi way
|
# Direct paths is set the Kodi way
|
||||||
if utils.window('emby_pathverified') != "true" and not xbmcvfs.exists(playurl):
|
playurl = API.getFilePath()
|
||||||
# Validate the path is correct with user intervention
|
if playurl is None:
|
||||||
resp = xbmcgui.Dialog().yesno(
|
# Something went wrong, trying to use non-direct paths
|
||||||
heading="Can't validate path",
|
doIndirect = True
|
||||||
line1=(
|
else:
|
||||||
"Kodi can't locate file: %s. Verify the path. "
|
if self.replaceSMB:
|
||||||
"You may to verify your network credentials in the "
|
if playurl.startswith('\\\\'):
|
||||||
"add-on settings or use the emby path substitution "
|
playurl = playurl.replace('\\', '/')
|
||||||
"to format your path correctly. Stop syncing?"
|
playurl = 'smb:' + playurl
|
||||||
% playurl))
|
if (utils.window('emby_pathverified') != "true" and
|
||||||
if resp:
|
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||||
utils.window('emby_shouldStop', value="true")
|
# Validate the path is correct with user intervention
|
||||||
return False
|
if self.askToValidate(playurl):
|
||||||
|
utils.window('emby_shouldStop', value="true")
|
||||||
path = playurl.replace(filename, "")
|
return False
|
||||||
utils.window('emby_pathverified', value="true")
|
if "\\" in playurl:
|
||||||
else:
|
# Local path
|
||||||
|
filename = playurl.rsplit("\\", 1)[1]
|
||||||
|
else:
|
||||||
|
# Network share
|
||||||
|
filename = playurl.rsplit("/", 1)[1]
|
||||||
|
path = playurl.replace(filename, "")
|
||||||
|
utils.window('emby_pathverified', value="true")
|
||||||
|
if doIndirect:
|
||||||
# Set plugin path and media flags using real filename
|
# Set plugin path and media flags using real filename
|
||||||
path = "plugin://plugin.video.plexkodiconnect.tvshows/%s/" % seriesId
|
path = "plugin://plugin.video.plexkodiconnect.movies/"
|
||||||
params = {
|
params = {
|
||||||
|
'filename': API.getKey().encode('utf-8'),
|
||||||
#'filename': filename.encode('utf-8'),
|
|
||||||
'filename': filename.encode('utf-8'),
|
|
||||||
'id': itemid,
|
'id': itemid,
|
||||||
'dbid': episodeid,
|
'dbid': episodeid,
|
||||||
'mode': "play"
|
'mode': "play"
|
||||||
|
@ -2063,24 +2081,48 @@ class Music(Items):
|
||||||
resume, duration = API.getRuntime()
|
resume, duration = API.getRuntime()
|
||||||
rating = userdata['UserRating']
|
rating = userdata['UserRating']
|
||||||
|
|
||||||
|
#if enabled, try to get the rating from file and/or emby
|
||||||
|
# if not self.directstream:
|
||||||
|
# rating, comment, hasEmbeddedCover = musicutils.getAdditionalSongTags(itemid, rating, API, kodicursor, emby_db, self.enableimportsongrating, self.enableexportsongrating, self.enableupdatesongrating)
|
||||||
|
# else:
|
||||||
|
# hasEmbeddedCover = False
|
||||||
|
# comment = API.getOverview()
|
||||||
|
|
||||||
|
hasEmbeddedCover = False
|
||||||
comment = None
|
comment = None
|
||||||
|
|
||||||
# Plex works a bit differently
|
# GET THE FILE AND PATH #####
|
||||||
# if self.directstream:
|
doIndirect = not self.directpath
|
||||||
path = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
if self.directpath:
|
||||||
filename = API.addPlexCredentialsToUrl(path)
|
# Direct paths is set the Kodi way
|
||||||
# Keep path empty to not let Kodi scan it
|
playurl = API.getFilePath()
|
||||||
path = None
|
if playurl is None:
|
||||||
# else:
|
# Something went wrong, trying to use non-direct paths
|
||||||
# path = "plugin://plugin.audio.plexkodiconnect.music/"
|
doIndirect = True
|
||||||
# filename = API.getKey()
|
else:
|
||||||
# params = {
|
if self.replaceSMB:
|
||||||
# 'filename': filename,
|
playurl = playurl.replace('\\', '/')
|
||||||
# 'id': itemid,
|
playurl = 'smb:' + playurl
|
||||||
# 'dbid': songid,
|
if (utils.window('emby_pathverified') != "true" and
|
||||||
# 'mode': "play"
|
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||||
# }
|
# Validate the path is correct with user intervention
|
||||||
# filename = "%s?%s" % (path, urllib.urlencode(params))
|
if self.askToValidate(playurl):
|
||||||
|
utils.window('emby_shouldStop', value="true")
|
||||||
|
return False
|
||||||
|
if "\\" in playurl:
|
||||||
|
# Local path
|
||||||
|
filename = playurl.rsplit("\\", 1)[1]
|
||||||
|
else:
|
||||||
|
# Network share
|
||||||
|
filename = playurl.rsplit("/", 1)[1]
|
||||||
|
path = playurl.replace(filename, "")
|
||||||
|
utils.window('emby_pathverified', value="true")
|
||||||
|
if doIndirect:
|
||||||
|
# Plex works a bit differently
|
||||||
|
path = "%s%s" % (self.server, item[0][0].attrib.get('key'))
|
||||||
|
filename = API.addPlexCredentialsToUrl(path)
|
||||||
|
# Keep path empty to not let Kodi scan it
|
||||||
|
path = None
|
||||||
|
|
||||||
# UPDATE THE SONG #####
|
# UPDATE THE SONG #####
|
||||||
if update_item:
|
if update_item:
|
||||||
|
|
|
@ -203,6 +203,11 @@ class UserClient(threading.Thread):
|
||||||
window('plex_machineIdentifier', value=self.machineIdentifier)
|
window('plex_machineIdentifier', value=self.machineIdentifier)
|
||||||
window('plex_servername', value=self.servername)
|
window('plex_servername', value=self.servername)
|
||||||
window('plex_authenticated', value='true')
|
window('plex_authenticated', value='true')
|
||||||
|
# self.directpath
|
||||||
|
window('useDirectPaths', value='true'
|
||||||
|
if utils.settings('useDirectPaths') == "1" else 'false')
|
||||||
|
window('replaceSMB', value='true'
|
||||||
|
if utils.settings('replaceSMB') == "true" else 'false')
|
||||||
|
|
||||||
# Set DownloadUtils values
|
# Set DownloadUtils values
|
||||||
doUtils.setUsername(username)
|
doUtils.setUsername(username)
|
||||||
|
|
|
@ -687,6 +687,7 @@ def passwordsXML():
|
||||||
# To add network credentials
|
# To add network credentials
|
||||||
path = xbmc.translatePath("special://userdata/").decode('utf-8')
|
path = xbmc.translatePath("special://userdata/").decode('utf-8')
|
||||||
xmlpath = "%spasswords.xml" % path
|
xmlpath = "%spasswords.xml" % path
|
||||||
|
logMsg('Path to passwords.xml: %s' % xmlpath, 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
xmlparse = etree.parse(xmlpath)
|
xmlparse = etree.parse(xmlpath)
|
||||||
|
@ -751,13 +752,15 @@ def passwordsXML():
|
||||||
return
|
return
|
||||||
# Network password
|
# Network password
|
||||||
password = dialog.input(
|
password = dialog.input(
|
||||||
heading="Enter the network password",
|
heading="Enter the network password",
|
||||||
option=xbmcgui.ALPHANUM_HIDE_INPUT)
|
default='',
|
||||||
if not password:
|
type=xbmcgui.INPUT_ALPHANUM,
|
||||||
return
|
option=xbmcgui.ALPHANUM_HIDE_INPUT)
|
||||||
|
|
||||||
|
logMsg('Done asking for user credentials', 1)
|
||||||
# Add elements
|
# Add elements
|
||||||
for path in root.findall('.//path'):
|
for path in root.findall('.//path'):
|
||||||
|
logMsg('Running in loop', 1)
|
||||||
if path.find('.//from').text.lower() == "smb://%s/" % server.lower():
|
if path.find('.//from').text.lower() == "smb://%s/" % server.lower():
|
||||||
# Found the server, rewrite credentials
|
# Found the server, rewrite credentials
|
||||||
path.find('.//to').text = "smb://%s:%s@%s/" % (user, password, server)
|
path.find('.//to').text = "smb://%s:%s@%s/" % (user, password, server)
|
||||||
|
@ -773,19 +776,19 @@ def passwordsXML():
|
||||||
|
|
||||||
# Add credentials
|
# Add credentials
|
||||||
settings('networkCreds', value="%s" % server)
|
settings('networkCreds', value="%s" % server)
|
||||||
logMsg("EMBY", "Added server: %s to passwords.xml" % server, 1)
|
logMsg("PLEX", "Added server: %s to passwords.xml" % server, 1)
|
||||||
# Prettify and write to file
|
# Prettify and write to file
|
||||||
try:
|
try:
|
||||||
indent(root)
|
indent(root)
|
||||||
except: pass
|
except: pass
|
||||||
etree.ElementTree(root).write(xmlpath)
|
etree.ElementTree(root).write(xmlpath)
|
||||||
|
|
||||||
dialog.notification(
|
# dialog.notification(
|
||||||
heading="PlexKodiConnect",
|
# heading="PlexKodiConnect",
|
||||||
message="%s added to passwords.xml" % server,
|
# message="Added to passwords.xml",
|
||||||
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
|
# icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
|
||||||
time=1000,
|
# time=5000,
|
||||||
sound=False)
|
# sound=False)
|
||||||
|
|
||||||
def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
|
def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="5" visible="eq(-1,true)" subsetting="true" /> <!-- Limit artwork cache threads -->
|
<setting id="imageCacheLimit" type="enum" label="30513" values="Disabled|5|10|15|20|25" default="5" visible="eq(-1,true)" subsetting="true" /> <!-- Limit artwork cache threads -->
|
||||||
<setting id="syncThreadNumber" type="slider" label="39003" default="5" option="int" range="1,1,20"/>
|
<setting id="syncThreadNumber" type="slider" label="39003" default="5" option="int" range="1,1,20"/>
|
||||||
<setting id="syncEmptyShows" type="bool" label="30508" default="false" visible="false"/>
|
<setting id="syncEmptyShows" type="bool" label="30508" default="false" visible="false"/>
|
||||||
<setting id="useDirectPaths" type="enum" label="30511" values="Addon(Default)|Native(Direct paths)" default="0" visible="false"/> <!-- Playback mode -->
|
<setting id="useDirectPaths" type="enum" label="30511" values="Addon(Default)|Native(Direct paths)" default="0" visible="true"/> <!-- Playback mode -->
|
||||||
|
<setting id="replaceSMB" type="bool" label="39034" default="true" visible="eq(-1,1)"/> <!-- replace all Plex paths with SMB paths -->
|
||||||
<setting id="enableMusic" type="bool" label="30509" default="true" />
|
<setting id="enableMusic" type="bool" label="30509" default="true" />
|
||||||
<setting id="enableBackgroundSync" type="bool" label="39026" default="true" visible="true"/>
|
<setting id="enableBackgroundSync" type="bool" label="39026" default="true" visible="true"/>
|
||||||
<setting id="streamMusic" type="bool" label="30510" default="false" visible="false" subsetting="true"/> <!-- Direct stream Music library -->
|
<setting id="streamMusic" type="bool" label="30510" default="false" visible="false" subsetting="true"/> <!-- Direct stream Music library -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue