gfitzp / fitzflix

A media library manager
MIT License
1 stars 0 forks source link

If audio/subtitle track is out of range, try to fix #74

Closed gfitzp closed 2 years ago

gfitzp commented 3 years ago

Handle this type of error:

Traceback (most recent call last):
 File "/Users/gfitzp/Sites/fitzflix/app/videos.py", line 272, in localization_task
   audio_tracks = get_audio_tracks_from_file(file_path)
 File "/Users/gfitzp/Sites/fitzflix/app/videos.py", line 1987, in get_audio_tracks_from_file
   audio_track["language"] = language[3]
IndexError: list index out of range

If MKV, re-export as MKV

mkvmerge -o output_file file_path

If not MKV, export the first track for video/audio/subtitle:

 ffmpeg -i file_path -c:v copy -c:a copy -c:s copy -map 0:v:0 -map 0:a:0 -map 0:s:0? output_file

Try to re-process the output_file, and if it still can't be processed, then throw exception.

gfitzp commented 2 years ago

Seems when a track has no linguistic content ('zxx' language code) it's missing the 4th language name, so trying to get language[3] in other_language fails; see:

'other_language': ['zxx', 'zxx', 'zxx'] vs 'other_language': ['English', 'English', 'en', 'eng', 'en']

Fixed in c066d1c53e21f1f36d008af0b686771eee43e12b