diff options
author | Mubashshir | 2022-02-24 17:54:39 +0600 |
---|---|---|
committer | Mubashshir | 2022-02-24 18:20:23 +0600 |
commit | b77861c5a76d0c61d8284c16c603c024384b3fb3 (patch) | |
tree | c3676ba0246f1d6779dac39708b09e929c348ccd | |
parent | a8f5c42908e957d7a777a4705aecd545d2561748 (diff) | |
download | aur-b77861c5a76d0c61d8284c16c603c024384b3fb3.tar.gz |
trakt-scrobbler: Release 1.4.0-1
upstream release
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | trakts.zsh | 387 |
3 files changed, 223 insertions, 178 deletions
@@ -1,6 +1,6 @@ pkgbase = trakt-scrobbler pkgdesc = Automatically scrobble TV show episodes and movies you are watching to Trakt.tv! It keeps a history of everything you've watched! - pkgver = 1.3.2 + pkgver = 1.4.0 pkgrel = 1 url = https://github.com/iamkroot/trakt-scrobbler arch = any @@ -26,11 +26,11 @@ pkgbase = trakt-scrobbler depends = python-jeepney>=0.7 depends = python-urlmatch<2.0.0 depends = python-urlmatch>=1.0.1 - source = trakt-scrobbler-1.3.2.tar.gz::https://files.pythonhosted.org/packages/source/t/trakt-scrobbler/trakt-scrobbler-1.3.2.tar.gz + source = trakt-scrobbler-1.4.0.tar.gz::https://files.pythonhosted.org/packages/source/t/trakt-scrobbler/trakt-scrobbler-1.4.0.tar.gz source = trakts-man.md source = trakts.zsh - sha256sums = 27036439b91fbf7ae784f127d438ddedb1ca9951765a6e630b85bc5dfd299b2d + sha256sums = 9580273b67151d5d38a4bda64c7047a1e54f77f39870bdd51d44c47d2fa99c1f sha256sums = 81c3fb93bf01c0e6c0bbc9b2ef853da3f691bc3c50b4a87a68072b11ba72691c - sha256sums = 6b6c3f55ab153a9dc749e67acd6e091b5d1e9e35c3b51af4d2f1c687e8c8fab8 + sha256sums = 65442f8b6263da1f856bd74b2f9d49a5f8b1a5d9e0dc15927b1f40804ad99528 pkgname = trakt-scrobbler @@ -4,7 +4,7 @@ # deps: pyproject pkgname=trakt-scrobbler -pkgver=1.3.2 +pkgver=1.4.0 pkgrel=1 pkgdesc="Automatically scrobble TV show episodes and movies you are watching to Trakt.tv! It keeps a history of everything you've watched!" @@ -42,9 +42,9 @@ source=( "trakts-man.md" "trakts.zsh" ) -sha256sums=('27036439b91fbf7ae784f127d438ddedb1ca9951765a6e630b85bc5dfd299b2d' +sha256sums=('9580273b67151d5d38a4bda64c7047a1e54f77f39870bdd51d44c47d2fa99c1f' '81c3fb93bf01c0e6c0bbc9b2ef853da3f691bc3c50b4a87a68072b11ba72691c' - '6b6c3f55ab153a9dc749e67acd6e091b5d1e9e35c3b51af4d2f1c687e8c8fab8') + '65442f8b6263da1f856bd74b2f9d49a5f8b1a5d9e0dc15927b1f40804ad99528') prepare() { cd "$srcdir/$pkgname-$pkgver" diff --git a/trakts.zsh b/trakts.zsh index 038b11eae069..4f7edc990d4a 100644 --- a/trakts.zsh +++ b/trakts.zsh @@ -2,187 +2,230 @@ # # Zsh auto complete function for trakts # +# shellcheck shell=bash +# shellcheck disable=SC2168 -# Section: trakts autostart -_trakts_autostart_actions() +## Section @globals ## +_trakts_args() { + local -a options + options=( + {-h,--help}"[Display help message]" + "(-v --verbose)"{-q,--quiet}"[Do not output any message]" + "(-q --quiet)"{-v,--verbose}"[Increase the verbosity of messages]" + {-V,--version}"[Display this application version]" + {-n,--no-interaction}"[Do not ask any interactive question]" + "(--no-ansi)--ansi[Force ANSI output]" + "(--ansi)--no-ansi[Disable ANSI output]" + ) + [[ $1 == opts ]] && set "$@" ': :' && shift + _arguments "${options[@]}" "$@" +} +__trakts_debug() { + # shellcheck disable=SC2059 + if [[ -e ~/pipe:comp ]];then + printf "$@" > ~/pipe:comp + printf '\n' > ~/pipe:comp + fi +} + +_trakts_finish() { + _message 'no more arguments' +} +## endSection @globals ## + +## Section @simpleCommands ## +### command auth +_trakts_auth() { + _trakts_args opts -s '-f[Force run the flow]' +} +### command init +_trakts_init() +{ + _trakts_args opts +} +### command plex +_trakts_plex() +{ + _trakts_args \ + -{f,-force}'[Force run the flow, ignoring already existing credentials]' \ + -{t,-token}'[Enter plex token directly instead of password. Implies -f]' +} +### command run +_trakts_run() +{ + _trakts_args opts +} +### command start +_trakts_start() { - local actions - actions=( + _trakts_args opts -s {-r,--restart}'[Restart the service]' +} +### command status +_trakts_status() +{ + _trakts_args opts +} +### command stop +_trakts_stop() +{ + _trakts_args opts +} +## Section @simpleCommands ## + +## Section autostart ## +_trakts_autostart_commands() +{ + local commands + commands=( "enable:Install and enable the autostart service" "disable:Disable the autostart service" ) - _describe 'actions' actions + _describe 'commands' commands } -# command: trakts autostart +### command autostart _trakts_autostart() { - _arguments '1:action:_trakts_autostart_actions' + _trakts_args -s ':action:_trakts_autostart_commands' } -# Section: trakts backlog -_trakts_backlog_actions() +### command autostart enable +_trakts_autostart_enable() { + _trakts_args opts +} +### command autostart disable +_trakts_autostart_disable() { + _trakts_args opts +} +## endSection autostart ## + +## Section backlog ## +_trakts_backlog_commands() { - local actions - actions=( + local commands + commands=( "clear:Try to sync the backlog with trakt servers" "list:List the files in backlog" ) - _describe 'actions' actions + _describe 'commands' commands } -# command: trakts backlog +### command backlog _trakts_backlog() { - _arguments '1:action:_trakts_backlog_actions' + _trakts_args -s ':action:_trakts_backlog_commands' } +## endSection backlog ## -# Section: trakts config -_trakts_config_actions() +## Section config ## +_trakts_config_commands() { - local actions - actions=( + local commands + commands=( 'list:List configuration settings' 'set:Set the value for a config parameter' 'unset:Reset a config value to its default' ) - _describe 'actions' actions + _describe 'commands' commands +} +_trakts_config_keys() +{ + local keys + # shellcheck disable=SC2034,SC2296 + keys=("${(@f)"$(trakts config list --all|cut -d\ -f1)"}") + _describe 'keys' keys } -# command: trakts config +### command config _trakts_config() { - local args line - args=( - '1:action:_trakts_config_actions' - '*::arg:->args' - ) - _arguments -s "${args[@]}" - case $line[1] in - (list) - _arguments '--all[Include default values]' - ;; - (set) - _trakts_config_set "$@" - ;; - (unset) - _trakts_config_list "$@" - ;; - esac -} -# command: trakts config set + _trakts_args '1:action:_trakts_config_commands' +} +### command config set _trakts_config_set() { - local args - args=( - '1:key:_trakts_config_list' - '2:value:' - '--add[Append to list instead of overwriting]' - ) - _arguments -s "${args[@]}" + _trakts_args \ + '--add[Append to list instead of overwriting]' \ + '2:key:_trakts_config_keys' \ + '*:value:' } -# command: trakts config list +### command config list _trakts_config_list() { - local keys - keys=( - $(trakts config list --all|cut -d\ -f1) - ) - _describe 'keys' keys + _trakts_args opts '--all[Include default values]' } - -# Section: trakts init -_trakts_init_actions() -{ - true -} -# command: trakts init -_trakts_init() +### command config unset +_trakts_config_unset() { - _arguments '1:action:_trakts_init_actions' + _trakts_config_keys "$@" } -# no subcommand or options provided +## endSection config ## -# Section: trakts log -_trakts_log_actions() +## Section log ## +_trakts_log_commands() { - local actions - actions=( + local commands + commands=( 'open:Open Latest log.' 'path:Prints the location of the log file' ) - _describe 'actions' actions + _describe 'commands' commands } -# command: trakts log +### command log _trakts_log() { - _arguments '1:action:_trakts_log_actions' -} - -# Section: trakts plex -# command: trakts plex -_trakts_plex() -{ - _arguments -s '-f[Force run the flow]' -} - -# Section: trakts run -# command: trakts run -_trakts_run() -{ - true + _trakts_args '1:action:_trakts_log_commands' } +## endSection log ## -# Section: trakts start -# command: trakts start -_trakts_start() -{ - _arguments -s {-r,--restart}'[Restart the service]' -} - -# Section: trakts status -# command: trakts status -_trakts_status() -{ - true -} - -# Section: trakts stop -# command: trakts stop -_trakts_stop() +## Section lookup ## +### command lookup +_trakts_lookup() { - true + local -a opts + opts=( + '--type[Type of media (show/movie) (multiple values allowed)]:type:' + -s '--year[Specific year]:year:' + -s '--brief[Only print trakt ID of top result]' + -s '--limit[Number of results to fetch per page (default: 3)]:limit:' + -s '--page[Number of page of results to fetch (default: 1)]:page:' + '*:name:' + ) + _trakts_args "${opts[@]}" } +## endSection lookup ## -# Section: trakts whitelist -_trakts_whitelist_actions() +## Section whitelist ## +_trakts_whitelist_commands() { - local actions - actions=( + local commands + commands=( 'add:Add folder(s) to whitelist' 'remove:Remove folder(s) from whitelist' 'show:Show the current whitelist' 'test:Check whether the given file/folder is whitelisted' ) - _describe 'actions' actions + _describe 'commands' commands } -# command: trakts whitelist +### command whitelist _trakts_whitelist() { - local line state - _arguments '1:action:_trakts_whitelist_actions' '::path:->path' - case $line[1] in - (add) - _path_files -/ - ;; - (test) - _path_files - ;; - (*) true;; - esac + _trakts_args ':action:_trakts_whitelist_commands' +} +### command whitelist add +_trakts_whitelist_add() +{ + _trakts_args '2:path:_tilde_files -/' +} +### command whitelist test +_trakts_whitelist_test() +{ + _trakts_args '2:path:_tilde_files' } +## endSection whitelist ## -# Section: trakts -_trakts_actions() +## Section @main ## +_trakts_commands() { - local state actions - actions=( + local commands + # shellcheck disable=SC2034 + commands=( "auth:Runs the authetication flow for trakt.tv" "autostart:Controls the autostart behaviour of the scrobbler" "backlog:Manage the not-yet-synced backlog of watched media" @@ -190,6 +233,7 @@ _trakts_actions() "help:Display the manual of a command" "init:Run the initial setup of the scrobble" "log:Access the log file" + "lookup:Performs a search for the given media title" "plex:Run the authetication flow for plex media server" "run:Run the scrobbler in the foreground" "start:Start the trakt-scrobbler service" @@ -197,56 +241,57 @@ _trakts_actions() "stop:Stop the trakt-scrobbler service" "whitelist:Add the given folder(s) to whitelist" ) - _describe 'actions' actions + _describe 'commands' commands +} + +_trakts_arguments() { + # shellcheck disable=SC1087,SC1105,SC2211,SC2288,SC2086 + case $line[1] in + (help) + local cmdfunc shifted + cmdfunc=$(printf '_%s' "${line[@]:1:-1}") shifted=0 + if [[ $cmdfunc != _ ]] ;then + until [[ $cmdfunc == _ ]] || ((shifted++));do + if (( $+functions[_trakts${cmdfunc}_commands] ));then + "_trakts${cmdfunc}_commands" "$@" + return + fi + cmdfunc=$cmdfunc:gs+_+/+:h:gs+/+_+ + done + _trakts_finish + else + _trakts_commands + fi + ;; + (*) + local cmdfunc + cmdfunc=$( + for word in $line;do + [[ ${word:0:1} == - ]] && break + printf '_%s' "$word" + done + ) + if [[ $cmdfunc != _ ]] ;then + until [[ $cmdfunc == _ ]];do + if (( $+functions[_trakts$cmdfunc] ));then + "_trakts$cmdfunc" "$@" + break + fi + cmdfunc=$cmdfunc:gs+_+/+:h:gs+/+_+ + done + else + _trakts_finish + fi + ;; + esac } -# command: trakts + +### command trakts local line args args=( - "1:actions:_trakts_actions" - {-h,--help}"[Display help message]" - {-q,--quiet}"[Do not output any message]" - {-v,--verbose}"[Increase the verbosity of messages]" - {-V,--version}"[Display this application version]" - {-n,--no-interaction}"[Do not ask any interactive question]" - "--ansi[Force ANSI output]" - "--no-ansi[Disable ANSI output]" - "*::arg:->args" + "1:commands:_trakts_commands" + "*::arguments:_trakts_arguments" ) -_arguments -s "${args[@]}" -case $line[1] in - (help) - case $CURRENT in - (2) - _trakts_actions "$@" - ;; - (3) - if [ -n "$functions[_trakts_$line[2]_actions]" ];then - _trakts_$line[2]_actions "$@" - fi - ;; - (4) - if [ -n "$functions[_trakts_$line[2]_$line[3]_actions]" ];then - _trakts_$line[2]_$line[3]_actions "$@" - fi - ;; - (5) - if [ -n "$functions[_trakts_$line[2]_$line[3]_$line[4]_actions]" ];then - _trakts_$line[2]_$line[3]_$line[4]_actions "$@" - fi - ;; - (6) - if [ -n "$functions[_trakts_$line[2]_$line[3]_$line[4]_$line[5]_actions]" ];then - _trakts_$line[2]_$line[3]_$line[4]_$line[5]_actions "$@" - fi - ;; - esac - ;; - (auth) - _arguments '-f[Force run the flow]' - ;; - (*) - if [ -n "$functions[_trakts_$line[1]]" ] ;then - _trakts_$line[1] "$@" - fi - ;; -esac +_trakts_args "${args[@]}" +## endSection @main ## +# vim: ft=sh:ts=4:noet: |