aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-01-18 06:29:02 -0800
committerFuwn <[email protected]>2024-01-18 06:29:02 -0800
commit7029604ead16c559cc1f4d43c92750da4dd4f800 (patch)
treead4c1ef7a0048ee0fec7329522eb32b3e0ef7af5 /src
parentdocs(readme): update description (diff)
downloadtama-7029604ead16c559cc1f4d43c92750da4dd4f800.tar.xz
tama-7029604ead16c559cc1f4d43c92750da4dd4f800.zip
feat(watch): local streaming
Diffstat (limited to 'src')
-rw-r--r--src/bashly.yml11
-rw-r--r--src/watch_command.sh10
2 files changed, 19 insertions, 2 deletions
diff --git a/src/bashly.yml b/src/bashly.yml
index db88e52..1b0e954 100644
--- a/src/bashly.yml
+++ b/src/bashly.yml
@@ -30,7 +30,16 @@ commands:
required: true
help: Episode to watch
help: Watch an anime by episode
- dependencies: [xdg-open]
+ dependencies: [xdg-open, base64]
+ flags:
+ - long: --browser
+ short: -b
+ help: Open the stream in your browser instead of a local video player
+ - long: --player
+ short: -p
+ arg: player
+ help: Override mpv as the local video player
+ default: mpv
- name: episodes
alias: e
args:
diff --git a/src/watch_command.sh b/src/watch_command.sh
index 6c94bf0..0d42267 100644
--- a/src/watch_command.sh
+++ b/src/watch_command.sh
@@ -1,4 +1,12 @@
-xdg-open "$(get "/stream/$(get "/episodes/${args[id]}" |
+PLAYER="$(get "/stream/$(get "/episodes/${args[id]}" |
jq -r ".[] | .id" |
head -n 1 |
sed -E 's/-episode-[0-9]+$//')-episode-1" | jq -r ".plyr.default")"
+
+if [[ -n "${args[--browser]}" ]]; then
+ xdg-open "${PLAYER}"
+else
+ "${args[--player]}" "$(echo "${PLAYER}" |
+ sed -E 's/.*#//' |
+ base64 --decode)"
+fi