TheCaptain989 / radarr-striptracks

A Docker Mod to Radarr/Sonarr to automatically remove unwanted audio and subtitle tracks
https://hub.docker.com/r/thecaptain989/radarr-striptracks
GNU General Public License v3.0
23 stars 1 forks source link

How do i check status of this script? #72

Closed Strux-DK closed 4 months ago

Strux-DK commented 5 months ago

Hey, Sorry for opening an issue for this, if that's not the correct thing to do.

I want to clean up my media that is riddled with languages and subtitles from all over the world. I recently added the striptracks mod onto Sonarr and Radarr for doing that. Is there a way to manually run the script against existing media? It seems there is a batch mode, but that also requires one to know all media files extensions in the library, which i have no idea of. I just want all media to have audio and subtitles in 2 languages, no more and no less. Can that be (easily) done with this script or is there another easier way?

TheCaptain989 commented 5 months ago

The script can absolutely do this. The batch example is just that, an example only. It will try to convert whatever file you pass to it, but will just log an error if it is not a known file type to mkvmerge.

Strux-DK commented 4 months ago

Thanks for the answer! Can you help me with the syntax of the command and where to run it, or where i can read the information i need?

TheCaptain989 commented 4 months ago

I'm not sure exactly which audio or subs you want to keep, but for example you could try:

find /movies/ -type f | while read file
  do /usr/local/bin/striptracks.sh -f "$file" -a :eng:fre:und -s :eng:fre:und
done

To pass every file from your /movies folder to the script, and if it's a video it would keep only English and French audio and subtitles. It would also keep untagged or unknown tracks for safety.

Please be careful when you do something like this. You could accidentally nuke your whole video library if you typo the wrong language code for example. Please test on a few files to be sure it is doing what you want.

Strux-DK commented 4 months ago

It doesn't seem to work. I should be running it inside either the radarr or the sonarr containers, right? That's where the script is. I run: find HP-test/ -type f | while read file; do /usr/local/bin/striptracks.sh -f "$file" -a :eng:dan:und -s :eng:dan:und With HP-test being a folder with a small number of movies. When i run it, all that happens is it makes a '>' like this: billede

What am i doing wrong?

TheCaptain989 commented 4 months ago

I've been responding on my phone, which is not the easiest to troubleshoot from. I likely mistyped something above. Please forgive me, it will be a couple of weeks before I can respond properly.

TheCaptain989 commented 4 months ago

Sorry for the delay. Please check out this example below:

find HP-test/ -type f | while read file; do if file -i "$file" | grep -q video; then /usr/local/bin/striptracks.sh -f "$file" -a :eng:dan:und -s :eng:dan:und; fi; done
Strux-DK commented 4 months ago

Thanks, i will try it out, hopefully later today. Now that i have your expertise, how can i verify that the script is being run against new media? Is there a log line i can search for?

Strux-DK commented 4 months ago

I'm getting the following output, what does that tell you? Is it expected? billede

TheCaptain989 commented 4 months ago

To me, that means you don't have the "file" executable. Can you please type file -v at the command line? I would expect the output to be something like:

$ file -v
file-5.44
magic file from /usr/share/misc/magic
Strux-DK commented 4 months ago

Dang. Is that something that should be included or something i should've installed by myself? billede

TheCaptain989 commented 4 months ago

Well, that explains it. That was my attempt at safely running this on all video files only. Oh, well. I have no idea why it would be missing. That's a default program in most linux installs.

This should work:

find HP-test/ -type f | while read file; do /usr/local/bin/striptracks.sh -f "$file" -a :eng:dan:und -s :eng:dan:und; done

Please be careful when you do something like this. Please test on a few files to be sure it is doing what you want. I'm not 100% sure what it will do to non-video files.

Strux-DK commented 4 months ago

well, im running the script in the container for Radarr and Sonarr and i guess they only have what is absolutely necessary. Should i run it on the docker host instead?

TheCaptain989 commented 4 months ago

No, my script will likely not work outside of the container. I just had a thought, you could try running apt install file (inside the container) and see if that works. If it does, try running my one liner from 2 days ago again.

Strux-DK commented 4 months ago

Apparently that cant be done billede

TheCaptain989 commented 4 months ago

How about apt-get install file ?

Strux-DK commented 4 months ago

Nope, can't do that either

TheCaptain989 commented 4 months ago

Oh, well. Give the last one-liner script I posted a try, just not on your entire library yet.

TheCaptain989 commented 4 months ago

To answer your earlier question, all the script activity will be logged so you can check what it did afterwards.

Strux-DK commented 4 months ago

It seems everything is working. I found out i used the wrong package manager and by using the right one i was able to install 'file' and use the first one-liner on a small test directory. I checked the logs and found that it did what i wanted it to.

I also saw in the logs, that it removed the danish language and subtitles from other movies that i recently downloaded, apart from this little test. Upon analyzing this, i found i have made a Custom format, 'STD Language' with Danish and English in it, but made none of them required. Would that be the reason why it removed Danish, along with other languages, instead of keeping it?

TheCaptain989 commented 4 months ago

Oh, good deal!

Custom Formats are not easy to understand. What works for me is making one format with the two languages I want Negated and Required, and then score that format as a -1000 in the Profile. Also make sure you select 'Any' as the profile language in Radarr (not required in Sonarr). Check this section of my docs for more info.

TRaSH Guides made a much better explainer than I ever could about this.

Custom Format: image

Profile: image

Strux-DK commented 4 months ago

Thanks! I looked at Thrash's site and found an alternative that i think fits the bill. Will have to check in a couple of days. But thanks for the help with this :)

TheCaptain989 commented 4 months ago

No problem.