Flexget for Movies and TV Shows

Here’s the list of instructions I used to setup flexget on my Raspberry Pi. One day I believe i will automate this.

0. Setup Raspbmc
Download the appropriate install.py  for your system and execute it. Remember system here is the computer     you’re using to prepare the sd card, not the Pi itself.

1. Change password for SSH
2. Login to ssh
3. To make sure everything is up to date
sudo apt-get update

4. Install transmission daemon -
sudo apt-get install transmission-daemon
after install, the daemon is started automagically. We don’t want that, because we want to tweak the config.
Stop the daemon:
sudo /etc/init.d/transmission-daemon stop
Now we want to change the config of the daemon:
sudo nano /etc/transmission-daemon/settings.json

5. Create home directories
mkdir /home/pi/flexget
mkdir /home/pi/incomplete
mkdir /home/pi/torrent
mkdir /home/pi/TVShows
mkdir /home/pi/Movies
mkdir /home/pi/Music

6. copy/paste and run this command: sudo nano /etc/transmission/settings.json

7. Change
“alt-speed-down”: 400,
“download-dir”: “/home/pi/TVShows”,
“download-queue-size”: 2,
“incomplete-dir”: “/home/pi/incomplete”,
“incomplete-dir-enabled”: true,
“ratio-limit”: 0.2,
“ratio-limit-enabled”: true,
“rpc-password”: “YOURDESIREDPW”,
“rpc-username”: “YOURDESIREDUSERNAME”,
“rpc-whitelist”: “127.0.0.1,192.168.*.*”,
“script-torrent-done-filename”: “/etc/transmission-daemon/xbmc-upd.sh”,
“seed-queue-enabled”: false,
“seed-queue-size”: 1,
“speed-limit-down”: 2000,
“speed-limit-down-enabled”: true,
“speed-limit-up”: 90,
“speed-limit-up-enabled”: true,
“watch-dir”: “/home/pi/torrent”

press CTRL+X to exit the settings file, then Y to save.

8. You can change the daemon to run as pi,
sudo nano /etc/init.d/transmission-daemon
change “USER=debian-transmission” to “USER=pi”
Now, because we changed the user, we also have to change ownership of the folders used by Transmission
sudo chown pi:pi /etc/transmission-daemon/settings.json
sudo chown pi:pi /etc/init.d/transmission-daemon
sudo chown -R pi:pi /var/lib/transmission-daemon/info
9. sudo /etc/init.d/transmission-daemon start

10. Install flexget
sudo apt-get -y install python-pip
sudo pip install flexget
sudo pip install transmissionrpc
sudo easy_install subliminal

11. Create an account: Trakt.tv.
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.

11. copy the text of this file and save as config.yml (you will need it later) – http://pastebin.com/V3f5XvPJ
Open in text editor and modify the things in CAPITALS to your personal accounts

12. Change to /home/pi/flexget
cd /home/pi/flexget/
nano config.yml
Paste contents of config.yml from above into this file

13. Trigger XBMC to update library on finished downloads
sudo nano /etc/transmission-daemon/xbmc-upd.sh
Now copy this and save it with CTRL+X Y:
/usr/bin/wget –header=’Content-Type:application/json’ –post-data=’{“jsonrpc”: “2.0″, “method”: “VideoLibrary.Scan”, “id”: “pi”, “params”: {“directory”:”‘”$TR_TORRENT_DIR”‘/”}}’ “http://localhost:80/jsonrpc”

give the file execution permission: sudo chmod +x /etc/transmission-daemon/xbmc-upd.sh

14. Make sure flex get and it’s configuration is working fine
flexget -c /home/pi/flexget/config.yml check

15. Schedule flexget in crontab
crontab -e
0 3,6,9,12,15,17 * * * nice -n 4 /usr/local/bin/flexget -c /home/pi/flexget/config.yml execute
16. Add user pi to samba
sudo smbpasswd -a pi

17. Add your sources! Go to Videos and choose Add Source. Go to ROOT, then media>usb>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.

 

Cron on Raspbmc

Here’s another little tutorial especially for people new to raspberry pi or linux in general (such as myself). Cron jobs are used to execute specific actions at pre-configured times. These actions can be executing scripts, writing data to a file, etc. (would be glad to hear of stuff you do with cron jobs in the comment section ;))

Editing cron

 

Netbeans – Git

Recently I started to use Netbeans again to do some JAVA development. I was involved in a project that required code sharing across the participants. we used GIT for code versioning, which I had to learn, so I decided to write this short tutorial on GIT used inside of Netbeans.

 

Clone a repository:

The first thing you would want to do is clone a repository. Cloning a repository involves making a local copy of the current repository. Conversely, if a repository for the project in question didn’t exist, then you would want to Initialize a repository. So I cloned the repository by clicking on the menu TEAM->Git->Clone. I was then greeted with the below screen where i entered the URL, User, & Password, then clicked Next.

Netbeans_git_clone

 

Next brought me to the below screen where I chose the Branch I would like to clone. Branches on GIT are like branches on trees, you can have various versions of the same solution but the branches represent permutations of the came code. Meaning, I can branch the main project and decide to add a feature that is not in the “master” branch. Off course this functionality can later be “merged” into the master branch to become part of the main code. I then clicked Next.

Netbeans_git_clone2

 

Next brought me to the final screen which confirmed which local folder I wanted the files to be placed, I also got the option to scan for Netbeans projects after the clone. After that I clicked Finish

Netbeans_git_clone3