Custom smb path substitutions for direct paths
This commit is contained in:
parent
d14e9b1d05
commit
32ddb6cb78
7 changed files with 107 additions and 30 deletions
|
@ -57,7 +57,8 @@ Currently these features are working:
|
|||
|
||||
**Known Issues:**
|
||||
- **Plex Music:** You must have a static IP address for your Plex media server if you plan to use Plex Music features. This is due to the way Kodi works and cannot be helped.
|
||||
-**Plex updates:** PlexKodiConnect continuously polls the Plex Media Server for changes. If something on the PMS has changed, this change is synced to Kodi. Hence if you rescan your entire library, a long PlexKodiConnect re-sync is triggered.
|
||||
- **Plex updates:** PlexKodiConnect continuously polls the Plex Media Server for changes. If something on the PMS has changed, this change is synced to Kodi. Hence if you rescan your entire library, a long PlexKodiConnect re-sync is triggered.
|
||||
- **Direct Paths:** If you use direct paths, your sync will be slower
|
||||
|
||||
**What could be in the pipeline?**
|
||||
- Watch Later
|
||||
|
|
|
@ -375,9 +375,18 @@
|
|||
<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</string>
|
||||
<string id="39033">Transform Plex UNC library paths \\myNas\mymovie.mkv automatically to smb paths, smb://myNas/mymovie.mkv? (recommended)</string>
|
||||
<string id="39034">Replace Plex UNC paths \\myNas with smb://myNas</string>
|
||||
|
||||
<string id="39035">Replace Plex paths /volume1/media or \\myserver\media with custom SMB paths smb://NAS/mystuff</string>
|
||||
<string id="39037">Original Plex MOVIE path to replace:</string>
|
||||
<string id="39038">Replace Plex MOVIE with:</string>
|
||||
<string id="39039">Original Plex TV SHOWS path to replace:</string>
|
||||
<string id="39040">Replace Plex TV SHOWS with:</string>
|
||||
<string id="39041">Original Plex MUSIC path to replace:</string>
|
||||
<string id="39042">Replace Plex MUSIC with:</string>
|
||||
<string id="39043">Go a step further and complete replace all original Plex library paths (/volume1/media) with custom SMB paths (smb://NAS/MyStuff)?</string>
|
||||
<string id="39044">Please enter your custom smb paths in the settings under "Sync Options" and then restart Kodi</string>
|
||||
|
||||
<!-- Plex Entrypoint.py -->
|
||||
<string id="39200">Switch Plex Home User</string>
|
||||
|
|
|
@ -311,8 +311,18 @@
|
|||
<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</string>
|
||||
<string id="39033">Sollen alle Plex UNC Pfade \\meinNAS\meinFilm.mkv automatisch durch SMB Pfade smb://meinNAS/meinFilm.mkv ersetzt werden? (empfohlen)</string>
|
||||
<string id="39034">Plex UNC Pfade \\meinNAS durch smb://meinNAS ersetzen</string>
|
||||
|
||||
<string id="39035">Benutzerdefinierte smb Pfade für z.B. /volume1/media erstellen</string>
|
||||
<string id="39037">Ursprünglicher Plex Pfad für FILME:</string>
|
||||
<string id="39038">Plex FILM Pfade ersetzen durch:</string>
|
||||
<string id="39039">Ursprünglicher Plex Pfad für TV SERIEN:</string>
|
||||
<string id="39040">Plex TV SERIEN Pfade ersetzen durch:</string>
|
||||
<string id="39041">Ursprünglicher Plex Pfad für MUSIK:</string>
|
||||
<string id="39042">Plex MUSIK Pfade ersetzen durch:</string>
|
||||
<string id="39043">Sollen sogar sämtliche Plex Pfade wie /volume1/Hans/medien durch benutzerdefinierte smb Pfade wie smb://NAS/Filme ersetzt werden?</string>
|
||||
<string id="39044">Bitte geben Sie Ihre benutzerdefinierten SMB Pfade nun in den Einstellungen unter Sync Optionen ein. Starten Sie dann Kodi neu.</string>
|
||||
|
||||
<!-- Plex Entrypoint.py -->
|
||||
<string id="39200">Plex Home Benutzer wechseln</string>
|
||||
|
|
|
@ -234,6 +234,7 @@ class InitialSetup():
|
|||
if forcePlexTV:
|
||||
return
|
||||
|
||||
goToSettings = False
|
||||
# Direct paths (\\NAS\mymovie.mkv) or addon (http)?
|
||||
if dialog.yesno(heading=self.addonName,
|
||||
line1=string(39027),
|
||||
|
@ -247,6 +248,21 @@ class InitialSetup():
|
|||
if dialog.yesno(heading=self.addonName,
|
||||
line1=string(39033)):
|
||||
self.logMsg("User chose to replace paths with smb", 1)
|
||||
else:
|
||||
utils.settings('replaceSMB', value="false")
|
||||
|
||||
# complete replace all original Plex library paths with custom SMB
|
||||
if dialog.yesno(heading=self.addonName,
|
||||
line1=string(39043)):
|
||||
self.logMsg("User chose custom smb paths", 1)
|
||||
utils.settings('remapSMB', value="true")
|
||||
# Please enter your custom smb paths in the settings under
|
||||
# "Sync Options" and then restart Kodi
|
||||
dialog.ok(heading=self.addonName,
|
||||
line1=string(39044))
|
||||
goToSettings = True
|
||||
# Don't start anything because we need these paths first!
|
||||
utils.window('emby_serverStatus', value="Stop")
|
||||
|
||||
# Go to network credentials?
|
||||
if dialog.yesno(heading=self.addonName,
|
||||
|
@ -260,8 +276,12 @@ class InitialSetup():
|
|||
self.logMsg("User opted to disable Plex music library.", 1)
|
||||
utils.settings('enableMusic', value="false")
|
||||
|
||||
# Open Settings page now?
|
||||
if dialog.yesno(heading=self.addonName,
|
||||
line1=string(39017)):
|
||||
if goToSettings:
|
||||
xbmc.executebuiltin(
|
||||
'Addon.OpenSettings(plugin.video.plexkodiconnect)')
|
||||
else:
|
||||
# Open Settings page now?
|
||||
if dialog.yesno(heading=self.addonName,
|
||||
line1=string(39017)):
|
||||
xbmc.executebuiltin(
|
||||
'Addon.OpenSettings(plugin.video.plexkodiconnect)')
|
||||
|
|
|
@ -41,6 +41,8 @@ class Items(object):
|
|||
else False
|
||||
self.replaceSMB = True if utils.window('replaceSMB') == 'true' \
|
||||
else False
|
||||
self.remapSMB = True if utils.window('remapSMB') == 'true' \
|
||||
else False
|
||||
# self.music_enabled = utils.settings('enableMusic') == "true"
|
||||
# self.contentmsg = utils.settings('newContent') == "true"
|
||||
|
||||
|
@ -88,6 +90,28 @@ class Items(object):
|
|||
line2=string(39032))
|
||||
return resp
|
||||
|
||||
def validatePlayurl(self, playurl, typus):
|
||||
"""
|
||||
If False is returned, itemtypes should return with False (stop sync)
|
||||
|
||||
typus: 'movie', 'tv', 'music'
|
||||
"""
|
||||
if self.remapSMB:
|
||||
playurl = playurl.replace(utils.window('remapSMB%sOrg' % typus),
|
||||
utils.window('remapSMB%sNew' % typus))
|
||||
# There might be backslashes left over:
|
||||
playurl = playurl.replace('\\', '/')
|
||||
elif self.replaceSMB:
|
||||
if playurl.startswith('\\\\'):
|
||||
playurl = 'smb:' + playurl.replace('\\', '/')
|
||||
if (utils.window('emby_pathverified') != "true" and
|
||||
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||
# Validate the path is correct with user intervention
|
||||
if self.askToValidate(playurl):
|
||||
utils.window('emby_shouldStop', value="true")
|
||||
playurl = False
|
||||
return playurl
|
||||
|
||||
def itemsbyId(self, items, process, pdialog=None):
|
||||
# Process items by itemid. Process can be added, update, userdata, remove
|
||||
emby = self.emby
|
||||
|
@ -423,16 +447,9 @@ class Movies(Items):
|
|||
# Something went wrong, trying to use non-direct paths
|
||||
doIndirect = True
|
||||
else:
|
||||
if self.replaceSMB:
|
||||
if playurl.startswith('\\\\'):
|
||||
playurl = playurl.replace('\\', '/')
|
||||
playurl = 'smb:' + playurl
|
||||
if (utils.window('emby_pathverified') != "true" and
|
||||
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||
# Validate the path is correct with user intervention
|
||||
if self.askToValidate(playurl):
|
||||
utils.window('emby_shouldStop', value="true")
|
||||
return False
|
||||
playurl = self.validatePlayurl(playurl, 'movie')
|
||||
if playurl is False:
|
||||
return False
|
||||
if "\\" in playurl:
|
||||
# Local path
|
||||
filename = playurl.rsplit("\\", 1)[1]
|
||||
|
@ -1037,10 +1054,9 @@ class TVShows(Items):
|
|||
# Something went wrong, trying to use non-direct paths
|
||||
doIndirect = True
|
||||
else:
|
||||
if self.replaceSMB:
|
||||
if playurl.startswith('\\\\'):
|
||||
playurl = playurl.replace('\\', '/')
|
||||
playurl = 'smb:' + playurl
|
||||
playurl = self.validatePlayurl(playurl, 'tv')
|
||||
if playurl is False:
|
||||
return False
|
||||
if "\\" in playurl:
|
||||
# Local path
|
||||
path = "%s\\" % playurl
|
||||
|
@ -1341,10 +1357,9 @@ class TVShows(Items):
|
|||
# Something went wrong, trying to use non-direct paths
|
||||
doIndirect = True
|
||||
else:
|
||||
if self.replaceSMB:
|
||||
if playurl.startswith('\\\\'):
|
||||
playurl = playurl.replace('\\', '/')
|
||||
playurl = 'smb:' + playurl
|
||||
playurl = self.validatePlayurl(playurl, 'tv')
|
||||
if playurl is False:
|
||||
return False
|
||||
if (utils.window('emby_pathverified') != "true" and
|
||||
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||
# Validate the path is correct with user intervention
|
||||
|
@ -2100,9 +2115,9 @@ class Music(Items):
|
|||
# Something went wrong, trying to use non-direct paths
|
||||
doIndirect = True
|
||||
else:
|
||||
if self.replaceSMB:
|
||||
playurl = playurl.replace('\\', '/')
|
||||
playurl = 'smb:' + playurl
|
||||
playurl = self.validatePlayurl(playurl, 'music')
|
||||
if playurl is False:
|
||||
return False
|
||||
if (utils.window('emby_pathverified') != "true" and
|
||||
not xbmcvfs.exists(playurl.encode('utf-8'))):
|
||||
# Validate the path is correct with user intervention
|
||||
|
|
|
@ -203,11 +203,25 @@ class UserClient(threading.Thread):
|
|||
window('plex_machineIdentifier', value=self.machineIdentifier)
|
||||
window('plex_servername', value=self.servername)
|
||||
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')
|
||||
window('remapSMB', value='true'
|
||||
if utils.settings('remapSMB') == "true" else 'false')
|
||||
if window('remapSMB') == 'true':
|
||||
items = ('movie', 'tv', 'music')
|
||||
for item in items:
|
||||
# Normalize! Get rid of potential (back)slashes at the end
|
||||
org = settings('remapSMB%sOrg' % item)
|
||||
new = settings('remapSMB%sNew' % item)
|
||||
if org.endswith('\\') or org.endswith('/'):
|
||||
org = org[:-1]
|
||||
if new.endswith('\\') or new.endswith('/'):
|
||||
new = new[:-1]
|
||||
window('remapSMB%sOrg' % item, value=org)
|
||||
window('remapSMB%sNew' % item, value=new)
|
||||
|
||||
# Set DownloadUtils values
|
||||
doUtils.setUsername(username)
|
||||
|
|
|
@ -61,6 +61,14 @@
|
|||
<setting id="enableMusic" type="bool" label="30509" default="true" />
|
||||
<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="remapSMB" type="bool" label="39035" default="false" visible="eq(-2,1)"/> <!-- replace Plex paths /volume1/media or \\myserver\media with a custom SMB path smb://NAS/mystuff -->
|
||||
<setting id="remapSMBmovieOrg" type="text" label="39037" default="" visible="eq(-1,true)"/> <!-- Original Plex MOVIE path to replace -->
|
||||
<setting id="remapSMBmovieNew" type="text" label="39038" default="smb://" visible="eq(-2,true)"/> <!-- Replace Plex MOVIE with: -->
|
||||
<setting id="remapSMBtvOrg" type="text" label="39039" default="" visible="eq(-3,true)"/> <!-- Original Plex TV SHOWS path to replace: -->
|
||||
<setting id="remapSMBtvNew" type="text" label="39040" default="smb://" visible="eq(-4,true)"/> <!-- Replace Plex TV SHOWS with: -->
|
||||
<setting id="remapSMBmusicOrg" type="text" label="39041" default="" visible="eq(-5,true)"/> <!-- Original Plex MUSIC path to replace: -->
|
||||
<setting id="remapSMBmusicNew" type="text" label="39042" default="smb://" visible="eq(-6,true)"/> <!-- Replace Plex MUSIC with: -->
|
||||
|
||||
<setting id="streamMusic" type="bool" label="30510" default="false" visible="false" subsetting="true"/> <!-- Direct stream Music library -->
|
||||
<setting type="lsep" label="30523" visible="false"/> <!-- Music metadata options -->
|
||||
<setting id="enableImportSongRating" type="bool" label="30524" default="true" visible="false"/>
|
||||
|
|
Loading…
Reference in a new issue