Jump to content


Photo

Add Directory To Library From Afar

linux library headless ssh

Best Answer mastrmind11 , 13 November 2019 - 11:33 AM

So symlink each of the folders on the USB drive to the existing emby library and fire up a library scan via the api (or wait for the next scheduled scan).  You have to create a symlink for each movie folder independently, you can't just symlink the top level usb folder because emby wont traverse it.

Go to the full post


  • Please log in to reply
29 replies to this topic

#1 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 10 November 2019 - 09:18 PM

Hello!  I manage a linux media server for my sister.  She lives in a remote location and only has broadband internet.  I built a linux server with emby on it with the intention of giving her an external USB drive from time to time with new content.  I can only access this machine via SSH, but within the local network, Emby is working like a champ.  My question is, how can I add the external USB to the Emby library via ssh?  I tried to symlink the content into the existing library directory, but it doesn't appear to be working.  The local hard drive is about 1TB and already full of content and the external hard drive is about 5 TB.  I have it mounted in the same root directory as the current content.  Any tips would be great!  Thanks!


Edited by cmart2112, 10 November 2019 - 09:22 PM.


#2 mastrmind11 OFFLINE  

mastrmind11

    Advanced Member

  • Members
  • 2833 posts
  • Local time: 12:51 AM
  • LocationLong Island, NY

Posted 11 November 2019 - 08:53 AM

Hello!  I manage a linux media server for my sister.  She lives in a remote location and only has broadband internet.  I built a linux server with emby on it with the intention of giving her an external USB drive from time to time with new content.  I can only access this machine via SSH, but within the local network, Emby is working like a champ.  My question is, how can I add the external USB to the Emby library via ssh?  I tried to symlink the content into the existing library directory, but it doesn't appear to be working.  The local hard drive is about 1TB and already full of content and the external hard drive is about 5 TB.  I have it mounted in the same root directory as the current content.  Any tips would be great!  Thanks!

Emby needs at least read access to the mount.  



#3 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 08:55 AM

.


Edited by cmart2112, 11 November 2019 - 09:00 AM.


#4 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 08:59 AM

Emby needs at least read access to the mount.  

 

Yes.  I think I have it wide open right now for testing (777)



#5 mastrmind11 OFFLINE  

mastrmind11

    Advanced Member

  • Members
  • 2833 posts
  • Local time: 12:51 AM
  • LocationLong Island, NY

Posted 11 November 2019 - 09:11 AM

 

Yes.  I think I have it wide open right now for testing (777)

 

oh, i see what you're saying.  you don't have the ability to select the library from with emby because you are remote w/ ssh access only.  is your sister able to add the library if you walk her through it?  if not, I'm fairly certain symlinking is supported, in which case you'd just have to send an API call via curl to refresh the library.



#6 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 09:24 AM

oh, i see what you're saying.  you don't have the ability to select the library from with emby because you are remote w/ ssh access only.  is your sister able to add the library if you walk her through it?  if not, I'm fairly certain symlinking is supported, in which case you'd just have to send an API call via curl to refresh the library.

 

