Skip to content

Commit

Permalink
fix: config file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Dec 21, 2022
1 parent 2dd4993 commit b1be585
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .ytdl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
--embed-subs
# --sub-format srt
# --convert-subs srt
-P "./Youtube-DL/"
-P "/data/data/com.termux/files/home/storage/shared/Youtube-DL/"
-o "%(title).40s.%(ext)s"
--windows-filenames
--write-subs
Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mkdir -p $YOUTUBEDL_CONFIG_FOLDER
mkdir -p $TERMUXURLOPENER_CONFIG_FOLDER
# Download setup & config file
curl -L https://raw.githubusercontent.com/OzakIOne/termux-youtube-dl/v2.0.0/.ytdl.conf >"${YOUTUBEDL_CONFIG_FOLDER}/config"
curl -L https://raw.githubusercontent.com/OzakIOne/termux-youtube-dl/v2.0.0/sponsorblock.conf >"${YOUTUBEDL_CONFIG_FOLDER}/sponsorblock.conf"
curl -L https://raw.githubusercontent.com/OzakIOne/termux-youtube-dl/v2.0.0/share2youtubedl.sh >"${TERMUXURLOPENER_CONFIG_FOLDER}/termux-url-opener"

echo -e "${BLUE}Congratulations!!! Your setup is complete.\n\n"
Expand Down
17 changes: 9 additions & 8 deletions share2youtubedl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ clear
DOWNLOAD_PATH="~/storage/shared/Download/"
PLAYLIST="%(extractor)s/playlists/%(playlist_title)s_%(playlist_id)s/%(n_entries-playlist_index)03d - %(uploader)s - %(title)s [%(id)s].%(ext)s"
CHANNEL="%(extractor)s/channel/%(uploader)s_%(channel_id)s/%(title)s [%(id)s].%(ext)s"
CONFIG_PATH="${HOME}/.config/yt-dlp/"

function echo_bold() { echo -ne "\033[0;1;34m${*}${NC}\n"; }
function echo_success() { echo -ne "\033[1;32m${*}${NC}\n"; }
Expand All @@ -28,7 +29,7 @@ function isSponsorblockAlive() {

function downloadVideo() {
echo -e "\\nDownloading video...\\n"
yt-dlp --config-location ./.ytdl.conf -F "$1"
yt-dlp --config-locations "${CONFIG_PATH}config" -F "$1"
echo_warning "Choose your video quality (<enter> for: 'best'):"
read -p "" video
echo_warning "Choose your audio quality (<enter> for: 'best'):"
Expand All @@ -47,32 +48,32 @@ function downloadVideo() {
fi
if isSponsorblockAlive; then
# sucess
yt-dlp --config-location ./.sponsorblock.conf -o "$name" -f "$video"+"$audio" "$1"
yt-dlp --config-locations "${CONFIG_PATH}sponsorblock.conf" -o "$name" -f "$video"+"$audio" "$1"
else
# fail
yt-dlp --config-location ./.ytdl.conf -o "$name" -f "$video"+"$audio" "$1"
yt-dlp --config-locations "${CONFIG_PATH}config" -o "$name" -f "$video"+"$audio" "$1"
fi
}

function downloadChannel() {
echo "Downloading channel..."
if isSponsorblockAlive; then
# sucess
yt-dlp --config-location ./.sponsorblock.conf -o "$CHANNEL" "$1"
yt-dlp --config-locations "${CONFIG_PATH}sponsorblock.conf" -o "$CHANNEL" "$1"
else
# fail
yt-dlp --config-location ./.ytdl.conf -o "$CHANNEL" "$1"
yt-dlp --config-locations "${CONFIG_PATH}config" -o "$CHANNEL" "$1"
fi
}

function downloadPlaylist() {
echo "Downloading playlist..."
if isSponsorblockAlive; then
# sucess
yt-dlp --config-location ./.sponsorblock.conf -P $DOWNLOAD_PATH -o "$PLAYLIST" "$1"
yt-dlp --config-locations "${CONFIG_PATH}sponsorblock.conf" -P $DOWNLOAD_PATH -o "$PLAYLIST" "$1"
else
# fail
yt-dlp --config-location ./.ytdl.conf -P $DOWNLOAD_PATH -o "$PLAYLIST" "$1"
yt-dlp --config-locations "${CONFIG_PATH}config" -P $DOWNLOAD_PATH -o "$PLAYLIST" "$1"
fi

}
Expand Down Expand Up @@ -109,7 +110,7 @@ elif [[ "$1" =~ ^.*nourlselected.*$ ]]; then

# If shared element is NOT a youtube link
else
yt-dlp --config-location ./.ytdl.conf -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' "$1"
yt-dlp --config-locations "${CONFIG_PATH}config" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' "$1"
fi

read -p "Press enter to continue"
2 changes: 1 addition & 1 deletion sponsorblock.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--sponsorblock-remove all
--config-locations /data/data/com.termux/.ytdl.conf
--config-locations /data/data/com.termux/files/home/.config/yt-dlp/config

0 comments on commit b1be585

Please sign in to comment.