Skip to content

Commit bbf8e9d

Browse files
committed
initial commit
0 parents  commit bbf8e9d

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# luus

lud

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
# LUD - The LARBS Universal Downloader
3+
# A dmenu utility to download files from various sites & types
4+
# Created by Daniel Crooks - github.com/inVariabl
5+
### MINIMALIST VERSION ###
6+
7+
pgrep -x dmenu && exit
8+
9+
# Get Link
10+
if [[ "$1" = "" ]]; then
11+
if command -v xclip > /dev/null; then # OPT
12+
link=$(xclip -o)
13+
elif command -v xsel > /dev/null; then
14+
link=$(xsel -o -b)
15+
else
16+
echo "Neither 'xclip' or 'xsel' not installed"
17+
fi
18+
else
19+
link="$1"
20+
fi
21+
[[ "$link" = "" ]] && exit 1
22+
echo "Link: $link"
23+
24+
# Get Directory
25+
if [[ $2 = "" ]]; then
26+
# Add your own directories below
27+
dirlist=$(sudo find ~/Videos ~/Pictures ~/Downloads -type d -maxdepth 8 2>/dev/null)
28+
dir=$(echo "$dirlist" | dmenu -i -p "Download to:" -l 10)
29+
[[ "$dir" = "" ]] && exit 1
30+
if [[ ! -d "$dir" ]]; then
31+
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$dir does not exist. Create it?")
32+
[[ "$mkdiryn" = "Yes" ]] && (mkdir -p "$dir" || sudo -A mkdir -p "$dir")
33+
fi
34+
else
35+
dir=$2
36+
fi
37+
38+
[[ "$dir" = "" ]] && exit 1
39+
echo "Directory: $dir" # OPT
40+
cd "$dir"
41+
42+
# Writes to log file
43+
echo -e "$link"'\t'"$dir"'\t''#'`date` >> ~/.lud_history
44+
45+
# Sort & Download
46+
# Youtube-DL
47+
yttest=$(youtube-dl -e --abort-on-error "$link")
48+
if [[ $? -eq 0 ]]; then
49+
echo "Downloader: Youtube-dl"
50+
type=$(echo -e "Video\nAudio" | dmenu -i -p "Download Type:")
51+
if [[ $type == "Video" ]]; then
52+
echo "Downloading Video"
53+
sudo youtube-dl -ic --add-metadata "$link" --abort-on-error --external-downloader aria2c --external-downloader-args "-x 16 -s 16 -k 1M"
54+
break
55+
elif [[ $type == "Audio" ]]; then
56+
echo "Downloading Audio"
57+
sudo youtube-dl -xic --add-metadata "$link" --abort-on-error --external-downloader aria2c --external-downloader-args "-x 16 -s 16 -k 1M"
58+
break
59+
fi
60+
else
61+
echo "Downloader: Aria2c"
62+
if command -v aria2c > /dev/null; then
63+
sudo aria2c "$link" -x 16 -s 16 -k 1M -m 5
64+
break
65+
fi
66+
fi
67+
68+
note "'$link' to '$dir'" -t 2000
69+
exit 1

lup

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
# LUP - LARBS Universal Player
3+
# takes link/destination and opens in application
4+
5+
source_type=$(printf "Link\\nDestination\\nHistory" | dmenu -i -p "LUP - Source Type: ")
6+
[[ "$source_type" = "" ]] && exit 1
7+
echo 'Source Type: ' $source_type
8+
9+
if [[ "$1" = "" ]]; then
10+
if [[ "$source_type" = "Link" ]]; then
11+
source=$(xclip -o)
12+
elif [[ "$source_type" = "Destination" ]]; then
13+
[[ "$source_type" = "" ]] && exit 1
14+
dest_type=$(printf "File\\nFolder" | dmenu -i -p "Player type: ")
15+
if [[ "$dest_type" = "File" ]]; then
16+
dirlist=$(sudo find ~/Videos/ ~/Pictures/ ~/Sync/ ~/Downloads/ ~/Memes/ -type f -maxdepth 8 2>/dev/null)
17+
source=$(echo "$dirlist" | dmenu -i -p "File Destination: " -l 10)
18+
elif [[ "$dest_type" = "Folder" ]]; then
19+
dirlist=$(sudo find ~/Videos/ ~/Pictures/ ~/Sync/ ~/Downloads/ ~/Memes/ -type d -maxdepth 8 2>/dev/null)
20+
source=''$(echo "$dirlist" | dmenu -i -p "Folder Destination: " -l 10)''
21+
fi
22+
elif [[ "$source_type" = "History" ]]; then
23+
history_list=$(tail -n 10 ~/.lup_history | tac | dmenu -i -p "Recent Files: " -l 5)
24+
source=$(echo "$history_list" | cut -f1)
25+
player=$(echo "$history_list" | cut -f2)
26+
fi
27+
else
28+
source="$1"
29+
fi
30+
[[ $source = "" ]] && exit 1
31+
echo 'Source: ' $source
32+
33+
# player (mpv (video), mpv (audio), sxiv, zathura)
34+
if [[ $player = "" ]]; then
35+
player=$(echo -e "mpv (video)\nmpv (audio)\nsxiv\nzathura\nfirefox" | dmenu -i -p "Player: ")
36+
fi
37+
echo "Player: $player"
38+
case "$player" in
39+
"mpv (video)") note "Playing: '$source'" && mpv "$source" ;;
40+
"mpv (audio)") note "Playing: '$source'" && st -e mpv --no-video "$source" ;;
41+
"sxiv") sxiv -rtf "$source" ;;
42+
"zathura") zathura "$source" ;;
43+
"firefox") firefox "$source" ;;
44+
esac
45+
46+
# History
47+
echo -e "$source"'\t'"$player"'\t''#'`date` >> ~/.lup_history
48+
exit 1

redownload

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
# Redownloads lud download from history
3+
4+
source=$(tail -n 10 ~/.lud_history | tac | dmenu -i -p "Resume Download: " -l 10)
5+
link=$(echo "$source" | cut -f1)
6+
dir=$(echo "$source" | cut -f2)
7+
lud "$link" "$dir"

0 commit comments

Comments
 (0)