Thanks for the tip, it may come in handy when I decide to save the session

Or maybe I should make /home/guest/.local/share/applications/ a symlink to a directory on the flash memory



Post#16 by vinnie » 01 Feb 2025, 10:58
Thanks for the tip, it may come in handy when I decide to save the session
vinnie
Post#17 by Jack » 01 Feb 2025, 16:10
I learn something new so now I know.ncmprhnsbl wrote: ↑01 Feb 2025, 05:23aarch64 is for ARM based hardware, that is, smartphones, tablets, raspberrypi and the like. is why the "Exec format error".
look for x86_64 packages.
Jack
Post#18 by vinnie » 03 Feb 2025, 13:16
Code: Select all
#!/bin/bash
#PATH TO yt-dlp EXECUTABLE
YTDLP="/home/guest/Downloads/ytdlp" #absolute path
down_dir="/home/guest/Downloads"
#yt-dlp relative to script variant
#start_dir="$(pwd)"
#script_dir="$(dirname ${0})"
#YTDLP="${script_dir}/ytdlp" #relative to script position
#INPUT LINK
dialog --inputbox "Enter link (ctrl+shift+v to paste):" 10 40 2> /tmp/input.txt
LINK="$( cat /tmp/input.txt )" # release contents of pipe
#LINK=$(xclip -o) #directly from clipboard variant
#LOAD FORMAT LIST
reset
echo "Retrieving link info, wait..."
OUTP=$($YTDLP -F "${LINK}") || exit
OUTP=$(echo -e "${OUTP}" | grep -v '^\[' | cut -c 1-50 | tail -n +3) # || (echo "error"; exit) # | tr " " "_")
#CHOOSE FORMAT
let i=0 # define counting variable
W=() # define working array
while read -r line; do # process line by line
let i=$i+1
W+=($i "$line")
done < <( echo -e "${OUTP}" )
FILE=$(dialog --title "available formats" --menu "______ID______EXT___RESOLUTION_FPS_CH_|___FILESIZE___TBR__" 24 62 17 "${W[@]}" 3>&2 2>&1 1>&3) # show dialog and store output
RESULT=$?
clear
if [ $RESULT -eq 0 ]; then # Exit with OK
#echo "${W[$((FILE * 2 -1))]}"
CHOS=$(echo "${W[$((FILE * 2 -1))]}")
NUMB=$(echo "${CHOS}" | cut -d " " -f1)
else
exit
fi
#DOWLOAD VIDEO
echo -e "Donwload: ${CHOS}"
cd "$down_dir"
$YTDLP -f "${NUMB}" "${LINK}"
vinnie
Post#19 by Jack » 03 Feb 2025, 16:04
Code: Select all
Retrieving link info, wait...
ERROR: [generic] 'ownloads/ytdlp: Is a directory' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:ownloads/ytdlp: Is a directory" ) to search YouTube
guest@porteus:~/Documents$
Jack
Post#20 by vinnie » 03 Feb 2025, 16:32
Code: Select all
[guest@porteus Downloads]$ ./ytdlp /home/guest/Downloads/ytdlp
[generic] Extracting URL: /home/guest/Downloads/ytdlp
ERROR: [generic] '/home/guest/Downloads/ytdlp' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:/home/guest/Downloads/ytdlp" ) to search YouTube
vinnie
Post#21 by Jack » 03 Feb 2025, 16:50
Code: Select all
PATH TO yt-dlp EXECUTABLE
YTDLP="yt-dlp" #absolute path
down_dir="/home/guest/Downloads/ytdlp"
#yt-dlp relative to script variant
#start_dir="$(pwd)"
#script_dir="$(dirname ${0})"
#YTDLP="${script_dir}/ytdlp" #relative to script position
Code: Select all
Retrieving link info, wait...
ERROR: [generic] 'Retrieving link info, wait...' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:Retrieving link info, wait..." ) to search YouTube
guest@porteus:~/Documents$ ERROR: [generic] 'ownloads/ytdlp: Is a directory' is not a valid URL. Set --default-search "ytsearch" (or run yt-dlp "ytsearch:ownloads/ytdlp: Is a directory" ) to search YouTube
bash: syntax error near unexpected token `('
guest@porteus:~/Documents$
Jack
Post#22 by vinnie » 03 Feb 2025, 17:28
Code: Select all
wget https://oshi.at/bXCn/ytdialog.sh
Code: Select all
chmod +x ytdialog.sh
vinnie
Post#23 by Jack » 03 Feb 2025, 19:34
Jack
Post#24 by vinnie » 03 Feb 2025, 23:10
vinnie
Post#25 by vinnie » 09 Feb 2025, 02:23
Code: Select all
#!/bin/bash
function myfun() {
#YT-DLP PATH
YTDLP="./ytdlp"
#INPUT LINK
#LINK=$(xclip -o) #directly from clipboard
dialog --extra-button --extra-label "clipboard" --inputbox "Enter link (ctrl+shift+v to paste or shift+insert):" 10 40 2> /tmp/input.txt
EXIT="$?" #0 ok, 3 clipboard, 1 cancel
LINK="$( cat /tmp/input.txt )" # release contents of pipe
#CHECK IF LINK IS POPULATED OR EXIT
if [[ "$EXIT" -eq 1 ]]; then
exit
elif [[ "$EXIT" -eq 3 ]]; then
LINK=$(xclip -o) #directly from clipboard
fi
if [ -z "${LINK}" ]; then exit; fi
#LOAD FORMAT LIST
reset
echo -e "\"${LINK}\" \nRetrieving info, wait..."
#dialog --pause "Retrieving link info, wait..." 10 40 0
OUTP=$($YTDLP -F -S tbr "${LINK}") || exit #size not work prpperly
OUTP=$(echo -e "${OUTP}" | grep -v '^\[' | cut -c 1-72 | tail -n +3) # || (echo "error"; exit) # | tr " " "_")
#OUTP=$(echo -e "${OUTP}" | tail -n +3)
#SEPARATE AUDIO AND VIDEO IN ARRAYS
#LENG=$(echo "${OUTP}" | wc -l)
#HEAD=$(echo -e ${OUTP} | head -n 1)
#HEAD=" ID EXT RESOLUTION FPS CH | FILESIZE TBR"
let ia=0 # audio index counter
let iv=0 # video index counter
A=() # audio array #A+=(0 "nothing")
V=() # video array #V+=(0 "nothing")
#separate audio line from video and remove images
while read -r line; do # process line by line
if [[ $line == *"images"* ]]; then
continue
elif [[ $line == *"audio only"* ]]; then
let ia=$ia+1
A+=(" $ia" "$line")
else
let iv=$iv+1
V+=(" $iv" "$line")
fi
done < <( echo -e "${OUTP}" )
#CHOSE FORMATS
#"______ID______EXT___RESOLUTION_FPS_CH_|___FILESIZE___TBR__"
AFILE=$(dialog --title "Choose Audio" --menu "" 25 62 0 "${A[@]}" 3>&2 2>&1 1>&3) # show dialog and store output
ARESULT=$?
clear
VFILE=$(dialog --title "Choose Video" --menu "" 25 62 0 "${V[@]}" 3>&2 2>&1 1>&3) # show dialog and store output
VRESULT=$?
clear
#TAKE ID
if [ $ARESULT -eq 0 ] || [ $VRESULT -eq 0 ]; then # Exit with OK
#echo "${W[$((FILE * 2 -1))]}"
if [ $ARESULT -eq 0 ]; then
ACHOS=$(echo "${A[$((AFILE * 2 -1))]}")
ANUMB=$(echo "${ACHOS}" | cut -d " " -f1)
fi
if [ $VRESULT -eq 0 ]; then
VCHOS=$(echo "${V[$((VFILE * 2 -1))]}")
VNUMB=$(echo "${VCHOS}" | cut -d " " -f1)
fi
else
exit
fi
#DOWLOAD MEDIA
if [ $ARESULT -ne 0 ]; then #without audio
echo -e "Donwload video: ${VNUMB}"
$YTDLP -f "${VNUMB}" "${LINK}"
elif [ $VRESULT -ne 0 ]; then #without video
echo -e "Donwload audio: ${ANUMB}"
$YTDLP -f "${ANUMB}" "${LINK}"
else #have both
echo -e "Donwload video + audio: ${ANUMB} + ${VNUMB}"
$YTDLP -f "${ANUMB}"+"${VNUMB}" "${LINK}" --merge-output-format mp4
fi
}
#RUN SCRIPT
#in this way it's possible to run this script with double click or launch it without specify a terminal for shortcut execution
#xfce4-terminal -e "$(typeset -f myfun) #don't work with xfce4-terminal
export -f myfun
xterm -geometry 64x26 -ls -xrm 'XTerm*selectToClipboard: true' -e "$(declare -f myfun);myfun" &
vinnie