Difference between revisions of "Path substitution"

From Official Kodi Wiki
Jump to: navigation, search
m (Robot: Cosmetic changes)
m (Fix note - stating it'll only work for 18.3 +)
 
(30 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{divbox|orange||<big>'''Note:''' This is considered an advanced (complicated) and experimental feature.</big><br /><br />Path substitution is not officially supported for settings files with the exception of playlists. It probably won't hurt anything, but some things might not always work right depending on what you are substituting.}}
+
{{mininav| [[advancedsettings.xml]] }}
'''Path substitutions''' are settings in [[advancedsettings.xml#<pathsubstitution>|advancedsettings.xml]] to force XBMC to use different file paths. These are processed in order, and are useful for substituting an absolute path on a PC with a path suitable for XBMC to handle. Starting in XBMC v11 (Eden) path subs works for most file paths. Path subs work across local and network paths, across different network protocols, and can even be used with the [[special protocol]] (see note below).
 
  
== Examples ==
+
<section begin="intro" />[[Path substitution]]s are settings in [[advancedsettings.xml#<pathsubstitution>|advancedsettings.xml]] to force Kodi to use different file paths. These are processed in order, and are useful for substituting an absolute path on a PC with a path suitable for Kodi to handle. Path subs work for most file and folder paths. Path subs work across local and network paths, across different network protocols, and can even be used with some of the [[special protocol]].<section end="intro" />
<pre>
+
 
 +
{{Note| This is considered an advanced (complicated) feature.}}
 +
 
 +
 
 +
== How it works ==
 +
'''<code><from></from></code>''' defines the path you wish to replace.
 +
 
 +
'''<code><to></to></code>''' defines the new path that will replace what you put in <from>.
 +
 
 +
The file path/URL can be partial, such as just the address for a server.
 +
 
 +
{{divbox|red||'''Note:''' Path substition for "sources" and profiles only works from v18.3}}
 +
 
 +
=== Example ===
 +
 
 +
 
 +
Save as "advancedsettings.xml" in your [[userdata folder]]:
 +
 
 +
;Example - changing where thumbnails are stored
 +
{{note|This will slowdown thumbnail loading, but might be worth it for low-memory devices. See also '''[[HOW-TO:Reduce disk space usage]]'''.}}
 +
<syntaxhighlight lang="XML" enclose="div">
 
<advancedsettings>
 
<advancedsettings>
 
  <pathsubstitution>
 
  <pathsubstitution>
 
   <substitute>
 
   <substitute>
     <from>SMB://192.168.1.19/Music/</from>
+
     <from>special://profile/Thumbnails/</from>
     <to>G:\Music\</to>
+
     <to>PROTOCOL://YOUR_NETWORK_SHARE/Kodi/userdata/Thumbnails/</to>
 
   </substitute>
 
   </substitute>
 
  </pathsubstitution>
 
  </pathsubstitution>
 
</advancedsettings>
 
</advancedsettings>
</pre>
+
</syntaxhighlight >
  
<pre>
+
{{divbox|yellow||'''Note:'''Not all special paths can be substituted. In particular, special://musicplaylists/ and special://videoplaylists/ should not be substituted, as internally these are multipaths that cannot be written to (thus saving of playlists will go elsewhere).}}
<advancedsettings>
+
 
<pathsubstitution>
+
== Moving the userdata folder on Android ==
  <substitute>
+
{{See|HOW-TO:Change data location for Android}}
    <from>special://masterprofile/Thumbnails/</from>
+
 
    <to>PROTOCOL://YOUR_NETWORK_SHARE/xbmc/userdata/Thumbnails/</to>
+
The userdata folder can't normally be relocated completely, except on Android. See '''[[HOW-TO:Change data location for Android]]''' for more details.
  </substitute>
+
 
</pathsubstitution>
+
== Special notes about path substitution for userdata files ==
</advancedsettings>
+
Path substitution is not officially supported for settings files. It probably won't hurt anything, but some things might not always work right depending on what you are substituting.
</pre>
+
 
 +
 
 +
;Thumbnails
 +
Sharing the Thumbnails folder with Path Substitution is prone to problems, primarily because the Texture Cache consists of two interlinked data stores - the Thumbnails folder and the SQLite database Textures13.db. Sharing the SQLite Textures13.db between multiple clients is <strong>not</strong> supported under any circumstances due to the liklehood of database corruption.
  
NOTE: Not all special paths can be substituted. In particular, special://musicplaylists/ and special://videoplaylists/ should not be substituted, as internally these are multipaths that cannot be written to (thus saving of playlists will go elsewhere). Instead, one should use the advanced setting <system><playlistpath> to change this.
+
Since sharing of the database is not realistically possible, attempts at sharing only the Thumbnails folder will either fail completely, or result in some artwork items never being displayed, or you may experience artwork being displayed but with higher or lower than expected image quality or even image corruption (a result of different clients overwriting previously cached artwork, as not all clients cache artwork at the same resolutions, or even use the same image formats).<br/><br/>
 +
If you must use Path Substitution to relocate (rather than share) your Thumbnails folder, by all means do so but only for individual clients and their associated Thumbnails folder. Do <strong>not</strong> share a single Thumbnails folder between multiple clients, as the Texture Cache is simply not designed to support this and you will experience problems.
  
'''Windows does not support smb:// paths, use UNC paths instead.''' UNC paths in Windows (\\server\share) will not allow the use of a specific XBMC username and password like smb://username:[email protected]/share would.
 
 
== See also ==
 
== See also ==
 
* [[advancedsettings.xml#<pathsubstitution>]]
 
* [[advancedsettings.xml#<pathsubstitution>]]
* [[HOW-TO:Sync multiple libraries/Sync thumbails and fanart]]
+
* [[MySQL/Sync other parts of Kodi]]
* [[HOW-TO:Sync multiple libraries/Sync other parts of XBMC]]
 
 
* [[Special protocol]]
 
* [[Special protocol]]
 +
 +
 +
{{Updated|18}}
  
 
[[Category:Settings]]
 
[[Category:Settings]]
[[Category:XBMC Manual]]
+
[[Category:Manual]]
 
[[Category:Advanced topics]]
 
[[Category:Advanced topics]]
[[Category:Advanced settings]]
 

Latest revision as of 15:10, 24 April 2019

Home icon grey.png   ▶ advancedsettings.xml ▶ Path substitution

Path substitutions are settings in advancedsettings.xml to force Kodi to use different file paths. These are processed in order, and are useful for substituting an absolute path on a PC with a path suitable for Kodi to handle. Path subs work for most file and folder paths. Path subs work across local and network paths, across different network protocols, and can even be used with some of the special protocol.

Note: This is considered an advanced (complicated) feature.


1 How it works

<from></from> defines the path you wish to replace.

<to></to> defines the new path that will replace what you put in <from>.

The file path/URL can be partial, such as just the address for a server.

1.1 Example

Save as "advancedsettings.xml" in your userdata folder:

Example - changing where thumbnails are stored

Note: This will slowdown thumbnail loading, but might be worth it for low-memory devices. See also HOW-TO:Reduce disk space usage.

<advancedsettings>
 <pathsubstitution>
  <substitute>
    <from>special://profile/Thumbnails/</from>
    <to>PROTOCOL://YOUR_NETWORK_SHARE/Kodi/userdata/Thumbnails/</to>
  </substitute>
 </pathsubstitution>
</advancedsettings>

2 Moving the userdata folder on Android

See: HOW-TO:Change data location for Android

The userdata folder can't normally be relocated completely, except on Android. See HOW-TO:Change data location for Android for more details.

3 Special notes about path substitution for userdata files

Path substitution is not officially supported for settings files. It probably won't hurt anything, but some things might not always work right depending on what you are substituting.


Thumbnails

Sharing the Thumbnails folder with Path Substitution is prone to problems, primarily because the Texture Cache consists of two interlinked data stores - the Thumbnails folder and the SQLite database Textures13.db. Sharing the SQLite Textures13.db between multiple clients is not supported under any circumstances due to the liklehood of database corruption.

Since sharing of the database is not realistically possible, attempts at sharing only the Thumbnails folder will either fail completely, or result in some artwork items never being displayed, or you may experience artwork being displayed but with higher or lower than expected image quality or even image corruption (a result of different clients overwriting previously cached artwork, as not all clients cache artwork at the same resolutions, or even use the same image formats).

If you must use Path Substitution to relocate (rather than share) your Thumbnails folder, by all means do so but only for individual clients and their associated Thumbnails folder. Do not share a single Thumbnails folder between multiple clients, as the Texture Cache is simply not designed to support this and you will experience problems.

4 See also