rbjtech 4284 Posted May 21, 2021 Share Posted May 21, 2021 (edited) 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 :- 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 :- Note the French metadata, episode names and artwork. In my test German library :- 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 August 30, 2022 by rbjtech Updated script 4 2 Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 21, 2021 Share Posted May 21, 2021 Cool, thanks for sharing. Link to comment Share on other sites More sharing options...
videopalace 26 Posted May 24, 2021 Share Posted May 24, 2021 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 More sharing options...
Happy2Play 8296 Posted May 24, 2021 Share Posted May 24, 2021 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 More sharing options...
videopalace 26 Posted May 25, 2021 Share Posted May 25, 2021 (edited) Isn't there a workaround for examining the original video file (resolution and audio) before playing it? Edited May 25, 2021 by Privateyes Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted May 26, 2021 Author Share Posted May 26, 2021 (edited) 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 May 26, 2021 by rbjtech Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted May 26, 2021 Author Share Posted May 26, 2021 @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 More sharing options...
Happy2Play 8296 Posted May 26, 2021 Share Posted May 26, 2021 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. 1 Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 26, 2021 Share Posted May 26, 2021 Only with some api hackery. 1 Link to comment Share on other sites More sharing options...
melf11 7 Posted February 10, 2022 Share Posted February 10, 2022 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 More sharing options...
anthony_m 1 Posted August 10, 2022 Share Posted August 10, 2022 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 More sharing options...
rbjtech 4284 Posted August 25, 2022 Author Share Posted August 25, 2022 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 More sharing options...
rbjtech 4284 Posted August 25, 2022 Author Share Posted August 25, 2022 (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 August 25, 2022 by rbjtech 3 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 5 Share Posted February 5 @rbjtechDid you ever figure this out? Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted February 5 Author Share Posted February 5 24 minutes ago, Dibbes said: @rbjtechDid you ever figure this out? You mean the strm file not showing the full metadata until accessed ? Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 5 Share Posted February 5 Yup Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted February 5 Author Share Posted February 5 2 minutes ago, Dibbes said: Yup No I didn't pursue it myself - but as Luke alluded to - by simply using a session key to look at the item /sessions/[id]/viewing - you can trick emby into thinking it has visted that item and thus populate the full metadata. 1 Link to comment Share on other sites More sharing options...
TeamB 2353 Posted February 6 Share Posted February 6 4 hours ago, rbjtech said: No I didn't pursue it myself - but as Luke alluded to - by simply using a session key to look at the item /sessions/[id]/viewing - you can trick emby into thinking it has visted that item and thus populate the full metadata. I wrote a plugin that triggers a STRM to be probed: 1 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 6 Share Posted February 6 Feels like I'll be doing some combining of various scripts and plugins then... ScripterX, RBJTech's STRM script and the extract plugin... let's see what that comes back with Thanks both, @rbjtechand @TeamB! 1 Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted February 6 Author Share Posted February 6 (edited) 1 hour ago, Dibbes said: Feels like I'll be doing some combining of various scripts and plugins then... ScripterX, RBJTech's STRM script and the extract plugin... let's see what that comes back with Thanks both, @rbjtechand @TeamB! Looking forward to it Depending on the timescales for the Smartplaylists - now we have better playlist management and a way to probe strm files, I may also revisit my 'Recommendation' Plugin/Script and convert that into a proper Plugin. That uses a similiar concept, but simply creates a new strm item in a 'watch/recommended' library created by simply retrieving those items from a suitable named user created playlist (now in the db, don't need to query the xml anymore). https://emby.media/community/index.php?/topic/99029-personalised-recommendations-library-work-in-progress/#comment-1033255 Edited February 6 by rbjtech 1 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 6 Share Posted February 6 (edited) As I said per PM, @rbjtechI couldn't get your batch script to work... (this says more about me than about your batch script, lol) Either way, I wrote a PowerShell script doing the same thing, based on your work. It also asks if you'd like to copy any image files and subtitle files, so that Emby does not have to re-download these. You can either put a file called "paths.txt" in the same folder as the script, or, if paths.txt cannot be found, you will be asked to enter a path. Output is on screen and in a log.txt saved in the same folder as the script. It's scanning recursive and does not distinguishes between movies and series (music was deliberately omitted), so my suggestion is to put the script in the root folder of the library (not the root of the server or root of the volume) you want to create the .strm files from. Any feedback, give me a shout. Note: To use with the Scripter-X plugin, you must supply the paths.txt file and comment out the sections for copying the subtitles and images, or it will eternally hang on that question strm-library.ps1 Edited February 6 by Dibbes 1 Link to comment Share on other sites More sharing options...
rbjtech 4284 Posted February 7 Author Share Posted February 7 (edited) 10 hours ago, Dibbes said: As I said per PM, @rbjtechI couldn't get your batch script to work... (this says more about me than about your batch script, lol) Either way, I wrote a PowerShell script doing the same thing, based on your work. It also asks if you'd like to copy any image files and subtitle files, so that Emby does not have to re-download these. You can either put a file called "paths.txt" in the same folder as the script, or, if paths.txt cannot be found, you will be asked to enter a path. Output is on screen and in a log.txt saved in the same folder as the script. It's scanning recursive and does not distinguishes between movies and series (music was deliberately omitted), so my suggestion is to put the script in the root folder of the library (not the root of the server or root of the volume) you want to create the .strm files from. Any feedback, give me a shout. Note: To use with the Scripter-X plugin, you must supply the paths.txt file and comment out the sections for copying the subtitles and images, or it will eternally hang on that question strm-library.ps1 4.04 kB · 3 downloads Thanks @Dibbes- looking good. The only observation is that by copying the image files - you may not want to do this as the original idea is to get the image files from the alternative language (if available), they will usually have the name embedded in the artwork for the native language - but copying the subs, good call. Edited February 7 by rbjtech Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 7 Share Posted February 7 58 minutes ago, rbjtech said: Thanks @Dibbes- looking good. The only observation is that by copying the image files - you may not want to do this as the original idea is to get the image files from the alternative language (if available), they will usually have the name embedded in the artwork for the native language - but copying the subs, good call. Copying either the subtitles or the images is optional. It will ask you if you'd like to, however, if the subtitles/images are already there, it won't overwrite 1 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted February 10 Share Posted February 10 (edited) I put together something that cleans up the .strm folders as well... saves doing it manually when the video no long exists in the original location. What it does: Scans all .strm files recursively in a directory structure, reads the .strm files and checks if the original video file still exist. If the video file does not exist, it will ask if you want to delete the .strm file. NOTE: If the path is not accessible for any reason (DNS, Access Rights, etc.), the script will ask to delete everything. StrmFileCleanup.ps1 Edited February 10 by Dibbes 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now