Jump to content

Create multi language libraries from your existing libraries


rbjtech
 Share

Recommended Posts

edit 30/08/2022

I've updated the script as follows -

- On repeat usage, added Progress Monitor when skipping existing STRM files (rather than thinking it's hung ..)
- Added Summary page of the New Libraries

This also works with TV Series - due to the nature of each episode needing it's own STRM file - it takes a little longer, but works just as well.

-------

I've created a simple script that creates a copy of the structure of an existing emby library (file path).  It then populates this new structure with strm (link) files back to the original video files.

You can then use this library as a new library within emby - and subsequently you can choose the metadata language as you would do as part of the normal setup.   

This means you can get :

  • native language metadata (if it exists)
  • native language artwork (if that exists)
  • subtitle language as required (you can do multi language subs in the core system)

The video file is played from the original library - so there is no need to duplicate the video files.

If required, user permission can be removed from the main library, leaving just this new library to browse in the users native language.

Usage (windows batch file)

Copy the batch file 'libstrm.bat' and 'library.txt' to the emby server in a suitable directory.

Modify the 'library.txt' file to match your system.  In the example file I have -

D:\TV Series\;D:\French TV Series\
D:\Films\;D:\German Films\

Also works with UNC -

\\media\TV Series\;\\media\French TV Series\
\\media\Films\;\\media\German Films\

The first path is the original location, the second path is the new library location (with the strm files).

Note - the path must end with a \ and the entries are separated by a semi-colon.

The 'library.txt' file can contain any number of drives and folders - I suggest testing with a sample to start with.

Run the 'libstrm.bat' file from a command.

Depending on the number of folders/files - it may take a few seconds or more to complete - but it will show progress as it goes.

Once complete - create new emby libraries pointing to the new locations - remembering to set the metadata language as required.

For example :-

french3.PNG.64522d06663d27506913c3198283343e.PNG

 

Once setup and emby has scanned the new folders (it will do this automatically if set to monitor - or a manual scan) - all the relevant metadata will be imported.

As an example - in my test French library :-

french1.thumb.PNG.c2b8b07248bf52d27c5f9139f29417d9.PNG

french2.thumb.PNG.c309beb593a9c0ed15359d04886e41d7.PNG

Note the French metadata, episode names and artwork.

In my test German library :-

german1.PNG.7dd0034a5fac3c40d88997800166c0c7.PNG

german2.thumb.PNG.dfab38f8e991a011b85cf9c07b2275ed.PNG

Again, German metadata & artwork.

Keeping the system updated ...

Because creating the strm files is manual - to add NEW media, the script can just be run again (via the Windows task schedule ever day for example).  If the strm file is already there, it will not recreate it.  However, if media is removed from the original library (remember it links to it, it is not a copy) - then the strm link will unfortunately break.  It can of course just be removed manually by deleting the strm file.   I've added a progress bar to now show when items are skipped (every 100 items gets a # displayed..)

Media Playback ...

The resulting playback will of course be identical to playing the original file (as it IS the original file) but any playback preferences will be remembered for that library.  So if the Audio was set to French with French subtitles, then next time it is played, it will remember those settings.   There may be a way of setting these to a library default in the native language - I have not experimented with this. 

Feedback welcome. :)

(rename the libstrm.bat.txt file to libstrm.bat)

 

library.txtlibstrm.bat.txt

Edited by rbjtech
Updated script
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Movieflix4K

I have tested this script, it works fine by itself. Only the indication of video resolution and audio language should appear automatically when the library is scanned. Now this information only appears after playing a video (Playing 1 second is sufficient but difficult to set the library correctly for 4000 films).

For the rest TOP script

Link to comment
Share on other sites

Happy2Play
3 hours ago, Privateyes said:

I have tested this script, it works fine by itself. Only the indication of video resolution and audio language should appear automatically when the library is scanned. Now this information only appears after playing a video (Playing 1 second is sufficient but difficult to set the library correctly for 4000 films).

