MySQL/Setting up Kodi: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
Line 30: Line 30:


===Library export (single file)===
===Library export (single file)===
{{notice|This might not work like it did in XBMC v11 Eden. In XBMC v12, it seems importing from the "single" option will mess up the stored URL for images. It's recommended to use the multiple file export option instead}}
{{notice|This might not work like it did in XBMC v11 Eden. In XBMC v12, it seems importing from the "single" option will mess up the stored URL for images. It's recommended to use the multiple file export option instead


{{hidden|Show anyway?|2=
{{hidden|Show anyway?|2=
Line 56: Line 56:
#Import the library from the XML file you edited: {{highlight|bordered=yes|[[Settings/Videos#Library|Settings -> Videos -> Library -> Import library]]}}  
#Import the library from the XML file you edited: {{highlight|bordered=yes|[[Settings/Videos#Library|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.''
#:''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===
===Update Paths In MySQL===

Revision as of 11:24, 6 February 2013

HOW-TO:Sync multiple libraries/Contents

Each device that will be sharing a library will need an advancedsetting.xml file.


Make files accessible over the network

If you haven't already done so, you will need to make your media files accessible to all your XBMC devices by sharing them on the network through file sharing. XBMC itself or the MySQL server will not share the actual files for this set up. Most operating systems have built-in methods for sharing files, or a NAS device can be used.


Most of XBMC's file sharing protocols will work except for UPnP, which does not work with the Library feature.


See Category:File Sharing for some of the file sharing methods that work with XBMC.

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.


You can also start a fresh library once MySQL is set up.

Library export (multiple files)

Using the Export function for multiple/individual files will place metadata "nfo" files next to your video files. Delete the original local source and add a new source using a network path, and XBMC will import the identical data back into the library. This method will keep your watched status, and has the added bonus of acting as a backup for all your media files in case your library database ever has an issue (hard drive failure, corruption, etc). Too keep your watched status add this to your advancedsettings.xml file:

<advancedsettings>
     <videolibrary>
          <importwatchedstate>true</importwatchedstate>
     </videolibrary>
</advancedsettings>

Library export (single file)

Emblem-important-yellow.png NOTICE:
This might not work like it did in XBMC v11 Eden. In XBMC v12, it seems importing from the "single" option will mess up the stored URL for images. It's recommended to use the multiple file export option instead

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.