-
Notifications
You must be signed in to change notification settings - Fork 6
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
Refactor lb-wrapper for command separation #110
Conversation
ea320c2
to
d98f002
Compare
scripts/lb-wrapper
Outdated
exit 1 | ||
fi | ||
|
||
command_type=$1 |
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.
Personally I'd prefer these 2 right on the very top of the file, as the very first constants declared...
XKLB_CMD="$1"
URL="$2"
...to make the bash script more readable 🙏
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.
Or if necessary... ?
XKLB_INTERNAL_CMD="$1"
URL="$2"
And maybe preserve the original XKLB_FULL_CMD
variable name alongside, to reduce confusion?
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.
XKLB_INTERNAL_CMD="$1"
URL="$2"
Using "$1" and appending the URL at the end makes the command ugly and difficult to grasp
And maybe preserve the original XKLB_FULL_CMD variable name alongside, to reduce confusion?
We can't per the design of separating them to decouple metadata fetching and video downloading
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.
It sounds like you're not understanding my suggestions.
I'll try to reach you privately.
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.
Thanks for explaining. Done.
Co-authored-by: A Holt <holta@users.noreply.github.com>
scripts/lb-wrapper
Outdated
if [ "$command_type" == "tubeadd" ]; then | ||
XKLB_CMD="${XKLB_EXECUTABLE} tubeadd ${XKLB_DB_FILE} ${URL} ${VERBOSITY}" | ||
elif [ "$command_type" == "dl" ]; then | ||
FORMAT_OPTIONS="--format best --format-sort 'tbr~1000'" |
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.
Special Request: Please keep all "CONSTANTS" near the top of the bash script (this one especially should stay where it is around Line 13, with the English explanation about alternatives for OOM debugging etc!)
FORMAT_OPTIONS="--format best --format-sort 'tbr~1000'"
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.
Done
Co-authored-by: A Holt <holta@users.noreply.github.com>
Co-authored-by: A Holt <holta@users.noreply.github.com>
scripts/lb-wrapper
Outdated
exit 1 | ||
fi | ||
|
||
# 2024-01-21: Not needed as XKLB reports its own version# to /var/log/xklb.log | ||
# log "Info" "xklb version: $(${XKLB_EXECUTABLE} --version)" | ||
|
||
log "Info" "Running xklb commands: ${XKLB_FULL_CMD}" | ||
# 2024-01-24: Not needed as we don't discard the database anymore |
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.
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.
Done
scripts/lb-wrapper
Outdated
@@ -40,21 +40,30 @@ fi | |||
# exit 1 | |||
# fi | |||
|
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.
Validation on Lines 43-44 should definitely be restored in my opinion:
if ! command -v "${XKLB_EXECUTABLE}"; then
log "Error" "xklb could not be found. Please install xklb and try again."
(...followed by a blank line if possible!)
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.
Done
@deldesir this is getting closer.
|
|
Acts as a mechanism to synchronize with the 2 download cycles (2 mentions of downloading each)
🚀 Pull Request Overview:
This pull request modified lb-wrapper to allow separate execution of 'tubeadd' and 'dl' commands. The script now takes a command type ('tubeadd' or 'dl') as the first argument, allowing users to choose which xklb command to run. Each command is executed independently with its own set of options.
This aims to facilitate the listing of requested files once
lb tubeadd
is done fetching metadata.📋 Checklist:
🔗 Related Issue(s):
Issue #104
📌 Testing scenarios:
See Issue #97
cc @EMG70
PS This PR builds upon #109