MySQL/Setting up Kodi: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(→‎Name tag: updated with warning and minor editing of language)
m (Bot: Automated text replacement (- XBMC + {{name}} ))
Line 6: Line 6:
{{-}}
{{-}}
==Make files accessible over the network==
==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 to the network, or a [[NAS]] device can be used.
If you haven't already done so, you will need to make your media files accessible to all your {{name}} devices by sharing them on the network through file sharing. {{name}} 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 to the network, or a [[NAS]] device can be used.




{{note|
{{note|
*If you use passwords on your network shares then you will need to copy (or [[MySQL/Sync other parts of XBMC|sync]]) your passwords.xml file from the userdata folder to each XBMC device.
*If you use passwords on your network shares then you will need to copy (or [[MySQL/Sync other parts of XBMC|sync]]) your passwords.xml file from the userdata folder to each {{name}} device.
*Do not use mapped drives on the OS-level, as XBMC will see those as local drives.
*Do not use mapped drives on the OS-level, as {{name}} will see those as local drives.
*If you use smb:// paths, you may want to use static IP addresses rather than NetBIOS names, as not all your devices may be able to resolve the later.
*If you use smb:// paths, you may want to use static IP addresses rather than NetBIOS names, as not all your devices may be able to resolve the later.
*'''Even if the media is on the same computer as one of the XBMC instances, you MUST use a network share path. You cannot use a local file path with MySQL.'''}}
*'''Even if the media is on the same computer as one of the {{name}} instances, you MUST use a network share path. You cannot use a local file path with MySQL.'''}}




Line 22: Line 22:
You only need to do the exporting steps if you are migrating an existing local library to a MySQL database.
You only need to do the exporting steps if you are migrating an existing local library to a MySQL database.


#Open XBMC on the computer that has the library you want to share
#Open {{name}} on the computer that has the library you want to share
##Export the Video Library by doing the following:
##Export the Video Library by doing the following:
###Go to '''System/Settings -> Video -> Library''' and select '''Export library'''
###Go to '''System/Settings -> Video -> Library''' and select '''Export library'''
Line 30: Line 30:
###Select '''Multiple files'''
###Select '''Multiple files'''


