Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
71b5d30
Update update.sh
ninthwalker Apr 19, 2016
38942b8
Update initial_setup.sh
ninthwalker Apr 19, 2016
d96869f
Create Dockerfile
ninthwalker Apr 19, 2016
b104e43
Update Dockerfile
ninthwalker Apr 20, 2016
4468f57
Update Dockerfile
ninthwalker Apr 20, 2016
6ab427b
Update Dockerfile
ninthwalker Apr 20, 2016
287c40d
Update Dockerfile
ninthwalker Apr 20, 2016
19c5536
Create initial_setup.sh
ninthwalker Apr 20, 2016
763caba
Update Dockerfile
ninthwalker Apr 20, 2016
594037c
Update Dockerfile
ninthwalker Apr 20, 2016
35ebdbd
Update Dockerfile
ninthwalker Apr 20, 2016
e06c2d6
Update Dockerfile
ninthwalker Apr 20, 2016
04969a4
Update Dockerfile
ninthwalker Apr 20, 2016
f9a51fb
Update Dockerfile
ninthwalker Apr 20, 2016
2fbeeba
Update initial_setup.sh
ninthwalker Apr 20, 2016
15ae363
Update Dockerfile
ninthwalker Apr 20, 2016
e76eab8
Delete initial_setup.sh
ninthwalker Apr 20, 2016
968aed5
Update initial_setup.sh
ninthwalker Apr 20, 2016
99b6df1
Update Dockerfile
ninthwalker Apr 20, 2016
e3b16ac
Update Dockerfile
ninthwalker Apr 20, 2016
c815012
Update Dockerfile
ninthwalker Apr 20, 2016
56a36f3
Update initial_setup.sh
ninthwalker Apr 20, 2016
bb4556a
Update Dockerfile
ninthwalker Apr 20, 2016
2654e2d
Create firstrun.sh
ninthwalker Apr 20, 2016
e92cd6e
Update Dockerfile
ninthwalker Apr 20, 2016
4500793
Update Dockerfile
ninthwalker Apr 20, 2016
f750f73
Update Dockerfile
ninthwalker Apr 20, 2016
641b6a0
Update firstrun.sh
ninthwalker Apr 20, 2016
b49b28c
Update Dockerfile
ninthwalker Apr 20, 2016
0d3b10a
Delete firstrun.sh
ninthwalker Apr 20, 2016
681b081
Update Dockerfile
ninthwalker Apr 20, 2016
719bbcd
Update Dockerfile
ninthwalker Apr 20, 2016
cab18d0
Update initial_setup.sh
ninthwalker Apr 20, 2016
98f3524
Update Dockerfile
ninthwalker Apr 20, 2016
91d043c
Create firstrun.sh
ninthwalker Apr 20, 2016
8fe549d
Update Dockerfile
ninthwalker Apr 20, 2016
55ed0eb
Update Dockerfile
ninthwalker Apr 20, 2016
293df9c
Update initial_setup.sh
ninthwalker Apr 20, 2016
66999c3
Update initial_setup.sh
ninthwalker Apr 20, 2016
f85a0ec
Update plexreport
ninthwalker Apr 20, 2016
a4a208d
Update initial_setup.sh
ninthwalker Apr 20, 2016
b91c37a
Update initial_setup.sh
ninthwalker Apr 20, 2016
db7c34d
Update plexreport-setup
ninthwalker Apr 20, 2016
69e83fc
Update initial_setup.sh
ninthwalker Apr 20, 2016
dc35a7f
Update README.md
ninthwalker Apr 22, 2016
a0ef143
Update README.md
ninthwalker Apr 22, 2016
372e7e6
Update README.md
ninthwalker Apr 22, 2016
1aee415
Update README.md
ninthwalker Apr 22, 2016
98cedca
Update README.md
ninthwalker Apr 22, 2016
3e65c42
Bug Fixes & Email Layout changes
Jun 10, 2016
d2fbaa5
File name change
Jun 10, 2016
3283251
Update Dockerfile
ninthwalker Jun 12, 2016
a385d81
Downgrade Bundler version
Jun 12, 2016
2534562
Merge branch 'master' of https://github.com/ninthwalker/plexReport
Jun 12, 2016
d213070
Updates and fixes
Jun 13, 2016
1d10f11
Update README.md
ninthwalker Jun 13, 2016
696f0e1
Update README.md
ninthwalker Jun 13, 2016
606c9ba
Code Refinements
Nov 4, 2016
4e656d3
Update Dockerfile
ninthwalker Nov 4, 2016
3068542
Update README.md
ninthwalker Nov 4, 2016
563555f
Update README.md
ninthwalker Nov 4, 2016
7b5d4ed
Fix Executable
Nov 4, 2016
a8efbaa
Fix Executable
Nov 4, 2016
bbd39d6
Update README.md
ninthwalker Nov 4, 2016
a1ef917
Update plexreport
ninthwalker Mar 8, 2017
564bb92
Update plexreport
ninthwalker Mar 8, 2017
fd838de
Update plexreport
ninthwalker Mar 8, 2017
6fa3fd6
Create web_email_body.erb
ninthwalker Mar 8, 2017
642d325
Update plexreport-setup
ninthwalker Mar 8, 2017
974159d
Create add_new_file.sh
ninthwalker Mar 8, 2017
d30b3f9
Add new web file
Mar 8, 2017
d70ca69
Update Dockerfile
ninthwalker Mar 8, 2017
4089d1f
Update Dockerfile
ninthwalker Mar 8, 2017
d53752d
Update Dockerfile
ninthwalker Mar 8, 2017
291594f
Update Dockerfile
ninthwalker Mar 8, 2017
66ead9a
Update Dockerfile
ninthwalker Mar 9, 2017
c2b0c7a
Update Dockerfile
ninthwalker Mar 9, 2017
f71be3d
Update Dockerfile
ninthwalker Mar 9, 2017
b128b0a
Update Dockerfile
ninthwalker Mar 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM phusion/baseimage:0.9.18
MAINTAINER ninthwalker

