[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: recommend music player?



황병희 wrote:

> Personally my computer is chromebook. I installed Debian 11
> Bullseye inside chromebook. In that case, YouTube is very
> useful music player. Ok man sorry for off-topic music
> player. Though YouTube is so awesome, at least, to me ...

Uhm ... YouTube?!

While YouTube is a great _database_ for multimedia, the
interface is usually what people dislike about it.

Compared to mpv ... yeah, it is a toy.

But: Here [last] are a bunch of commands that can help you get
the material, or a bunch of material actually, from a single
search string ...

This will give you, hopefully, what is good about YouTube so
you can then combine it with that is awesome about mpv and get
the best of both worlds.

Test with, e.g. this awesome video:

  https://www.youtube.com/watch?v=SdL55HWNPRM

#! /dev/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/dl

dl_resume=".dl"

dl-resume () {
    if [[ -f $dl_resume ]]; then
        rtorrent $(cat $dl_resume)
    else
        echo "Cannot resume, no $dl_resume file" >&2
    fi
}

dl () {
    local urls=${1:-$(<$DL_FILE)}

    if [[ $urls == magnet* ]]; then
        echo $urls > $dl_resume
        rtorrent ${=urls}
    elif [[ $urls == http* ]]; then
        dl-both $urls
    fi
}

dlp_opts=(-i -q --no-colors --no-warnings)

dl-both () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts ${=urls}
}

dl-video () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo' ${=urls}
}

dl-audio () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestaudio' ${=urls}
}

dl-1080-up () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height>=1080]+bestaudio' ${=urls}
}

dl-720-up () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height>=720]+bestaudio' ${=urls}
}

dl-2160 () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height=2160]+bestaudio' ${=urls}
}

dl-1080 () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height=1080]+bestaudio' ${=urls}
}

dl-720 () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height=720]+bestaudio' ${=urls}
}

dl-2160-video () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height=2160]' ${=urls}
}

dl-1080-up-video () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height>=1080]' ${=urls}
}

dl-720-up-video () {
    local urls=${1:-$(<$DL_FILE)}
    yt-dlp $dlp_opts -f 'bestvideo[height>=720]' ${=urls}
}

dl-all () {
    local fun=$1
    shift
    local search=$@

    local name=$funcstack[1]
    local file=.${name}-str.txt

    if [[ $fun == 'cat' ]]; then
        cat $file
    else
        echo $search >> $file

        local hits=$(printf '%s\t%s\r\n' /youtube.cgi $search |
                     nc git.codemadness.org 70                |
                     awk -F '\t' '/^h.*embed/ { sub("URL:", "", $2); print $2 }')
        $fun $hits
    fi
}
alias dac='dl-all cat'

dl-all-1080-up () {
    local search=$@
    dl-all dl-1080-up $search
}
alias da=dl-all-1080-up

dl-all-720-up () {
    local search=$@
    dl-all dl-720-up $search
}

dl-all-both () {
    local search=$@
    dl-all dl-both $search
}

dl-all-2160-video () {
    local search=$@
    dl-all dl-2160-video $search
}
alias dl-all-4k-video=dl-all-2160-video

dl-all-2160 () {
    local search=$@
    dl-all dl-2160 $search
}
alias dl-all-4k=dl-all-2160

dl-all-1080 () {
    local search=$@
    dl-all dl-1080 $search
}

dl-all-720 () {
    local search=$@
    dl-all dl-720 $search
}

dl-all-1080-up-video () {
    local search=$@
    dl-all dl-1080-up-video $search
}

dl-all-720-up-video () {
    local search=$@
    dl-all dl-720-up-video $search
}

dl-up-down () {
    local search=$@
    dl-all dl-2160 $search
    dl-all dl-1080 $search
    dl-all dl-720  $search
}

dl-all-video () {
    local search=$@
    dl-all dl-video $search
}

dl-all-audio () {
    local search=$@
    dl-all dl-audio $search
}
alias daa=dl-all-audio

dl-music () {
    local songs=($@)

    local s
    local hit
    for s in $songs; do
        hit=$(printf '%s\t%s\r\n' /youtube.cgi $s |
              nc git.codemadness.org 70           |
              head -n 1                           |
              awk -F '\t' '/^h.*embed/ { sub("URL:", "", $2); print $2 }')
        dl-audio $hit
    done
}

-- 
underground experts united
https://dataswamp.org/~incal


Reply to: