MySQL/Setting up Kodi: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
(→‎Path substitution: too many issues with this. Totally removing it.)
Line 33: Line 33:
===Update Paths In MySQL===
===Update Paths In MySQL===
{{see|HOW-TO:Sync multiple libraries/Update Paths In MySQL}}
{{see|HOW-TO:Sync multiple libraries/Update Paths In MySQL}}
===Path substitution===
{{hidden|Really not recommended, but sometimes works|2=
{{{!}} class="infobox"
{{!}} advancedsettings.xml:
{{!}}-
{{!}}
<pre>
<advancedsettings>
<pathsubstitution>
  <substitute>
    <from>C:\OLD\file\path\movies\</from>
    <to>SMB://NEW/file/path/movies/</to>
  </substitute>
</pathsubstitution>
</advancedsettings>
</pre>
{{!}}}
[[Path substitution]] is another easy method to get your library to work with network paths. However, it is recommended that you use the [[#Library export]] option above, as that will uncomplicate your setup and make future additions to your library easier to manage. There are also some user reports of path subbing file not correctly working and causing duplicate entires in the library.
#Create (or add to, if you already have one) an advancedsettings.xml file:
##Open up a plain text editor
##Copy and paste the text from the right-hand box into a new text document
##Replace the <from> and <to> portions with the correct information
##Repeat the <substitute>...</substitute> portion for each local file source. Network source do not need to be converted.
##Save the file as '''advancedsettings.xml'''
#Copy this ''advancedsettings.xml'' file you just created to the userdata folder of every XBMC install you want to sync with:
#* '''Windows XP:''' <code>Documents and Settings\<your_user_name>\Application Data\XBMC\userdata\advancedsettings.xml</code>
#* '''Vista/Windows 7:''' <code>Users\<your_user_name>\AppData\Roaming\XBMC\userdata\advancedsettings.xml</code>
#* '''Mac OS X:''' <code>/Users/<your_user_name>/Library/Application Support/XBMC/userdata/advancedsettings.xml</code>
#* '''iOS:''' <code>/private/var/mobile/Library/Preferences/XBMC/userdata/advancedsettings.xml</code>
#* '''Linux:''' <code>$HOME/.xbmc/userdata/advancedsettings.xml</code>
}}


==MySQL advancedsettings==
==MySQL advancedsettings==

Revision as of 04:47, 11 November 2012

HOW-TO:Sync multiple libraries/Contents Each device that will be sharing a library will need an advancedsetting.xml file.


Existing libraries that use local file paths

If you wish to use your existing library in a MySQL set up, but originally used local file sources in that library, then you will have to do an extra step to make MySQL library sharing work. Changing the sources within XBMC will not be enough. When you import the library (at a later step) when it has a local path, each XBMC device thinks the file is located at say "G:\MOVIES" even though that is only true for one machine.

Library export

Example:
First, find all: E:\Media\

Replace with: SMB://serverIP/Media/

Second, find all[1]: \

Replace with: /

  1. *only needed if using Windows file paths

Using a standard text editor and the Export/import function of XBMC, you can easily update your library to use network paths:

  1. Export the library as a single file: Settings -> Videos -> Library -> Export library
  2. Open up the XML file in the folder it produces with a text editor.
  3. Use a find/replace tool in the text editor to replace the old file path (the local one) with the new network path (see example to the right).
    • Windows users: You might even want to do an additional find/replace on "\" to "/". "\" is only used in local windows file paths, so there's no risk of it breaking a tag or something else in the XML file.
  4. Save the XML file in your text editor.
  5. Remove your old sources and remove them from the library.
  6. Confirm your library is empty.
  7. Import the library from the XML file you edited: Settings -> Videos -> Library -> Import library
    You can also skip the import step here and just jump to the #MySQL advancedsettings section, skipping step 1 since you've already exported the library. Then just import when it says to in that section using the export you made from this section.

Update Paths In MySQL

See: HOW-TO:Sync multiple libraries/Update Paths In MySQL

MySQL advancedsettings

advancedsettings.xml:
<advancedsettings>
    <videodatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </videodatabase> 

    <musicdatabase>
        <type>mysql</type>
        <host>***.***.***.***</host>
        <port>3306</port>
        <user>xbmc</user>
        <pass>xbmc</pass>
    </musicdatabase>
</advancedsettings>

See also this note about using the <name> tag: #Name tag

  1. Open XBMC on the computer that has the library you want to share (If you have not created a library yet you can skip this step)
    1. Export the Video Library by doing the following:
      1. Go to System/Settings -> Video -> Library and select Export library
      2. Select Single file
    2. Export the Music Library by doing the following:
      1. Go to System/Settings -> Music -> Library and select Export library
      2. Select Single file
  2. Create (or add to, if you already have one) an advancedsettings.xml file:
    1. Open up a plain text editor
    2. Copy and paste the text from the right-hand box into a new text document
    3. Replace the two instances of ***.***.***.*** with local network IP address of your MySQL server
    4. Save the file as advancedsettings.xml
  3. Copy this advancedsettings.xml file you just created to the userdata folder of every XBMC install you want to sync with:
    • Windows XP: Documents and Settings\<your_user_name>\Application Data\XBMC\userdata\advancedsettings.xml
    • Vista/Windows 7: Users\<your_user_name>\AppData\Roaming\XBMC\userdata\advancedsettings.xml
    • Mac OS X: /Users/<your_user_name>/Library/Application Support/XBMC/userdata/advancedsettings.xml
    • iOS: /private/var/mobile/Library/Preferences/XBMC/userdata/advancedsettings.xml
    • Linux: $HOME/.xbmc/userdata/advancedsettings.xml
  4. Open any of your XBMC installs and re-import your library data (If you have not created a library yet you can skip this step)
    1. Import the Video Library by doing the following:
      1. Go to System/Settings -> Video -> Library and select Import library
      2. Select the file you saved from the first step when you exported your video library
    2. Import the Music Library by doing the following:
      1. Go to System/Settings -> Music -> Library and select Import library
      2. Select the file you saved from the first step when you exported your music library
  5. You can now add files and update the library from any of your XBMC devices and the library for all of them will stay in sync.


  • NOTE: If you want to update the library from any of the XBMC devices then they must all have the same sources set. See the Sources section of Part 6 for one method of keeping them in sync.
  • NOTE: If you encounter error 1062, then you'll need to change your paths from "\\" to "//" as MySQL has trouble understanding "\\"
  • NOTE: If you are using Eden, the video MySQL database will have 60 appended to the name (ex. video_database60). The music MySQL database will have 18 appended to the name (ex. music_database18).

Name tag

An additional <name> tag can be used for both the video and music entries in advancedsettings.xml if you want to change the name of the database.

The name tag is not required (XBMC will use a default "MyVideos" and "MyMusic" DB name) and it is recommended to not include it if you only need one library, as some users have reported problems/bugs when it was included.

The tag is only needed if you want to have separate databases on the same MySQL server, like for more than one shared library. For example, if you want to create multiple profiles, each with their own shared library, so that each XBMC device can "log-into" that library.

Editor note: eventually we'll have a better section for explaining the <name> tag. Until then, check out the alternative MySQL guide from howtogeek.com, which does dive into using the <name> tag for multiple databases and even profiles: How to Sync Your Media Across Your Entire House with XBMC.