Pull Request Summary: Enhancements to audio2tonie.sh #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the
audio2tonie.sh
script to enhance its functionality, robustness, and user experience. Below is a summary of the changes:1. Support for TeddyCloud Library Path
-p
or--path
option to specify the target directory in the TeddyCloud library where the.taf
file should be uploaded./
).2. Improved File Naming for Directories
.taf
file with an incorrect or empty name when the input was a directory (e.g.,/path/to/
)..taf
file (e.g.,/path/to/
becomes/path/to/to.taf
).3. Avoid Creating Empty
.taf
Files.taf
file if the input directory contains no valid audio files.4. Improved Error Handling and Robustness
curl
,jq
,python3
) to ensure the script fails gracefully if something goes wrong.set -euo pipefail
to enable strict mode, which ensures the script exits on errors, unset variables, and pipeline failures.5. Enhanced User Feedback
.taf
file being created, including:6. Support for Full TeddyCloud URIs
-u
or--upload
option to accept full URIs (e.g.,https://teddycloud.local
orhttp://192.168.1.100
).http://
orhttps://
.curl
's-L
flag.7. Code Refactoring and Modularization
display_help
: Displays the help message.print_settings
: Prints the current script settings.upload_to_teddycloud
: Handles file uploads to TeddyCloud.normalize_teddycloud_uri
: Validates and normalizes the TeddyCloud URI.print_taf_creation_details
: Prints details about the.taf
file being created.has_valid_audio_files
: Checks if a directory contains valid audio files.get_basename
: Extracts the base name of a directory (without trailing slashes).8. Improved Help Message
Why These Changes Matter:
.taf
files.Testing:
Example Workflow:
Convert a single audio file and upload it to a custom path:
Convert all audio files in a directory and upload them to the root library folder:
This pull request enhances the script's functionality and usability while maintaining backward compatibility. Feedback and suggestions are welcome! 🚀
Let me know if you need further adjustments!