{{redv|'''Please Note:'''| Don't create the MySQL databases on your server, before you start your XMBC with your newly configured advancedsettings.xml. '''Let XBMC create everything for you...'''}}
{{redv|'''Please Note:'''| Don't create the MySQL databases on your server, before you start your XMBC with your newly configured advancedsettings.xml. '''Let {{name}} create everything for you...'''}}


Ensure MySQL-user has enough permissions. {{see also|MySQL/Setting up MySQL}}
Ensure MySQL-user has enough permissions. {{see also|MySQL/Setting up MySQL}}
Line 74: Line 74:
##Replace the two instances of <code>***.***.***.***</code> with local network IP address of your MySQL server. If you installed MySQL on a Windows machine, do not use its NetBIOS name, as not all devices may be able to resolve them.
##Replace the two instances of <code>***.***.***.***</code> with local network IP address of your MySQL server. If you installed MySQL on a Windows machine, do not use its NetBIOS name, as not all devices may be able to resolve them.
##Save the file as '''advancedsettings.xml'''
##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.
#Copy this ''advancedsettings.xml'' file you just created to the '''[[userdata folder]]''' of every {{name}} install you want to sync with.
{{-}}
{{-}}


==Importing==
==Importing==
# Open any of your XBMC installs and re-import your library data, ''or'' simply set up a new library if you are starting fresh.
# Open any of your {{name}} installs and re-import your library data, ''or'' simply set up a new library if you are starting fresh.
# Add (or just "set content" on) the networked video source to XBMC and scan it in as if you were setting up your library for the first time (see [[adding videos to the library]]). However, XBMC will read the exported nfo files and images and use those instead of rebuilding the library from scratch. The end result will be an identical library, and your watched status for videos will be preserved.
# Add (or just "set content" on) the networked video source to {{name}} and scan it in as if you were setting up your library for the first time (see [[adding videos to the library]]). However, {{name}} will read the exported nfo files and images and use those instead of rebuilding the library from scratch. The end result will be an identical library, and your watched status for videos will be preserved.
#:{{Note|You must add a network source using XBMC's standard formatting. For example, use "smb://192.168.1.20/Videos/" and not "\\BOBPC\Videos\".  Try to use static IP addresses over NetBIOS names if using SMB.}}
#:{{Note|You must add a network source using XBMC's standard formatting. For example, use "smb://192.168.1.20/Videos/" and not "\\BOBPC\Videos\".  Try to use static IP addresses over NetBIOS names if using SMB.}}
# Import the Music Library by doing the following: Same idea as videos, but using the steps for [[adding music to the library]]. You'll end up with an identical library.
# Import the Music Library by doing the following: Same idea as videos, but using the steps for [[adding music to the library]]. You'll end up with an identical library.
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.
You can now add files and update the library from any of your {{name}} devices and the library for all of them will stay in sync.


==Name tag==
==Name tag==
Line 88: Line 88:
An additional <code><name></code> tag can be used for both the <code><videodatabase></code> and <code><musicdatabase></code> entries in advancedsettings.xml file, if you want to change the name of the database.
An additional <code><name></code> tag can be used for both the <code><videodatabase></code> and <code><musicdatabase></code> entries in advancedsettings.xml file, if you want to change the name of the database.


The <code><name></code> tag is not required and it is recommended to not include it, as some users have reported problems/bugs when it was included. XBMC will use "MyVideos" and "MyMusic" as database names if the <code><name></code> tag is not specified.  
The <code><name></code> tag is not required and it is recommended to not include it, as some users have reported problems/bugs when it was included. {{name}} will use "MyVideos" and "MyMusic" as database names if the <code><name></code> tag is not specified.  
One case where you might want to use the name tag regardless of this warning, is if you want to have multiple separate libraries (with different content) on the same MySQL server. 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.
One case where you might want to use the name tag regardless of this warning, is if you want to have multiple separate libraries (with different content) on the same MySQL server. For example, if you want to create multiple profiles, each with their own shared library, so that each {{name}} device can "log-into" that library.


N.B.! Don't try to merge the video and music databases! You need to use different values in the <code><name></code> tag or you'll end up confusing XBMC leading to the library functionality not working at all.
N.B.! Don't try to merge the video and music databases! You need to use different values in the <code><name></code> tag or you'll end up confusing {{name}} leading to the library functionality not working at all.


{{Frodo updated}}
{{Frodo updated}}

Revision as of 01:12, 5 June 2014

Share libraries w/MySQL, guide:

  1. Introduction
  2. Setting up MySQL
  3. Setting up Kodi
Home icon grey.png   ▶ MySQL ▶ Setting up Kodi

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 to the network, or a NAS device can be used.


Note:

  • If you use passwords on your network shares then you will need to copy (or sync) your passwords.xml file from the userdata folder to each XBMC device.
  • Do not use mapped drives on the OS-level, as XBMC will see those as local drives.
  • If you use smb:// paths, you may want to use static IP addresses rather than NetBIOS names, as not all your devices may be able to resolve the later.
  • Even if the media is on the same computer as one of the XBMC instances, you MUST use a network share path. You cannot use a local file path with MySQL.


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

Exporting

You only need to do the exporting steps if you are migrating an existing local library to a MySQL database.

  1. Open XBMC on the computer that has the library you want to share
    1. Export the Video Library by doing the following:
      1. Go to System/Settings -> Video -> Library and select Export library
      2. Select Multiple files
    2. Export the Music Library by doing the following:
      1. Go to System/Settings -> Music -> Library and select Export library
      2. Select Multiple files
Please Note: Don't create the MySQL databases on your server, before you start your XMBC with your newly configured advancedsettings.xml. Let XBMC create everything for you...


Ensure MySQL-user has enough permissions.

Else it results in an error like:

ERROR: SQL: The table does not exist
Query: SELECT idVersion FROM version

MySQL and advancedsettings.xml

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>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

See also this note about using the <name> tag: #Name tag
<importwatchedstate> is only needed when you're importing a previous library from exported files.

  1. 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. If you installed MySQL on a Windows machine, do not use its NetBIOS name, as not all devices may be able to resolve them.
    4. Save the file as advancedsettings.xml
  2. Copy this advancedsettings.xml file you just created to the userdata folder of every XBMC install you want to sync with.


Importing

  1. Open any of your XBMC installs and re-import your library data, or simply set up a new library if you are starting fresh.
  2. Add (or just "set content" on) the networked video source to XBMC and scan it in as if you were setting up your library for the first time (see adding videos to the library). However, XBMC will read the exported nfo files and images and use those instead of rebuilding the library from scratch. The end result will be an identical library, and your watched status for videos will be preserved.
    Note: You must add a network source using XBMC's standard formatting. For example, use "smb://192.168.1.20/Videos/" and not "\\BOBPC\Videos\". Try to use static IP addresses over NetBIOS names if using SMB.
  3. Import the Music Library by doing the following: Same idea as videos, but using the steps for adding music to the library. You'll end up with an identical library.

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.

Name tag

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

The <name> tag is not required and it is recommended to not include it, as some users have reported problems/bugs when it was included. XBMC will use "MyVideos" and "MyMusic" as database names if the <name> tag is not specified. One case where you might want to use the name tag regardless of this warning, is if you want to have multiple separate libraries (with different content) on the same MySQL server. 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.

N.B.! Don't try to merge the video and music databases! You need to use different values in the <name> tag or you'll end up confusing XBMC leading to the library functionality not working at all.