Skip to content

Commit

Permalink
added more debug logging to same_streams_or_no_work
Browse files Browse the repository at this point in the history
  • Loading branch information
yajrendrag committed Mar 3, 2024
1 parent f74a088 commit 06b53d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions source/keep_stream_by_language/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

**<span style="color:#56adda">0.0.32</span>**
- added more debug logging for same_streams_or_no_work

**<span style="color:#56adda">0.0.31</span>**
- add check to same_streams expanding the test for no work by identifying scenarios where the only streams to keep are the only ones in the file already whether tagged or untagged

Expand Down
2 changes: 1 addition & 1 deletion source/keep_stream_by_language/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"on_worker_process": 1
},
"tags": "audio,subtitle, ffmpeg,library file test",
"version": "0.0.31"
"version": "0.0.32"
}
7 changes: 6 additions & 1 deletion source/keep_stream_by_language/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ def same_streams_or_no_work(self, streams, keep_undefined):
if not audio_streams_list or not subtitle_streams_list:
return False
untagged_streams = [i for i in range(len(streams)) if "codec_type" in streams[i] and streams[i]["codec_type"] in ["audio", "subtitle"] and ("tags" not in streams[i] or ("tags" in streams[i] and "language" not in streams[i]["tags"]))]
no_work_to_do = (all(l in slcl for l in subtitle_streams_list) and all(l in alcl for l in audio_streams_list) and (keep_undefined == True or (keep_undefined == False and untagged_streams == [])))
subs_in_slcl = all(l in slcl for l in subtitle_streams_list)
audio_in_alcl = all(l in alcl for l in audio_streams_list)
no_work_to_do = (subs_in_slcl and audio_in_alcl and (keep_undefined == True or (keep_undefined == False and untagged_streams == [])))
logger.debug("audio config list: '{}', audio streams in file: '{}'".format(alcl, audio_streams_list))
logger.debug("subtitle config list: '{}', subtitle streams in file: '{}'".format(slcl, subtitle_streams_list))
logger.debug("untagged streams: '{}'".format(untagged_streams))
logger.debug("subs in slcl: '{}'; audio in alcl: '{}'".format(subs_in_slcl, audio_in_alcl))
logger.debug("no work to do: '{}'".format(no_work_to_do))
if ((alcl == audio_streams_list or alcl == ['*']) and (slcl == subtitle_streams_list or slcl == ['*'])) or no_work_to_do:
return True
else:
Expand Down

0 comments on commit 06b53d4

Please sign in to comment.