Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************************************************************************************************
- [Sonarr AutoSubber v2] by Zignature & rednoah
- Concept & idea by Zignature
- Scripting by rednoah
- The creator of Filebot - The ultimate tv renamer / subtitle downloader / sfv validator
- https://github.com/rednoah
- http://www.filebot.net/
- DESCRIPTION:
- This script uses Filebot to search for subtitles by hash in the given language(s) and
- saves the file with ISO 639-2/B language code(s).
- This handy for Plex users for instance, since Plex doesn't support ISO 639-3 codes.
- If multiple languages are required add them as a comma-separated list (without spaces!) eg. nl,en,fr,de
- USAGE:
- Call from command line:
- filebot -script "[PATH\TO\ISO639-2B-subber.groovy]" "[PATH\TO\(FOLDER|FILE)]" --lang [2-letter ISO 639-1 language code(s)]
- EXAMPLES:
- filebot -script "C:\MyScripts\ISO639-2B-subber.groovy" "C:\Movies" --lang nl
- filebot -script "C:\MyScripts\ISO639-2B-subber.groovy" "C:\Movies\video.avi" --lang nl
- filebot -script "C:\MyScripts\ISO639-2B-subber.groovy" "C:\Movies" --lang nl,en,fr
- filebot -script "C:\MyScripts\ISO639-2B-subber.groovy" "C:\Movies\video.avi" --lang nl,en,fr
- ***************************************************************************************************************************/
- // select input language(s)
- def languages = _args.lang.split(/\W/) as List
- // select input videos
- def videoFiles = args.getFiles{ it.isVideo() }
- // fetch missing subtitles
- def subtitleFiles = languages.findResults{
- getMissingSubtitles(lang: it, file: videoFiles, output: 'srt', encoding: 'UTF-8')
- }.flatten()
- // rename subtitles
- rename(map: subtitleFiles.collectEntries{
- [it, getMediaInfo(it, '{fn[0..-5]}.{lang.ISO3B}.{ext}')]
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement