-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpvtube
More file actions
executable file
·79 lines (72 loc) · 3.98 KB
/
mpvtube
File metadata and controls
executable file
·79 lines (72 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
#
# ############################################################################
# Project: scripts (none)
# File...: mpvtube
# Created: unknow, 2020/02/11 - 23:14:08
# Author.: @fbnmtz, fgm (fabiano.matoz@gmail.com)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Last Modified: Monday, 2024/12/09 - 17:40:18
# Modified By..: @fbnmtz, (fabiano.matoz@gmail.com)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Version: 0.5.4.563
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Description:
# > idea from elenapan, @github (https://github.com/elenapan/dotfiles)
#
# Rofi menu for playing a youtube video, playlist or stream on mpv
# Requirements:
# - youtube-dl
# - mpv
#
# The playlist file format should be as follows (example):
# Categorie - Channel Name @<some youtube url>
# ...
# Social Media - Youtube Brazil @https://www.youtube.com/channel/UCUN9lhwfMJRxMVuet7Shg0w
# ...
# You can also add single videos or live streams to the playlist file.
# It should work as long as the URL is valid.
#
# ############################################################################
# HISTORY:
#
# shellcheck disable=SC1090
source "$xSHELL_INIT"
use args utils mpvtube.lib
xrequirements mpv youtube-dl:yt-dlp rofi ddgr jq cut rev grep head sort uniq tr tac
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# define args
xarg --id --,--custom-args --var custom_args+r --desc "user arguments to player (mpv) "
xarg --id -a,--all --var action:all --desc "select item on 'channels.list' to play all videos"
xarg --id -c,--channel --var action:channel --desc "select item on 'channels.list', select channel, select video (YT only)"
xarg --id -D,--debug --var DEBUG:TRUE --desc "turn on debug flag"
xarg --id -d,--download --var action:download,url+r --desc "download video from url "
xarg --id -e,--edit --var action:edit,editor+o --desc "edit playlist with default \$EDITOR (or with <editor>)"
xarg --id -f,--fav --var action:fav --desc "select item on favourites playlist to play"
xarg --id -H,--history --var action:history --desc "select a video from history file (mpv plugin)"
xarg --id -n,--new --var action:add-channel,category+o,name+o,url+o --desc "add new channel in playlist"
xarg --id -p,--play --var action:play,url+r --desc "play given url"
xarg --id -s,--search --var action:search,query+o --desc "search query on YouTube "
xarg --id -S,--set --var property+o,value+o --desc "change runtime parameters (property;value) "
xarg --id -u,--update --var MPVTUBE_UPDATE:TRUE --desc "turn on update flag (work with --channel)"
# xhelp --footer="Available Properties:\
# \n # 'player' (mpv or vlc)\
# \n # 'selector' (rofi,fzf,terminal)\
# \n # 'playlist' (normal,reverse,random)\
# "
xrun --xreject-unknow --xrequire-one --xversionrc --xcolors "$@"
__initApp__
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# main app
# shellcheck disable=SC2154 # action is referenced but not assigned.
case "$action" in
all ) actionPlayAll ;;
add-channel) actionAddChannel "$category" "$name" "$url" ;;
channel ) actionSelectAndPlay ;;
fav ) actionFavPlay ;;
history ) actionPlayFromHistory ;;
edit ) actionEdit "$editor" ;;
play ) play "$url" ;;
search ) actionSearch "$query" ;;
download ) actionDownload "$url" ;;
esac