# Set correct environment variables
ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Use baseimage-docker's init system
CMD ["/sbin/my_init"]

#copy plexReport files
COPY root/ /

#add new web_email_body.erb
RUN mkdir -p /etc/my_init.d
ADD /root/add_new_file.sh /etc/my_init.d/add_new_file.sh

# Configure user nobody to match unRAID's settings
RUN \
usermod -u 99 nobody && \
usermod -g 100 nobody && \
usermod -d /home nobody && \
chown -R nobody:users /home

RUN \
add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ trusty universe multiverse" && \
add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe multiverse" && \
apt-get update -q && \
apt-get install -qy ruby ruby-dev git make gcc && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* && \
cd /opt/gem && \
gem install bundler -v 1.12.3 && \
bundle install

VOLUME /config

123 changes: 33 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
plexWeeklyReport
plexReport
================

Scripts to generate a weekly email of new additions to Plex.
A dockerized version of bstascavage's original plexReport (https://github.com/bstascavage/plexReport)

## Introduction
This script is meant to send out a summary of all new Plex entries to your server to all of your server's users.
This docker generates an email summary of new additions to Plex to send to your users

## Supported Platforms
* Debian
* Ubuntu 14.04 LTS
* Mac OSX
* unRAID, Other Linux

## Supported Email Clients
* Gmail
* Mozilla Thunderbird

## Supported Plex Agents
* themoviedb
Expand All @@ -22,105 +19,51 @@ This script is meant to send out a summary of all new Plex entries to your serve

## Prerequisites

The following are needed to run this script:
The following are needed to run this docker:

