Skip to content

Commit e232247

Browse files
committed
updated ydlo function in bashrc.sh
1 parent 5e89afa commit e232247

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

tools/bashrc.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,13 @@ function ydlo() {
742742
local _sarg_=""
743743
local _earg_=""
744744
local _snum_=""
745+
local _bmkv_="--merge-output-format mkv"
746+
local _bmp4_="-f bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4"
745747
local _enum_=""
746748
local _rvpl_=""
747749
# default sequence and extension for playlist
748750
local _extn_='-%(playlist_index)s.%(ext)s'
749-
local _ycmd_="${_tool_} -f bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4"
751+
local _ycmd_="${_tool_}"
750752
# echo "---args: $@"
751753
for p in "$@"; do
752754
echo "# $p"
@@ -758,18 +760,30 @@ function ydlo() {
758760
if [[ $p -gt ${_snum_} ]]; then _enum_="$p";
759761
else
760762
_enum_=$((${_snum_} + $p - 1)); fi; fi
763+
elif [[ "$p" =~ ^[/-]{1,2}mkv ]]; then
764+
_ycmd_="${_tool_} ${_bmkv_}"
765+
elif [[ "$p" =~ ^[/-]{1,2}mp4 ]]; then
766+
_ycmd_="${_tool_} ${_bmp4_}"
761767
elif [[ "$p" =~ ^[/-]{1,2}[rR] ]]; then
762768
_rvpl_="--playlist-reverse"
763769
else
764770
_name_="$p"
765771
fi
766772
done
767773

768-
if [[ "${_href_}" == "" ]]; then return; fi
774+
if [[ "${_href_}" == "" ]]; then
775+
echo "┏━━━━━━━━┓"
776+
echo "┃ Syntax ┃"
777+
echo "┗━━━━━━━━┛"
778+
echo " ${FUNCNAME[0]} [-r] [-mkv|mp4] <http_url> [<start#> [<end#>]]"
779+
echo ""
780+
return
781+
fi
769782

770783
echo "----------"
771784
echo " name: ${_name_}"
772785
echo " href: ${_href_}"
786+
echo " args: ${_ycmd_} ${_rvpl_}"
773787
if [[ "${_href_}" =~ playlist ]]; then
774788
if [[ "${_name_}" =~ .*"-".* ]]; then
775789
_extn_='%(playlist_index)s.%(ext)s'

0 commit comments

Comments
 (0)