-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add and enhance download options configuration #9
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If this option enabled (i.e., set to `true`) all log info and error messages will be suppressed, this also include the conversion progress.
Added a new typedef called `DownloadOptions` as an interface for the download options object. Later the download options will be used to configure the download process on `singleDownload` and `batchDownload` functions. Additionally, a function to resolve the download options object has been implemented and will strictly check the type for each option.
- Changed `writeLogError` to be an async function. - Added `await` to `createDirIfNotExist(LOGDIR)` call to ensure the log directory is created before attempting to write the log file.
This parameter can be useful to suppress the download progress bar when set to `false`. Defaults to `false`. And also added `await` keyword on `writeLogError()` call.
Added a new parameter called `downloadOptions` (type of `DownloadOptions`) to `singleDownload` and `batchDownload` functions to configure the download process. In addition to this change, those functions are respectively refactored and updated to apply the given options.
This module provides global configuration options for the CLI usage of this project, it is not intended for programmatic use. Note: Options within the config module might be changed in future, because it is still in development.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This pull request introduces significant enhancements and new features to the YTMP3-JS library, primarily focusing on providing configurable options for the download and conversion processes. This includes the addition of a global configuration module tailored for CLI usage and improvements to existing functions to support these options.
Changes Made
Further Details
Features
Add
quiet
Option to Suppress Info in Audio Conversion:Introduced a
quiet
option in the audio conversion process. When enabled (true
), all log info and error messages, including the conversion progress, will be suppressed.Add
DownloadOptions
Typedef and Resolver:Added a new typedef called
DownloadOptions
to serve as an interface for the download options object. Implemented a resolver function to strictly check the types of each option, ensuring valid configuration.Add
verbose
Parameter todownloadHandler
:Added a
verbose
parameter to thedownloadHandler
function. This parameter, when set tofalse
, suppresses the download progress bar. By default, it is set tofalse
. Also added theawait
keyword to thewriteLogError()
call.Add
downloadOptions
Parameter to Downloader Functions:Added a new
downloadOptions
parameter to thesingleDownload
andbatchDownload
functions to configure the download process. Refactored these functions to apply the given options accordingly.Add Global Configuration Module for CLI Usage:
Introduced a new module to provide global configuration options for the CLI usage of the project. This module is not intended for programmatic use. Options in this module may change in future updates.
Apply Global CLI Configuration to Main Module:
Integrated the global CLI configuration options into the main module, ensuring consistent behavior across the CLI.
Refactors
writeLogError
Async to Await Directory Creation:Changed
writeLogError
to an async function and addedawait
to thecreateDirIfNotExist(LOGDIR)
call to ensure the log directory is created before writing the log file.Chore
config
Directory in JSDoc:Updated JSDoc configuration to include the
config
directory for comprehensive documentation coverage.Summary
This pull request enhances the YTMP3-JS library by adding configurable options for both the download and conversion processes. The new
DownloadOptions
typedef and resolver function ensure valid configurations, while the global configuration module provides a convenient way to manage CLI usage behavior. Additionally, improvements and fixes to existing functions ensure a more robust and user-friendly experience.