summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMubashshir2021-01-17 22:55:33 +0600
committerMubashshir2021-01-17 22:55:33 +0600
commitcb966a298dd63e56a221feb1eae8501736cf1ffe (patch)
treee0fb110de4e52533641de99bb988db09837b629f
downloadaur-cb966a298dd63e56a221feb1eae8501736cf1ffe.tar.gz
init
-rw-r--r--.SRCINFO38
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD73
-rw-r--r--trakts-man.md140
-rw-r--r--trakts.zsh252
5 files changed, 508 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..630642851798
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,38 @@
+pkgbase = trakt-scrobbler-git
+ pkgdesc = Automatically scrobble TV show episodes and movies you are watching to Trakt.tv! It keeps a history of everything you've watched!
+ pkgver = v1.2.0.r5.g9cb6a06
+ pkgrel = 1
+ url = https://github.com/iamkroot/trakt-scrobbler
+ arch = any
+ license = GPL2
+ makedepends = git
+ makedepends = python-setuptools
+ makedepends = python-dephell
+ makedepends = go-md2man
+ makedepends = gzip
+ makedepends = sed
+ makedepends = awk
+ depends = systemd
+ depends = python-appdirs<2
+ depends = python-appdirs>=1.4.3
+ depends = python-cleo<1
+ depends = python-cleo>=0.7.6
+ depends = python-confuse<2
+ depends = python-confuse>=1.3.0
+ depends = python-guessit<4
+ depends = python-guessit>=3.1.0
+ depends = python-jeepney<1
+ depends = python-jeepney>=0.6.0
+ depends = python-pysocks<2
+ depends = python-pysocks>=1.7.1
+ depends = python-requests<3
+ depends = python-requests>=2.22.0
+ source = trakt-scrobbler::git+https://github.com/iamkroot/trakt-scrobbler.git
+ source = trakts-man.md
+ source = trakts.zsh
+ sha256sums = SKIP
+ sha256sums = 81c3fb93bf01c0e6c0bbc9b2ef853da3f691bc3c50b4a87a68072b11ba72691c
+ sha256sums = 6b6c3f55ab153a9dc749e67acd6e091b5d1e9e35c3b51af4d2f1c687e8c8fab8
+
+pkgname = trakt-scrobbler-git
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..9c83afc3c831
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*
+!.SRCINFO
+!PKGBUILD
+!trakts-man.md
+!trakts.zsh
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..946268bdd5ad
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,73 @@
+# Maintainer: Mubashshir <ahmubashshir@gmail.com>
+# pkg: git
+pkgname=trakt-scrobbler-git
+pkgver=v1.2.0.r5.g9cb6a06
+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!"
+
+arch=(any)
+url=https://github.com/iamkroot/trakt-scrobbler
+license=(GPL2)
+depends=(
+ "systemd"
+ "python-appdirs<2"
+ "python-appdirs>=1.4.3"
+ "python-cleo<1"
+ "python-cleo>=0.7.6"
+ "python-confuse<2"
+ "python-confuse>=1.3.0"
+ "python-guessit<4"
+ "python-guessit>=3.1.0"
+ "python-jeepney<1"
+ "python-jeepney>=0.6.0"
+ "python-pysocks<2"
+ "python-pysocks>=1.7.1"
+ "python-requests<3"
+ "python-requests>=2.22.0"
+)
+makedepends=(
+ git
+ python-setuptools
+ python-dephell
+ go-md2man
+ gzip
+ sed
+ awk
+)
+
+source=(
+ "${pkgname%*-git}::git+https://github.com/iamkroot/trakt-scrobbler.git"
+ "trakts-man.md"
+ "trakts.zsh"
+)
+sha256sums=('SKIP'
+ '81c3fb93bf01c0e6c0bbc9b2ef853da3f691bc3c50b4a87a68072b11ba72691c'
+ '6b6c3f55ab153a9dc749e67acd6e091b5d1e9e35c3b51af4d2f1c687e8c8fab8')
+
+pkgver() {
+ cd ${pkgname%*-git}
+ (
+ set -o pipefail
+ git describe --tags --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+ )
+}
+
+prepare() {
+ cd "${pkgname%*-git}"
+ dephell deps convert --from pyproject.toml --to setup.py
+}
+
+build() {
+ cd "$srcdir/${pkgname%*-git}"
+ python setup.py build
+ go-md2man -in "$srcdir/trakts-man.md" 2>/dev/null|gzip -n > trakts.1.gz
+}
+
+package()
+{
+ cd "$srcdir/${pkgname%*-git}"
+ python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+ install -Dm644 "trakts.1.gz" "$pkgdir/usr/share/man/man1/trakts.1.gz"
+ install -Dm755 "$srcdir/trakts.zsh" "$pkgdir/usr/share/zsh/site-functions/_trakts"
+}
diff --git a/trakts-man.md b/trakts-man.md
new file mode 100644
index 000000000000..1bfcebb87735
--- /dev/null
+++ b/trakts-man.md
@@ -0,0 +1,140 @@
+% TRAKTS(1) trakt-scrobbler User Manual
+# NAME
+
+trakts - a trakt.tv scrobbler for vlc, plex, mpv, mpc-be/mpc-hc.
+
+# SYNOPSIS
+
+ `trakts` [*OPTION...*] \<command> [args]
+
+# DESCRIPTION
+
+Trakt.tv has a lot of [plugins](https://trakt.tv/apps) to automatically scrobble the movies and episodes you watch from your media center. But there is a dearth of up-to-date apps for syncing your progress on Desktop environments. This is where `trakt-scrobbler` comes in! It is a Python application that runs in the background and monitors your media players for any new activity. When it detects some file being played, it determines the media info (such as name of the movie/show, episode number, etc.) and sends this to trakt servers, so that it can be marked as "Currently Watching" on your profile. No manual intervention required!
+
+# COMMANDS
+`auth`
+: Runs the authetication flow for trakt.tv
+
+`autostart`
+: Controls the autostart behaviour of the scrobbler
+
+`backlog`
+: Manage the backlog of watched media that haven't been synced with trakt servers yet
+
+`config`
+: Edits the scrobbler config settings
+
+`help`
+: Display the manual of a command
+
+`init`
+: Runs the initial setup of the scrobbler
+
+`log`
+: Access the log file, mainly for debugging purposes
+
+`plex`
+: Runs the authetication flow for plex media server.
+
+`run`
+: Run the scrobbler in the foreground
+
+`start`
+: Starts the trakt-scrobbler service. If already running, does nothing
+
+`status`
+: Shows the status trakt-scrobbler service
+
+
+`stop`
+: Stops the trakt-scrobbler service
+
+`whitelist`
+: Adds the given folder(s) to whitelist
+
+# GLOBAL OPTIONS
+
+`-h`, `--help`
+: Display this help message
+
+`-q`, `--quiet`
+: Do not output any message
+
+`-v`, `--verbose`
+: Increase the verbosity of messages: "-v" for normal output,"-vv" for more verbose output and "-vvv" for debug
+
+`-V`, `--version`
+: Display this application version
+
+`--ansi`, `--no-ansi`
+: Force/Disable ANSI output
+
+`-n`, `--no-interaction`
+: Do not ask any interactive question
+
+# COMMANDS SECTION
+
+`auth` [-f]
+: `-f` Force run the flow, ignoring already existing credentials
+
+`autostart` \<enable|disable>
+ `enable` Installs and enables the autostart service
+ `disable` Disables the autostart service
+
+`backlog` \<list|clear>
+ `clear` Try to sync the backlog with trakt servers
+ `list` List the files in backlog
+
+`config` list [--all]
+ `list` Lists configuration settings. By default,
+ only overriden values are shown
+ `--all` Include default values too
+
+`config` set [--add] \<key> \<value1> ... [<valueN>]
+ `set` Set the value for a config parameter.
+ Separate multiple values with spaces.
+ For values containing space(s),
+ surround them with double-quotes
+
+ <key> Config parameter
+ <value> Setting value
+ --add In case of list values, add them to the end
+ instead of overwriting
+ Eg:
+ $ trakts config set players.monitored mpv vlc mpc-be
+ will set: players.monitored = ['mpv', 'vlc' ]
+ $ trakts config set --add players.monitored plex mpc-hc
+ will add: players.monitored = ['mpv', 'vlc', 'plex', 'mpc-hc]
+
+`config` unset \<key>
+ `unset` Reset a config value to its default
+ \<key> Config parameter
+
+`help` [\<command1>] ... [\<commandN>]
+ \<command> The command name
+
+`log` \<path|open>
+ `open` Open the latest log file in your default editor
+ `path` Prints the location of the log file
+
+`plex` [-f]
+: `-f` Force run the flow, ignoring already existing credentials
+
+`start` [-r]
+: -r Restart the service
+
+`whitelist` add \<folder1> ... [\<folderN>]
+ \<folder> Folder to be whitelisted
+
+`whitelist` \<remove|show>
+ `show` Show the current whitelist
+ `remove` Remove folder(s) from whitelist (interactive)
+
+# AUTHORS
+
+This program is written by Krut Patel(@iamkroot:github.com).
+
+This manpage is written by Mubashshir(@ahmubashshir:github.com).
+
+# REPORTING BUGS
+Report bugs and issues to [github](https://github.com/iamkroot/trakt-scrobbler/issues).
diff --git a/trakts.zsh b/trakts.zsh
new file mode 100644
index 000000000000..038b11eae069
--- /dev/null
+++ b/trakts.zsh
@@ -0,0 +1,252 @@
+#compdef trakts
+#
+# Zsh auto complete function for trakts
+#
+
+# Section: trakts autostart
+_trakts_autostart_actions()
+{
+ local actions
+ actions=(
+ "enable:Install and enable the autostart service"
+ "disable:Disable the autostart service"
+ )
+ _describe 'actions' actions
+}
+# command: trakts autostart
+_trakts_autostart()
+{
+ _arguments '1:action:_trakts_autostart_actions'
+}
+# Section: trakts backlog
+_trakts_backlog_actions()
+{
+ local actions
+ actions=(
+ "clear:Try to sync the backlog with trakt servers"
+ "list:List the files in backlog"
+ )
+ _describe 'actions' actions
+}
+# command: trakts backlog
+_trakts_backlog()
+{
+ _arguments '1:action:_trakts_backlog_actions'
+}
+
+# Section: trakts config
+_trakts_config_actions()
+{
+ local actions
+ actions=(
+ 'list:List configuration settings'
+ 'set:Set the value for a config parameter'
+ 'unset:Reset a config value to its default'
+ )
+ _describe 'actions' actions
+}
+# command: trakts 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_config_set()
+{
+ local args
+ args=(
+ '1:key:_trakts_config_list'
+ '2:value:'
+ '--add[Append to list instead of overwriting]'
+ )
+ _arguments -s "${args[@]}"
+}
+# command: trakts config list
+_trakts_config_list()
+{
+ local keys
+ keys=(
+ $(trakts config list --all|cut -d\ -f1)
+ )
+ _describe 'keys' keys
+}
+
+# Section: trakts init
+_trakts_init_actions()
+{
+ true
+}
+# command: trakts init
+_trakts_init()
+{
+ _arguments '1:action:_trakts_init_actions'
+}
+# no subcommand or options provided
+
+# Section: trakts log
+_trakts_log_actions()
+{
+ local actions
+ actions=(
+ 'open:Open Latest log.'
+ 'path:Prints the location of the log file'
+ )
+ _describe 'actions' actions
+}
+# command: trakts 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
+}
+
+# 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()
+{
+ true
+}
+
+# Section: trakts whitelist
+_trakts_whitelist_actions()
+{
+ local actions
+ actions=(
+ '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
+}
+# command: trakts 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
+}
+
+# Section: trakts
+_trakts_actions()
+{
+ local state actions
+ actions=(
+ "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"
+ "config:Edit the scrobbler config settings"
+ "help:Display the manual of a command"
+ "init:Run the initial setup of the scrobble"
+ "log:Access the log file"
+ "plex:Run the authetication flow for plex media server"
+ "run:Run the scrobbler in the foreground"
+ "start:Start the trakt-scrobbler service"
+ "status:Show the status trakt-scrobbler service"
+ "stop:Stop the trakt-scrobbler service"
+ "whitelist:Add the given folder(s) to whitelist"
+ )
+ _describe 'actions' actions
+}
+# 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"
+)
+_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