Skip to content

Commit

Permalink
add audio metadata check of ffprobe data
Browse files Browse the repository at this point in the history
  • Loading branch information
yajrendrag committed Oct 8, 2024
1 parent f2e5daa commit 2dcb3fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions source/rename_file/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

**<span style="color:#56adda">0.0.13</span>**
- add check for audio metadata presence in ffprobe data

**<span style="color:#56adda">0.0.12</span>**
- fix typo in elif: clause

Expand Down
2 changes: 1 addition & 1 deletion source/rename_file/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"on_postprocessor_task_results": 0
},
"tags": "rename, postprocessor",
"version": "0.0.12"
"version": "0.0.13"
}
10 changes: 6 additions & 4 deletions source/rename_file/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,15 @@ def replace(data, settings, abspath, streams):

acodec = ''
if astream:
audio_codec = streams[astream]["codec_name"]
channel_layout = streams[astream]["channel_layout"]
channels = streams[astream]["channels"]
audio_codec = streams[astream]["codec_name"] if "codec_name" in streams[astream] else ""
channel_layout = streams[astream]["channel_layout"] if "channel_layout" in streams[astream] else ""
channels = streams[astream]["channels"] if "channels" in streams[astream] else ""
if channel_layout == "stereo" and channels == 2:
acodec = audio_codec + ' ' + str(channels) + '.0'
elif channels > 4:
elif channels > 4 and channel_layout:
acodec = audio_codec + ' ' + str(channel_layout).replace('(side)','')
elif channels > 4 and not channel_layout:
acodec = audio_codec.upper() + ' ' + audio if audio_codec.upper() not in audio else audio
logger.debug("acodec: '{}'".format(acodec))

if basename.find(codec) > 0:
Expand Down

0 comments on commit 2dcb3fe

Please sign in to comment.