Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove audio by language Plugin #39

Open
IamRewt opened this issue Aug 29, 2021 · 9 comments
Open

Remove audio by language Plugin #39

IamRewt opened this issue Aug 29, 2021 · 9 comments
Labels
type:plugin-request New plugin request

Comments

@IamRewt
Copy link

IamRewt commented Aug 29, 2021

I would like a plugin that can remove any audio track that is not a specified language.

If English is selected only keep English audio tracks.
If English, Spanish is selected only keep English and Spanish audio tracks etc.

The same would be nice for subtitles as well.

@Josh5
Copy link
Contributor

Josh5 commented Aug 30, 2021

How would you like to configure this plugin? Would you want a free-form text input. Eg:
2021-08-30_20-15

Also, how would you like the plugin to handle audio streams without a language specified? Possibly just remove them also? Or would you want to skip them?
I would estimate that well over half my library has files without "English" in the audio tags.
Also, it is worth knowing that different containers support different tags. Not all of them have a "language" tag specified.

@Josh5 Josh5 added the type:plugin-request New plugin request label Aug 30, 2021
@IamRewt
Copy link
Author

IamRewt commented Sep 4, 2021

I like that text input and being able to add in a comma-separated list of languages. As my library also has several files with English tracks that are listed as UND or unknown, I would say just skip those ones. That way we still have sound in the file.

As for the containers that do not define what language it is, I haven't dealt with them in the past, so I'm not really certain how those might need handling.

@Josh5
Copy link
Contributor

Josh5 commented Sep 20, 2021

I started writing this plugin tonight. As I was almost done I realised... Why not have a comma separated list of streams that you want removed? Would that work? That is much safer. And you can run it against your library safely as many time as you like.

For example, you add 'fr' to remove all French language streams. Then, after processing your whole library, you find you have a bunch of Japanese streams, so you edit the plugin config and save it as 'fr,jp'. Now you run your library scan again and it removes all Japanese streams and also removes French streams for any newly added files.
The removal of a stream on a file around 2GB will take Unmanic around 20 seconds. So this is not really a time consuming process to slow add more and more...
In my mind this approach is far safer for not removing audio streams accidentally. What do you think?

@IamRewt
Copy link
Author

IamRewt commented Sep 23, 2021

That does sound a bit safer to me. I do like the idea and would be happy to add the languages I'm good with it deleting.
Maybe others could chime in on this if they see it. I know I have some untitled audio tracks and some labeled UND so this might be the best approach.

@IamRewt
Copy link
Author

IamRewt commented Oct 1, 2021

@Josh5 not sure if you had more to do with this plugin, but I ran it against my library and it did the job well.

Just a heads up in the event you would like to close this one.

@Josh5
Copy link
Contributor

Josh5 commented Oct 1, 2021

Ah. Yes, thanks.
I'll close this off once the plugin is in the official repo

@EvilTactician
Copy link

Just a quick note that there is a bug in the plugin. If you specify "hi" (Hindi) to be removed, it will also remove "chi" (Chinese) audio due to a partial match of that string.

You may also wish to build in a safety measure to only remove languages under the condition that a certain language is present (in most cases, English). Right now the plugin is capable of stripping the final language from a file in cases where 99% of your library in in English but you have a handful of 'foreign' movies, for example.

Maybe a "don't strip audio if it's the final remaining audio track" option would be a good one?

@newb23
Copy link

newb23 commented Dec 30, 2022

Hiya! Thank you for adding this plugin to the repo, and it seems to work great! I do have a feature request specifically for it if I could, though. Could we get a negation switch? IE: only keep the languages specified? Ditto for subtitles if possible, too!

Now that I'm asking... I'll see if I have the ability to add it myself and make a PR if you don't/won't to add this/these, ha!

@Grenwalls
Copy link

Looking for a list of all the language codes supported, but can't find a ISO that treats japanese as "jp" so I dont really know what to write.

I second that being able to negate would be a much better option! I just need english, swedish and undefined. Would be a lot easier! Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:plugin-request New plugin request
Projects
None yet
Development

No branches or pull requests

5 participants