Skip to content

Commit

Permalink
add plex module, WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalvatori committed Nov 1, 2020
1 parent 369f456 commit 17bd66d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo: required
language: go
go:
- 1.15.x
Expand All @@ -22,7 +21,7 @@ after_success:
- $HOME/gopath/bin/gox -osarch="linux/amd64 linux/386" -cgo -ldflags "-X github.com/ssalvatori/zbot-telegram/zbot.version=`git describe --tags` -X github.com/ssalvatori/zbot-telegram/zbot.buildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ssalvatori/zbot-telegram/zbot.gitHash=`git rev-parse --short HEAD`" -output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
deploy:
provider: releases
skip_cleanup: true
cleanup: false
file_glob: true
file: dist/*
api_key: "$GITHUB_API_SECURED"
Expand Down
27 changes: 27 additions & 0 deletions modules/plex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/env bash
#
# Requirements: curl & xmllint
#

SERVER_IP=""
SERVER_PORT="32400"
PLEX_TOKEN=""

case $1 in
tv|TV)
SECTION="2"
TYPE="newest"
;;
movies|MOVIES)
SECTION="1"
TYPE="recentlyAdded"
;;
*)
echo "Options: tv, movies"
exit 1
;;
esac

curl -s --insecure "https://${SERVER_IP}:${SERVER_PORT}/library/sections/${SECTION}/${TYPE}?X-Plex-Token=${PLEX_TOKEN}" > db.xml
xmllint db.xml --xpath "/MediaContainer/Video[position()>=10]/@*[name()='title' or name()='grandparentTitle' or name()='parentTitle']"
exit 0

0 comments on commit 17bd66d

Please sign in to comment.