1. Ruby installed (at least version 1.9.3) and ruby-dev.
2. For OSX: make sure you have Ruby installed using RVM (This is needed to create a wrapper to weekly run the script through crontab) (see http://railsapps.github.io/installrubyonrails-mac.html. Follow the steps from "Prepare your computer" until "Rails installation options").
3. themoviedb set as your Agent for your Movie section on your Plex server.
1. Plex.
2. themoviedb set as your Agent for your Movie section on your Plex server.
3. thetvdb.org set as your Agent for your TV section on your Plex server.
4. (Optional) A Gmail account to forward the email (Gmail is the only supported provider, so if you use another, YMMV).
4. A Gmail account to forward the email (Gmail is the only supported provider, so if you use another, YMMV).

## Installation (Linux)
## Installation (unRAID)

1. Clone this repo on your server:
Preferred installation method: From the Community Applications 'APPS' section in unRAID.
You can also install by adding the following template repository to unraid:
https://github.com/ninthwalker/docker-templates/

`git clone https://github.com/bstascavage/plexReport.git`
2. Change to the plexReport directory
3. Run the initial_setup script:
After installing, run the following commands from the command line:
(This initial_setup only has to be done once. Reinstalls of the docker do not require it)

`./initial_setup.sh`
`docker exec -it plexReport ./initial_setup.sh`

4. If you want to run your script with different commandline parameters, you'll need to edit the crontab. See here for reference: http://www.adminschoice.com/crontab-quick-reference

## Installation (OS X)
Part 1: Install plexReport
Follow Prompts.

1. Clone this repo on your server:
plexReport can be run with the following command from unraid:

`git clone https://github.com/bstascavage/plexReport.git`
2. Change to the plexReport directory
3. Install the blunder gem (http://bundler.io/)
`docker exec plexReport plexreport [-options]`

`gem install bundler`
4. Install the gem dependecies:
You can now edit the `config.yaml` (and optionally `email_body.erb`) with your own settings in your appdata dir.
See `/config/config.yaml.example` and below for details.

`bundle install`
5. Setup the config file in `etc/config.yaml`. See `etc/config.yaml.example` and below for details
6. Run `bin/plexreport` to execute the script
It should work correctly

To schedule the report to occur regulary please use the new cron system for unRAID 6:

Part 2: Create Ruby Wrapper
Edit the "plexreport_schedule.cron" file found in the plexreport appdata folder with your own time/date.
Copy that file to the following location. Each time unraid is started it will load your plexreport_schedule.

Now to have the script run once a week through crontab, you have to create an RVM alias by doing the following steps:
(Note: You need an RVM alias because launchd, cron, and other process schedulers operate in discrete bash shell environments. Simply calling ruby from inside your launchd or cron script will not work; that will invoke the non-RVM ruby that OS X shipped with. Instead, you need an RVM alias, which will run your file through RVM's ruby, from inside launchd.)
`/boot/config/plugins/dynamix/`

1. Determine your ruby version by entering
To have it added immediately without restarting unRAID, at the command prompt type `update_cron`.

`which ruby`
this should results in:
`/Users/you/.rvm/rubies/ruby-2.2.0/bin/ruby`
ruby-2.2.0 is your ruby version
See this page for help creating a time/date in cron: http://abunchofutils.com/u/computing/cron-format-helper/

2. Create a wrapper by entering
## Config

`rvm alias create plexReport ruby-2.2.0@plexReport`
Note: Replace ruby-2.2.0 with the version that you have determined in step 1

3. Test the wrapper by entering

`$rvm_path/wrappers/plexReport/ruby <PATH_TO_REPO>/bin/plexReport.rb -t`
Note: Replace <PATH_TO_REPO> with the path leading to your plexReport directory

It should run and exit properly (be patient it might take a few minutes).

4. Next determine the absolute path to your wrapper. Just run
By default, the config file is located in `/config/config.yaml`. If you need to change any information for the program, or to add more optional config parameters, see below for the config file format:

`echo $rvm_path`
it should result in something like this /users/esw1187/.rvm/

Substitute '$rvm_path' in the wrapper call with the absolute rvm path obtaine above and run it again by entering

`/users/ersw1187/.rvm/wrappers/plexReport/ruby /path_to/plexReport/bin/plexReport.rb`

5. Create bash script to run the Rub code by doing the following:
- Create a file on your desktop named 'plexReport.sh' and open it with TextEdit
###### email_body.erb

- Copy the following two lines in the file
`export LC_ALL=en_US.UTF-8`
`export LANG=en_US.UTF-8`

- Add the wrapper call you just tested in step 4 to the file that you have just tested. E.g.
`/users/ersw1187/.rvm/wrappers/plexReport/ruby /path_to/plexReport/bin/plexReport`

6. Copy plexReport.sh to /user/local/bin directory

7. Go to the /usr/local/bin directory and set the correct permissions by entering
`chmod u+x plexReport.sh`

8. Add the following line to your crontab (sudo crontab -e)

`15 11 * * 5 <USERNAME> /usr/local/bin/plexReport.sh`
(This will run it every Friday at 11:15. To change the time, see crontab documentation:
http://www.adminschoice.com/crontab-quick-reference

## Upgrading

To upgrade your code, cd to your plexReport directory and run `./update.sh`

## Config file

By default, the config file is located in `/etc/plexReport/config.yaml`. If you need to change any information for the program, or to add more optional config parameters, see below for the config file format:
This file can be edited with CSS/HTML if you want to modify the look of the email.

###### email
`title` - Banner title for the email body. Required.
Expand Down Expand Up @@ -153,7 +96,9 @@ By default, the config file is located in `/etc/plexReport/config.yaml`. If you

## Command-line Options

Once installed, you can run the script by simply running `plexreport`. If you need to reinstall or reconfigure the program, run `plexreport-setup`. All commandline options can be seen by running `plexReport --help`
Once installed, you can run the script by simply running `plexreport` from within the docker image container.

If you need to reconfigure the program configs, first delete the existing config files and rerun '. /initial_setup.sh`. All commandline options can be seen by running `plexreport --help`

##### Options:
`-n, --no-plex-email` - Do not send emails to Plex friends. Can be used with the `recipients_email` and `recipients` config file option to customize email recipients.
Expand All @@ -169,11 +114,9 @@ Once installed, you can run the script by simply running `plexreport`. If you n
New Episodes:
![alt tag](http://i.imgur.com/hWzHl2x.png)


New Seasons:
![alt tag](http://i.imgur.com/sBy62Ty.png)


New Movies:
![alt tag](http://i.imgur.com/E3Q85uU.png)

Expand Down
Binary file modified images/plex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 0 additions & 46 deletions initial_setup.sh

This file was deleted.

9 changes: 9 additions & 0 deletions root/add_new_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Added to check if new web_email_body.erb file exists, if not, add.
if [ -f /config/web_email_body.erb ]; then
echo # new line, do nothing
else
# copy new file
cp /opt/config/web_email_body.erb /config/
chmod -R 666 /config/web_email_body.erb
fi
14 changes: 14 additions & 0 deletions root/initial_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#walks the user through the initial setup
echo

if [ -f /config/config.yaml ]; then
echo "Config files detected. Using existing config"
echo # move to a new line
else
# begin initial setup
cp /opt/config/* /config/
chmod -R 666 /config/*
/usr/local/sbin/plexreport-setup
echo "Setup complete! Please read directions for running this on a schedule."
fi
1 change: 1 addition & 0 deletions root/opt/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

File renamed without changes.
Loading