Problem with OSM raspberry as a server with usb drive

Hello, I have 3 raspberry mounted at home, one of them and the server where the hard drives are connected to the movies and series, the other two are in the rooms, the 3 has OSMC mounted and operated.
It is enabled that the server share the database for the other two, but the problem is that being hard drives connected to one of them, when playing on any of the other two raspberry tells me that the files are not already available, I have looked in the database and indeed the path of the files is
/ media / New vol / Big Trouble in Little China /
For example.
There would be some solution for this.

Thank yo

If you share files from different devices and you use a shared database at the same time you should generally only do the library updates and additions on one system and have to use one of this three options:

  1. Access the files on all devices via shares even on the system where the disk is connected to
  2. Use Kernel based mounts and mount the shares to the same folder on the other systems where the disk shows up on the orignal system
  3. Use path substitution https://kodi.wiki/view/Path_substitution
1 Like

Ok, can I change the route, using option 3 that you told me?
For example, I am testing with a chapter of the supernatural series.
Now the advancedsettings is this:

<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>***</user>
    <pass>***</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>***</user>
    <pass>***</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
</advancedsettings>

and to modify it would be like this ?, sorry for the syntax but I don’t understand much how to write the route well:

<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>***</user>
    <pass>***</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>***</user>
    <pass>***</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
<pathsubstitution> 
  <substitute> 
    <from> /media/usb </from> 
    <to> smb: // osmc / usb / </to> 
  </substitute> 
</pathsubstitution>
</advancedsettings>

right now I use a pendrive called ‘usb’ for testing

I fixed the formatting for you.

The to line has extra spaces, it should like like:

<to>smb://osmc/usb/</to>

And I doubt that osmc is the correct name, try using the servers IP address instead.

i change for thisand not work:

  <advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </videodatabase> 
  <musicdatabase>
    <type>mysql</type>
    <host>192.168.1.170</host>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
<pathsubstitution> 
  <substitute> 
    <from> /media/usb </from> 
    <to> smb://192.168.1.170/osmc/usb/ </to> 
  </substitute> 
</pathsubstitution>
</advancedsettings>

When you scan the file in the library it stores the location in the database as an absolute path (/media/New vol/Big Trouble in Little China/) and when you are on a different machine it looks for the same location. If the other machine doesn’t have the file at that exact same location then it does not work.

Option 1 was to use something like smb://192.168.1.170/New vol/ as your data source so both the server and the other machines could access everything from the same path. This is the route that I personally prefer.

Option 2 is to make a system mount so the other machines have a /media/New vol/ folder that points to the same place that it does on the server.

With path substitution you are telling kodi that when it wants to go to path a, substitute that for path b. As such if you are using /media/New vol/ on the server but to access that folder from the another machine you have to go to smb://192.168.1.170/New vol/ then…

<pathsubstitution> 
  <substitute> 
    <from>/media/New vol/</from> 
    <to>smb://192.168.1.170/New vol/</to> 
  </substitute> 
</pathsubstitution>

I don’t think that is where you shared that folder. My guess is that you actually have that at smb://192.168.1.170/usb/. Without a log we can’t tell you where you put it though.

But the patchsustitution option works with the data base?, Because having a single database shared in the osmc server if it doesn’t work like this will work with the patchsustitution option, right?

All three options work with a shared MySQL database.

Path substitution is fairly straightforward once you understand exactly what you are doing. On the server you scanned with you pointed to a local mount (/media/New vol/) so that is what is stored in the database. That does not exist on the clients so they need a path substitution to point them to where they can actually find the files. In your case the local mount /media/New vol/ is the same folder as what you access over the network as smb://192.168.1.170/New vol/ so on the two client machines you add the substitution to fix the file path.

When you substitute the above “/media/New vol/Big Trouble in Little China/BTiLC.mkv” becomes “smb://192.168.1.170/New vol/Big Trouble in Little China/BTiLC.mkv” when the client tries to access it. It does not change anything server side.

HI!!!
didnt work, paste the log , no change , the usb unit call ‘usb’ and is mounted on server osmc, and share correct, but osmc client only see it but cant play it.

log

First, I don’t know if it will really make a difference, but you still have extra spaces in the substitution.

Second: The log you posted does not have an attempt to play a movie.

Hi!!!, erased the white space, still not work, i paste the called to file.

2019-10-17 18:25:29.651 T:1916057136 DEBUG: ------ Window Deinit (DialogConfirm.xml) ------
2019-10-17 18:25:31.029 T:1895822048 DEBUG: CLibInputKeyboard::ProcessKey - using delay: 500ms repeat: 50ms
2019-10-17 18:25:31.029 T:1564459744 DEBUG: Thread Timer start, auto delete: false
2019-10-17 18:25:31.044 T:1916057136 DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x000d, modifier: 0x0
2019-10-17 18:25:31.093 T:1564459744 DEBUG: Thread Timer 1564459744 terminating
2019-10-17 18:25:31.095 T:1916057136 DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x000d, modifier: 0x0
2019-10-17 18:25:31.095 T:1916057136 DEBUG: HandleKey: return (0xf00d) pressed, action is Select
2019-10-17 18:25:31.713 T:1916057136 DEBUG: OnClick called on ‘videodb://tvshows/titles/4/-2/5?season=-2&tvshowid=4’ but file doesn’t exist

You seem to still not get what your trying to do. Your file path you are using on the server…

OnClick called on ‘videodb://tvshows/titles/4/-2/5?season=-2&tvshowid=4’ but file doesn’t exist

…is not what you said it was. Obviously you scanned in the above using //tvshows as a source (or really confused things by using a path sub on the server) so you would have to path substitute for that. You also did not provide full logs so we cannot see what you currently have setup. In addition to that what you have already scanned in does not change when you change sources so you will likely get tripped up trying to change things around. At this point I would recommend removing everything from your database and start over with option one.

If all you need is file storage and sharing wouldn’t something like https://www.openmediavault.org/ be easier solution ?

This is an easy solution as long as you point everything to the same file path.

Yes, I know, but I want the OSMC server to be portable, to put everything in a box, hard drive and rasp. and be able to take it out when we go on vacation or out.

yes, I understand, it is not programmed, I thought that at some point in reading the advacesetting the osmc client would know that the address that is in the database, I would change it to smb: // "resource shared by server OSMC "but I understand that this cannot be done.
I don’t know if this is very complicated, impossible or fantasy hahaha, I’m an electrical engineer. My knowledge about Linux is very limited.
I’m sorry
Thank you

Your probably just overthinking it. It works on Linux the same way it works on any other operating system. The database stores the link as an absolute file path. If this was Windows that would be something like storing a path as “c:\users\username\videos” as opposed to “%homepath%\videos”. When you scrape a file into the library it has this very specific location that is storing. This information does not change when you do subsequent library updates. If you bring up an information window on a video and highlight over “refresh” it will show you exactly what file path is stored for the file (as least it does in the Estuary skin). All your trying to do is get the clients to point to the same files so you were looking to exchange the part of the file path that is wrong with something that works. The path sub is literally just exchanging some piece of text for something else. If my file path was /a/b/c/d/test.mkv and path subbed ‘b’ to ‘dada’ then when it went to access that file it would look in /a/dada/c/d/test.mkv.

If your having problems understanding what the file paths over the network are you can view them in Windows if that is easier. If you have the samba server installed on the Pi you can bring up Windows Explorer and type in \\192.168.1.170 and hit enter and you should see your share pretty much the same as another Pi would. The only difference is that “\\” in Windows is “smb://” in Linux and the backslash (\) that separates folders in Windows is a forward slash (/) in Linux.