TheCaptain989 / radarr-striptracks

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

Track number 0 removed in some circumstances #47

Closed TheCaptain989 closed 1 year ago

TheCaptain989 commented 1 year ago

If the video file has an audio track id of 0 and any other selected audio track, track 0 is removed. The script will misleadingly log that the track is kept, but if you examine the resulting file, what was track 0 is missing. This same behavior will happen to a subtitle track id 0.

Example log details:

Radarr event: Download, Video: /media/Movies/The Adjustment Bureau (2011)/The Adjustment Bureau (2011).DTS-HD MA.mkv ...
Original tracks: 26 (audio: 2, subtitles: 23)
Chapters: 20
Keeping audio track 0: eng (DTS-HD Master Audio)
Keeping audio track 2: eng (AC-3)
Keeping subtitles track 3: eng (HDMV PGS)
Keeping subtitles track 21: eng (HDMV PGS)
Removed subtitles tracks: 9: spa (HDMV PGS),10: dut (HDMV PGS),19: por (HDMV PGS),11: chi (HDMV PGS),20: swe (HDMV P ...
Kept tracks: 5 (audio: 2, subtitles: 2)
New size: 4.155G
Calling Radarr API to rescan movie, try #1
Completed in 1m 4s

In reality, the resulting file only had one audio track and two subtitles tracks. In this case the DTS-HD Master Audio track had been removed

Note that if there is only a single kept audio or subtitle track and it happened to have id 0, it would still be preserved.

Typically, track id 0 is the video stream, but this is not necessarily the case, and it certainly doesn't have to be. This is probably why it took me so long to encounter this issue. The problem is due to a comparison operator issue in my awk custom join function. A fix is already being tested.