For the rest TOP script

That is do to strm files do not get probed until first playback.  To many cloud users complained.

Link to comment
Share on other sites

Movieflix4K

Isn't there a workaround for examining the original video file (resolution and audio) before playing it?

Edited by Privateyes
Link to comment
Share on other sites

Hmmm - let me look into this.

We should be able to create a .nfo file easily after we create the strm - maybe copy portions of it from the original .nfo if it exists ..

This should (may..) force a scan of that item, correcting/updating the nfo with the missing items.. 

Edited by rbjtech
Link to comment
Share on other sites

@Privateyes Hmm not a lot of luck I'm afraid.

I can create the .nfo file - that is not an issue,  i've tried creating a dummy fileinfo section in the .nfo, even stuffed with fake data  - but it just gets wiped after a metadata refresh - it never gets read.

It must setting something in the database to say the strm is played - as you'll note that as soon as you play the strm, it replaces the Media Info with the real media info - it no longer says its an strm.

@Happy2Play Is this a know issue/limitation ?  Is there a way to force it using the API do you know ?

 

Link to comment
Share on other sites

Happy2Play
3 hours ago, rbjtech said:

Happy2Play Is this a know issue/limitation ?  Is there a way to force it using the API do you know ?

Pretty sure it is by design as all cloud users complained about library scans taking forever.  Where importing a strm file is almost instantaneous with no overhead for the probing every item.

But @Lukewould have to comment on if it possible to force probe these items.

  • Thanks 1
Link to comment
Share on other sites

  • 8 months later...

thanks for the script, it's working well.

i've got another question. is it in possible to filter media libraries by name? I've implemented a direct language switcher on the homepage to switch my system language and it would be nice, to directly navigate into a library selected by the name. (in my case would be the name for the language)

Link to comment
Share on other sites

  • 5 months later...
anthony_m

Great work and very happy to have found this script!

My emby server is a Qnap NAS so not sure where to put these two files as I cannot readily find my emby database on it. Has anybody with a similar setup already used it successfully?

Link to comment
Share on other sites

  • 2 weeks later...
On 10/08/2022 at 11:10, anthony_m said:

Great work and very happy to have found this script!

My emby server is a Qnap NAS so not sure where to put these two files as I cannot readily find my emby database on it. Has anybody with a similar setup already used it successfully?

You can run the windows batch file on any windows machine - so as long as you can access the 'shares' (on the nas) then it works equally as well using UNC names.

In this example library.txt file - I am using the share \\media\Films\ as the source and the share \\media\DownloadTemp\ as the destination.

The French and German folders (libraries) will be created on the share if they don't already exist.

\\media\Films\;\\media\DownloadTemp\French\
\\media\Films\;\\media\DownloadTemp\German\

I just tested this - it works beautifully !

Link to comment
Share on other sites

Posted (edited)

@chef @Cheesegeezer

'Multi Language Metadata' 

I'd forgotten all about this script I wrote - it's such a simple concept - and works beautifully.  

The only flaw is keeping the STRM files up to date with deletions and new additions, running it again adds items, but deleted items keep the strm file.

I know we are involved with many projects (lol) but do you think this could be put in a Plugin ?

Looking at the number of downloads - it did have a fair amount of interest - but via a Catalogue plugin, it will probably get a lot more.

It should be REALLY easy to do. (famous last words.. haha)

With a plugin, the user would create the new Alternate language library - and then choose the 'source' and 'destination' libraries - and it would simply create and copy strm links from all the existing content to the new library.   It could do this at a file level (as the script does) or do it by referencing the emby db file path.

You just repeat if you want multiple alternate libraries - or you could add multiple destinations (as the script does) 

A 'watch' monitor checks for new or deleted items (as we have done on many plugins) and it removes the strm file.

What do you think ?

I probably should learn how to write Plugin's myself 🤪 - this would be a nice easy one to start with I think ...

Edited by rbjtech
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...