Compare commits

..

4 Commits

Author SHA1 Message Date
Emre AKYÜZ
d7553fe27c
Merge a7061f79bf27c44416350bdc06237d160c564f21 into 07952026753f1bbeaf5b6c4eb5414a9c51536041 2023-11-19 16:05:08 +03:00
Emre AKYÜZ
a7061f79bf
add some comments 2023-11-19 16:05:00 +03:00
Emre AKYÜZ
60866cad50
extra error handling 2023-11-19 15:55:28 +03:00
Emre AKYÜZ
996af9904e
Check for dependencies && Install them if needed 2023-11-19 13:50:01 +03:00
2 changed files with 24 additions and 2 deletions

View File

@ -2,6 +2,14 @@
while ! ping -c 1 9.9.9.9 > /dev/null 2>&1; do sleep 0.5; done
# "~/.local/share/channels.txt" looks like below:
# Luke Smith=https://www.youtube.com/@LukeSmithxyz/videos
# Mental Outlaw=https://www.youtube.com/@MentalOutlaw/videos
# ~/.local/share/categories.txt looks like below:
# Tech=Luke Smith|Mental Outlaw
INSTALLER="sudo pacman -S --noconfirm"
DATA_DIR="$HOME/.cache/youtube_channels"
CHANNEL_LIST="$HOME/.local/share/channels.txt"
mkdir -p "$DATA_DIR" && touch "$CHANNEL_LIST"
@ -15,7 +23,16 @@ error_handling() {
notify-send "'channels.txt' formatting is wrong."
exit 1
}
}
for pkg in yt-dlp mpv jq; do
command -v "$pkg" >/dev/null || {
notify-send "$pkg is not installed. Installing..."
$INSTALLER "$pkg" || {
notify-send "Failed to install $pkg."
exit 1
}
}
done
}
compare_data() {
local channel_name="$1"

View File

@ -8,6 +8,11 @@ CUSTOM_LIST_DIR="$DATA_DIR/custom_lists"
mkdir -p "$DATA_DIR" "$DOWNLOAD_DIR" "$CUSTOM_LIST_DIR"
[ "$(find "$DATA_DIR" -maxdepth 1 -type f -name "*.tsv" 2>/dev/null)" ] || {
notify-send "You need to run "channelrefresh" script first."
exit 1
}
DMENU() {
dmenu -i -l $1 -p "$2"
}
@ -64,7 +69,7 @@ custom_list_menu() {
[ -z "$list" ] && return
case "$list" in
*CREATE*)
new_list=$(DMENU 0 "Enter the name of the new list")
new_list=$(echo "" | DMENU 0 "Enter the name of the new list")
[ -n "$new_list" ] && touch "$CUSTOM_LIST_DIR/$new_list"
;;
*DELETE*)