might be able to walk her though it... but would rather manage the process on my end.  I created the symlinks last week and asked if she saw the new content last night (which she didn't).  I assumed the regularly scheduled library scan would have picked up the symlinked content by now.



#7 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 10:21 AM

Here's an idea worth testing. It's a deliberately sloppy way that might trick Emby into "thinking" the libary paths are always there.

 

Assuming you're using automount for the USB and have everything sorted out already.

 

Create full library paths for Emby on the filesystem, these are examples so adjust for your directory structure:

/mnt/portable/media/movies

/mnt/portable/media/series

/mnt/portable/media/<other>

 

Add the above to Emby as libraries, to suit your needs.

 

Make sure your external drive matches the above library paths from the mount point from media on down, USB has /media/...

 

Now setup the external drive to automount at /mnt/portable. The idea is to overlay the existing library paths with matching ones on the external drive so mounted or not the directories are always there. What will be missing or change is the media itself which would have to be re-scanned.



#8 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 10:31 AM

Here's an idea worth testing. It's a deliberately sloppy way that might trick Emby into "thinking" the libary paths are always there.

 

Assuming you're using automount for the USB and have everything sorted out already.

 

Create full library paths for Emby on the filesystem, these are examples so adjust for your directory structure:

/mnt/portable/media/movies

/mnt/portable/media/series

/mnt/portable/media/<other>

 

Add the above to Emby as libraries, to suit your needs.

 

Make sure your external drive matches the above library paths from the mount point from media on down, USB has /media/...

 

Now setup the external drive to automount at /mnt/portable. The idea is to overlay the existing library paths with matching ones on the external drive so mounted or not the directories are always there. What will be missing or change is the media itself which would have to be re-scanned.

 

I considered this, but wont mounting the USB in the same directory as the current content essentially HIDE the items on the local drive?

 

https://unix.stackex...r-with-contents



#9 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 10:42 AM

Those library paths would be used only for the USB content, they are not the permanent media libs. And yes, the idea is to deliberately hide them with a matching directory tree so when the USB is swapped out, unmounted or mounted the structure does not change, only the media. Basically it's to keep Emby from complaining about missing locations.

 

The catch is that you have to pick a dir tree and stick with it when you send new media to your sister.



#10 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:01 AM

Those library paths would be used only for the USB content, they are not the permanent media libs. And yes, the idea is to deliberately hide them with a matching directory tree so when the USB is swapped out, unmounted or mounted the structure does not change, only the media. Basically it's to keep Emby from complaining about missing locations.

 

The catch is that you have to pick a dir tree and stick with it when you send new media to your sister.

 

Great.  Thanks.  And where would I stick the "local" media?  Just consider it a loss?  I hate to lose 1TB of capacity of possible.



#11 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:13 AM

Great.  Thanks.  And where would I stick the "local" media?  Just consider it a loss?  I hate to lose 1TB of capacity of possible.

 

The local media remains untouched. You can have as many libraries as you want pointing to as many paths as you want: Movies, USB Movies, TV, USB TV, Cloud Movies, Scary Movies, etc. It doesn't matter.

 

In my example, the paths and libraries are new ones created to be used only by the USB drives you send, not the existing internal ones, those don't change. Do you expect to have multiple USB drives connected at the same time?



#12 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:21 AM

I'd like to add than you can also have multiple paths defined in a media library. Both paths would be permanent, one for the internal media and one for the USB media. So the content appears as a consolidated view in the Emby UI.


Edited by Q-Droid, 11 November 2019 - 11:21 AM.


#13 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:23 AM

The local media remains untouched. You can have as many libraries as you want pointing to as many paths as you want: Movies, USB Movies, TV, USB TV, Cloud Movies, Scary Movies, etc. It doesn't matter.

 

In my example, the paths and libraries are new ones created to be used only by the USB drives you send, not the existing internal ones, those don't change. Do you expect to have multiple USB drives connected at the same time?

Sorry, I'm kinda slow :).  I'm not following.

 

Current directory structure in the Emby Library:

/media/video/movies

/media/video/tv_shows

/media/video/kids_shows

 

Current USB mount point:

/media/usb/movies

/media/usb/tv_shows

/media/usb/kids_shows

 

The way I understand it, if I were mount the external drive to /media/video (instead of /media/usb), the local contents would no longer be visible.  Do you think I'm missing something?



#14 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:40 AM

Sorry, I'm kinda slow :).  I'm not following.

 

Current directory structure in the Emby Library:

/media/video/movies

/media/video/tv_shows

/media/video/kids_shows

 

Current USB mount point:

/media/usb/movies

/media/usb/tv_shows

/media/usb/kids_shows

 

The way I understand it, if I were mount the external drive to /media/video (instead of /media/usb), the local contents would no longer be visible.  Do you think I'm missing something?

 

Yes. "The Emby Library" is not a static monolithic thing, it's very flexible in how you can layout and organize your media.

 

I see where we're not on the same page.  You don't have to mount the USB on /media, you can go deeper.

 

Walking thru this:

Leave the current internal directory structure alone.

 

Using the example above for now but you can change it.

 

If you want to stick to the above then you could create /movies, /tv_shows and /kids_shows on the USB root instead of /media.

 

Mount the USB to /media/usb instead of /media and the local stuff remains untouched.

 

You can reorganize the USB a little, still mount on /media/usb though you could end up with /media/usb/media/movies, /media/usb/media/tv_shows, etc.

 

Or pick a different path for the USB mount like /mnt/usb or /mnt/portable, it's up to you.

 

If you look at my original example it goes nowhere near the internal/local media.


Edited by Q-Droid, 11 November 2019 - 11:43 AM.


#15 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 11:52 AM

Yes. "The Emby Library" is not a static monolithic thing, it's very flexible in how you can layout and organize your media.

 

I see where we're not on the same page.  You don't have to mount the USB on /media, you can go deeper.

 

Walking thru this:

Leave the current internal directory structure alone.

 

Using the example above for now but you can change it.

 

If you want to stick to the above then you could create /movies, /tv_shows and /kids_shows on the USB root instead of /media.

 

Mount the USB to /media/usb instead of /media and the local stuff remains untouched.

 

You can reorganize the USB a little, still mount on /media/usb though you could end up with /media/usb/media/movies, /media/usb/media/tv_shows, etc.

 

Or pick a different path for the USB mount like /mnt/usb or /mnt/portable, it's up to you.

 

If you look at my original example it goes nowhere near the internal/local media.

 

Great.  Thanks for this info.

 

I guess I'm still not following how I can update the Emby Library without access to the web interface.  I only have ssh access and the current libraries are configured to the directories mentioned above.  I'm not really worried about the specific mount locations or directory structure of the external drive (I can quickly update all of that).  The crux of my question is, "how can I get Emby to recognize the content on the external drive when the library is only configured for the directories previously mentioned"?

 

Thanks again for the help.



#16 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 12:11 PM

Do you mean a library rescan or the first time setup? The setup would be a one time thing but still needs to be done. Maybe that's the part I've missed. If you can walk her through adding the new paths to the existing libraries then you're done, otherwise you'd have to figure out a way.

 

Could you try an SSH tunnel to launch Emby in a browser from your end?



#17 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 12:40 PM

I am not talking about a library rescan or the first time setup.  The library is already setup (and working) with the local content (the media on the actual server).  I am talking about adding the content that exists on the external USB drive to the existing library OR modifying the library paths to incorporate wherever I have the USB mounted all via the command line.

 

I've tried the ssh tunnel (sock proxy), but her bandwidth is BAD and I can't seem to connect. I've also tried to connect via app.emby.media/ and also had no luck.

 

I can make the necessary changes to the library config when I go over there to visit and have access to the web interface, but again, i was trying to get everything configured via ssh.

 

I think you have it right when you said "otherwise you'd have to figure out a way".  That is what brought me here.  I'm trying to figure out a way :)



#18 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 323 posts
  • Local time: 12:51 AM

Posted 11 November 2019 - 12:51 PM

Let me know if there's something I haven't explained right or you think I've left out. I often make assumptions when I think something is clear.



#19 mastrmind11 OFFLINE  

mastrmind11

    Advanced Member

  • Members
  • 2833 posts
  • Local time: 12:51 AM
  • LocationLong Island, NY

Posted 12 November 2019 - 07:59 AM

Why can't you enable external connections on her server and just connect your own client to her server?  Even with a shitty connection, that should be enough for you to add the usb libraries and run a scan.



#20 cmart2112 OFFLINE  

cmart2112

    Member

  • Members
  • 15 posts
  • Local time: 12:51 AM

Posted 12 November 2019 - 02:46 PM

Why can't you enable external connections on her server and just connect your own client to her server?  Even with a shitty connection, that should be enough for you to add the usb libraries and run a scan.

 

I have no idea!  I have external connections enabled on the server (as well as my own), but I can't seem to connect.  Whenever I try, I get a "connection failure: we're unable to connect to the selected server right now.  Please ensure it's running and try again."







Also tagged with one or more of these keywords: linux, library, headless, ssh

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users