-
Notifications
You must be signed in to change notification settings - Fork 0
Move to flac #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: base-sha/a5336ef9e38cf2b71edeb9cc6b0012fb56d6087d
Are you sure you want to change the base?
Move to flac #72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -224,7 +224,7 @@ def audio_notification(audiofile, apobj, body, title): | |||||||||||
Examples: | ||||||||||||
audio_notification(audiofile, apobj, body, title) | ||||||||||||
""" | ||||||||||||
opusfile = Path(audiofile).with_suffix(".opus") | ||||||||||||
flacfile = Path(audiofile).with_suffix(".flac") | ||||||||||||
ffmpeg_cmd = [ | ||||||||||||
"ffmpeg", | ||||||||||||
"-y", | ||||||||||||
|
@@ -233,25 +233,19 @@ def audio_notification(audiofile, apobj, body, title): | |||||||||||
"-filter:a", | ||||||||||||
"loudnorm=i=-14", | ||||||||||||
"-c:a", | ||||||||||||
"libopus", | ||||||||||||
"-application", | ||||||||||||
"voip", | ||||||||||||
"-cutoff", | ||||||||||||
"8000", | ||||||||||||
"-vbr", | ||||||||||||
"on", | ||||||||||||
opusfile, | ||||||||||||
"flac", | ||||||||||||
flacfile, | ||||||||||||
] | ||||||||||||
subprocess.run(ffmpeg_cmd, check=True, capture_output=True) | ||||||||||||
|
||||||||||||
opusfile = str(opusfile) | ||||||||||||
flacfile = str(flacfile) | ||||||||||||
apobj.notify( | ||||||||||||
body=body, | ||||||||||||
title=title, | ||||||||||||
attach=opusfile, | ||||||||||||
attach=flacfile, | ||||||||||||
) | ||||||||||||
# Remove opusfile; audiofile and json unlinked later | ||||||||||||
Path.unlink(opusfile) | ||||||||||||
# Remove flacfile; audiofile and json unlinked later | ||||||||||||
Path.unlink(flacfile) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (edge_case_not_handled): Consider handling potential exceptions when unlinking the file. Using a try-except block around the file deletion could prevent unhandled exceptions if the file does not exist or is locked, enhancing the robustness of the function.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment helpful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the comment type correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the comment area correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this comment become an LLM test? |
||||||||||||
|
||||||||||||
|
||||||||||||
def import_notification_destinations(): | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (edge_case_not_handled): Consider verifying the existence of the audio file before conversion.
Adding a check to ensure the audio file exists before attempting to convert it can prevent runtime errors if the file is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment helpful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment type correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the comment area correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment become an LLM test?