Automatically Download all Your Favourite TV Shows and Movies
Special
Thanks to user Zilexa on the Raspberry PI foums who wrote the original
guide for Xbian. I adapted it for the dfiferent settings in RaspBMC so
most of this is his work.
See the orignal thread here
REQUIRED INGREDIENTS:
- Raspberry Pi with internet connection
- USB harddrive attached to the RPi or to a USB hub which is
connected to the RPi
- A very fast SD card: ICIDU class 10 4GB or Transcend class
10 8GB or similar or a fast USB stick for best results.
- a Windows PC with putty
(download and put it on the desktop) or Macbook, go to
Applications>Utilities>Terminal.
- an FTP client like Cyberduck.
QUICK SUMMARY HOW IT WILL
WORK:
Have you ever heard of
imdb.com? This is like the Wikipedia of movies and tv shows. There is a
similar site called Trakt.tv. Biggest difference: you can create an
account at Trakt.tv, install the addon in XBMC, and it will
automatically keep track of what you watched in XBMC and, very
important for this guide: what you
would like to watch.
Basically, you will not notice anything after adding a running TV Show
to Trakt. Once an episode or movie becomes available in the quality you
prefer --> it will appear in XBMC.
in detail:
On trakt.tv, you can simply add tv shows to a list. Special software
(Flexget) on the RPi keeps an eye on this list of yours. Secondly, this
software will use intelligent scripting (nothing you need to do, dont
worry) to get the latest episodes or movies from online newsfeeds
(torrents) that are meant for this setup. Thirdly, after an episode or
movie has been downloaded, XBMC will be notified and add just that
download to its library.
PREPARATIONS:
- (optional but recommended) create an account at
showrss.karmorra.info and add the shows you like to your list.
- (required) Create an account at Trakt.tv.
- When done, move your mouse to your accountname in the
upper right corner and choose "Lists" in the context menu that appears.
This is also called "Custom List"
- Create a list "Following". If you are like me and you
follow most tv shows in normal quality and some in high 720p quality,
create two lists (“Following” and “Following in HD”). I consider normal
quality to be hdtv but not 720p rips.
- add all tv shows you like watch in XBMC to this list by
going to TV Shows and scroll through the shows or search the shows. You
can do this by selecting "Add to Custom List" for every tv show.
- for Movies: simply select "add to Watchlist". A movie will
automatically be removed from this Watchlist once you have watched it
in XBMC.
Copy
the text of these two files and save them in a new textdocument (you
will be asked to do this in the guide):
- Flexget config,
save as "config.yml"
- Transmission script,
save as "libraryupdater.sh":
- Open config.yml with Notepad (Windows) or TextEdit (I
recommend TextWrangler) on Mac and modify the things in CAPITALS to
your personal accounts:
- your desired Transmission username/password
- your http://showrss.karmorra.info
USER ID, to get the the text of the full link, go to http://shows.karmorra.info,
login with your username and password, then click on the feeds link. On
the Feeds page, click the Generate button next to "your feed address"
and the URL you want to have in the config.yml file is the "full feed
with magnets" link
- your Trakt.tv account info and API key (you can find this in Trakt.tv
> Settings > API)
- change the names of the Trakt custom lists to the names of the
list(s) you created on trakt.tv. This config supports 2 lists for tv
shows, you can easily add more or remove one.
Step A: INSTALL THE RPI
WITH RaspBMC
Follow the RaspBMC install
instructions here.
NOTE: Make sure you insert the SD card in the RPi and connect all
cables BEFORE you connect it to power.
NOTE: Check your router to see what the iP address of the RPi is. If
your router supports it, reserve a fixed IP for the RPi so that the RPi
will always be accessible via this IP address.
STEP B. INSTALL TOOLS
1. Transmission
Connect to the Pi using your terminal software and enter the following
commands one by one:
sudo apt-get install
transmission
sudo apt-get install
transmission-daemon
sudo apt-get install python-pip
sudo pip install flexget
sudo pip install transmissionrpc
Then
run this, it should return a version, if not, something went
wrong, install again:
flexget -V
STEP C. CREATE THE FOLDER
STRUCTURE ON USB DRIVE
You need to configure the file structure on your external USB drive.
- Your hard drive should be
mounted under the /media folder. have a quick check that it is there
(mine was called /media/External)
- Create the folders on
the drive like this
and also create static links to the usb drive folders (copy paste the
commands one by one and hit enter):
mkdir
/media/External/Downloads
mkdir
/media/External/Downloads/incomplete
mkdir
/media/External/Downloads/torrents
- Create symbolic links to
the folders on the external USB
drive:
ln
-s /media/External/Downloads /home/pi/downloads
ln
-s /media/External/Downloads/incomplete /home/pi/incomplete
ln
-s /media/External/External/torrents /home/pi/torrents
- and finally create some
more folders:
mkdir
/media/External/Downloads/flexget
mkdir
'/media/External/TV Shows'
mkdir
/media/External/Movies
mkdir
/media/External/Pictures
mkdir
/media/External/Music
- make sure you and the
downloadtool transmission has
permission to use these folders:
chmod
-R 777 /media/External/Downloads
chmod
-R 777 '/media/External/TV Shows'
chmod
-R 777 /media/External/Movies
chmod
-R 777 /media/External/Music
Note that if your hard
drive is formatted as NTFS, the chmod commands will not do anything.
See Step I to
get round this issue.
STEP D. CONFIGURE
TRANSMISSION
login via putty or terminal.
Transmission should be configured after you stopped it from running,
otherwise the changed settings will not be saved. Follow the steps
below:
- 1. copy/paste and run
this command: sudo
service
transmission-daemon stop
- 2. copy/paste and run
this command: sudo nano
/etc/transmission-daemon/settings.json
- 3. now you see all
settings of Transmission. Change the
following settings to these values (not all settings are listed here,
just the ones I modified):
"alt-speed-down":
400,
"download-dir":
"/home/pi/downloads",
"download-queue-enabled":
true,
"download-queue-size":
2,
"ratio-limit":
0.2,
"ratio-limit-enabled":
true,
"rpc-whitelist-enabled":
false,
"seed-queue-enabled":
false,
"seed-queue-size":
2,
"speed-limit-down":
2000,
"speed-limit-down-enabled":
true,
"speed-limit-up":
90,
"speed-limit-up-enabled":
true,
- press CTRL+O and then
choose enter to save the file. Then
press CTRL+X to exit the settings file.
- copy/paste and run this
command: sudo
service transmission-daemon
start
STEP E. USE CYBERDUCK TO
ADD FLEXGET SETTINGS
Start Cyberduck on your laptop and login to your RPi by entering IP
address, username (pi) and password. Go to Media/usb. This is your
usb harddrive. Here you'll see all important folders (simply type ls
and hit enter) you created in the previous steps like Downloads, TV
Shows, Movies. Episodes that are downloading will be in
media/External/Downloads/incomplete. When done they should appear in
the
appropriate subfolder of TV Shows. Now perform these steps:
- Open the folder
/media/External/Downloads/flexget
- Copy the config.yml file
you locally saved during the
PREPARATIONS (above) to this folder
STEP F. TEST FLEXGET AND
SCHEDULE IT
1. test Flexget
Now go back to Putty (windows) or Terminal). I assume you exited
Xbian-Config. Run this command to test Flexget. Nothing will actually
be saved or downloaded.
flexget -c /media/External/Downloads/flexget/config.yml --test
If your
config.yml is correct, it will show its progress and take a few minutes
to finish. If your config.yml is incorrect you will get to see an
explanation what went wrong. Use --check if you simply want to check if
your config.yml contains typos.
[*]2. Schedule Flexget
If nothing went wrong, you can now go ahead and schedule Flexget. I
choose to schedule it every 3 hours starting at 3 AM since I live
Europe and between 2-6 AM most US tv shows from the previous evening
become available.
Run this command:
crontab -e
Now
scroll all the way down and copy paste this line, then hit CTRL+O to
save it and CTRL+X to close it.
0 3,6,9,12,15 * * * nice -n 4 /usr/local/bin/flexget -c
/media/External/Downloads/flexget/config.yml --cron
Now,
Cron jobs are disabled by default in RaspBMC so you will have to enable
them by going to Programs?RaspBMC Settings>Server Configuration
and
enabling "Cronjob Scheduler"
This
will run Flexget every three hours starting at 3AM and last one at 3PM.
Sometimes, a newer version of an episode is released later
because the first release had errors (like audio not in sync with video
etc).
STEP G. MANAGE PRIORITY
Still to figure ths one out.
STEP H. XBMC ESSENTIALS
- Make sure you install the Trakt.tv addon for XBMC! This
way, you keep a backup of what you already watched. If anything ever
destroys your RPi, you still have the watched status backed up when you
install XBMC again (on the RPi or different device). Also, after a
movie has been downloaded and you have watched it in XBMC, it will be
removed from the Trakt Watchlist.
- Sources
Add your sources! Go to Videos and choose Add Source. Go to ROOT, then
media>External>TV Shows and select this folder. Then
select
This folder contains TV Shows and save it. Do the same for Movies but
select it contains Movies.
STEP I (Optional).
TRANSMISSION AND NTFS DRIVES
You
may find
when you check your Transmission web interface, that you are getting
access denied errors on the torrents. This is because NTFS formatted
drives don;t handle permissions the same way as EXT3 or 4 partitions
do. On the NTFS partition you will find that only the Pi user has
access to the drive. Since Transmission runs under the user
'debian-transmission' it won't be allowed to write to the drive. What
we need to do is change the transmission script to run as user Pi
instead.
- From the SSH console, type sudo nano
/etc/init.d/transmission-daemon
- Look for the line that says 'USER=debian-transmission' and
change it to 'USER=pi'
- Press CTRL+X to save and exit.
- type the following comands:
sudo chown -R $USER /var/lib/transmission-daemon/info/
sudo chown -R $USER /etc/transmission-daemon/
sudo service transmission-daemon start
Add your sources! Go to Videos and choose Add Source. Go to ROOT, then
media>External>TV Shows and select this folder. Then
select
This folder contains TV Shows and save it. Do the same for Movies but
select it contains Movies.
Enjoy!
Any questions. Ask.
EXTRA: want to be able to access your files when you are not at home?
And be able to add torrents to Transmission when you are at work? check
out Zilexa's pastebin how to easily make your RPi always accessible.
Note: you do need to setup portforwarding in your router for port 22
(to access files and also to do SSH) and port 9091 (for Transmission).
ADDITION:
Here is a copy of my config.yml scrit. Replace anything in <BOLD>
with your own credentials:
presets:
tvshows:
exists_series:
- /media/External/TV Shows/
- /media/External/Downloads/
regexp:
reject:
- FASTSUB
- VOSTFR
- Subtitulado
content_filter:
reject:
- '*.rar'
- '*.zip'
- '*.avi'
- '*.wmv"
transmission:
host: localhost
port: 9091
username: transmission
password: <TRANSMISSION_PASSWORD>
path: /media/External/TV Shows/{{series_name}}/S{{"%02d"|format(series_season)}}
inputs:
- rss: http://showrss.karmorra.info/rss.php?user_id=<MY_ID>&hd=2&proper=1&namespaces=true&magnets=true
- rss: http://kat.torrenticity.com//tv/?rss=1
- rss: http://rss.bt-chat.com/?group=3
- rss: http://extratorrent.com/rss.xml?cid=8
movies:
transmission:
host: localhost
port: 9091
username: transmission
password: <TRANSMISSION_PASSWORD>
path: /media/External/Movies
tasks:
Get tvshows hdtv <720p:
priority: 2
preset: tvshows
import_series:
from:
trakt_list:
username: <USERNAME>
password: <PASSWORD>
api_key: <API KEY>
custom: TV Shows
settings:
quality: hdtv <720p
Fill movie queue:
priority: 3
interval: 1 day
trakt_list:
username: <USERNAME>
password: <PASSWORD>
api_key: <API KEY>
movies: watchlist
seen:
local
# We don't want accepted movies on this feed to affect actual download
feed
queue_movies:
quality: 480p 720p+ dvdrip dvdscr webrip
force: no
imdb_lookup: yes
accept_all: yes
Get movies:
preset: movies
priority: 4
content_size:
max: 20000
min: 500
torrent_alive: yes
discover:
what:
- emit_movie_queue: yes
from:
- piratebay: yes
- search_rss:
url: http://rss.thepiratebay.sx/201
link: magneturi
- search_rss:
url: http://katmirror.com/highres-movies/?rss=1
- kat:
verified: yes
- torrentz: verified
movie_queue: yes