Friday, April 24, 2015

TRakt plugin for VLC on Windows

One more reason to bid adieu to XBMC.

What a wonderful plugin from Raphaël Beamonte called TraktForVLC. Only setting it up is a tad bit of work.

Steps to get it working

1. Download the repo and extract it to a folder. I kept it in Dropbox for i don't want to do all the config again.

2. Follow the instruction given with the repo- https://github.com/nigamankit7/TraktForVLC

3. Make sure you update the name of two files as below

config.ini.default –> config.ini (in default folder)

config.bat.default –> config.bat (in windows_batch folder)

4. Also update config.bat file with all the paths. Use double quotes in batch files wherever path has spaces.

5. keep the shortcut of start.bat in startup folder.

6. If you want to check if the code is working check the log folder.

-Cheers !!

TRakt plugin for VLC on Windows

What a wonderful plugin from Raphaël Beamonte called TraktForVLC. Only setting it up is a tad bit of work.

Steps to get it working

1. Download the repo and extract it to a folder. I kept it in Dropbox for i don't want to do all the config again.

2. Follow the instruction given with the repo- https://github.com/nigamankit7/TraktForVLC

3. Make sure you update the name of two files as below

config.ini.default –> config.ini (in default folder)

config.bat.default –> config.bat (in windows_batch folder)

4. Also update config.bat file with all the paths. Use double quotes in batch files wherever path has spaces.

5. keep the shortcut of start.bat in startup folder.

6. If you want to check if the code is working check the log folder.

Friday, March 6, 2015

Automatically backup your files as soon as UBD Flash or HDD is connected

One of a great tool available to sync file is SyncTool from Microsoft. You my download a copy free of cost and installation & use is self explanatory.

Now, I don’t want to open the sync tool every time manually when I connect the HDD. My objective is to take the backup as soon as the USB HDD or flash drive is connect just like time machine backup in MAC.

I wrote a powershell script which I scheduled with task scheduler while booting. This script keeps on running like a deamon and keep on checking for the USB connection. Once the correct USB is connect with predefined name, it starts the sync tool and start syncing for each partnership sequentially.

One more benefit is that this script keeps on running in background and when the backup is started and completed, a balloon notification is shown to the user along with the path to log files. You may need to change the line number as per your case.

 

clear
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
$TARGETDIR = $dir + "\log"


if(!(Test-Path -Path $TARGETDIR ))
{
    New-Item -ItemType directory -Path $dir -Name "log"
}
$logFile = $TARGETDIR + "\sync.log"


function baloon-notify($logpath, $title_tip, $title)
    {   write-host "logpath : " $logpath
        write-host "titl tip : "  $title_tip  
        write-host "Title : " $title
        [void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)#Remove any registered events related to notifications
        Remove-Event BalloonClicked_event -ea SilentlyContinue
        Unregister-Event -SourceIdentifier BalloonClicked_event -ea silentlycontinue
        Remove-Event BalloonClosed_event -ea SilentlyContinue
        Unregister-Event -SourceIdentifier BalloonClosed_event -ea silentlycontinue
        $notification = New-Object System.Windows.Forms.NotifyIcon
        $notification.Icon = [System.Drawing.SystemIcons]::Information
        $notification.BalloonTipTitle = $title_tip
        $notification.BalloonTipIcon = “info”
        $notification.BalloonTipText = $title + $logpath
        $notification.Visible = $True
        register-objectevent $notification BalloonTipClicked BalloonClicked_event `
        -Action {Invoke-Item $logpath} | Out-Null
        $notification.ShowBalloonTip(600)
    }


 



function Run-SyncToy ($backupPlan)
{
    $Exe = "C:\Program Files\SyncToy 2.1\SyncToyCmd.exe"
    & $Exe -R #$backupPlan
}


Register-WmiEvent -Class win32_VolumeChangeEvent -SourceIdentifier volumeChange -ea silentlycontinue 
write-host (get-date -format s) " Beginning script..."
do{
    $newEvent = Wait-Event -SourceIdentifier volumeChange
    $eventType = $newEvent.SourceEventArgs.NewEvent.EventType
    $eventTypeName = switch($eventType)
    {
        1 {"Configuration changed"}
        2 {"Device arrival"}
        3 {"Device removal"}
        4 {"docking"}
    }
    write-host (get-date -format s) " Event detected = " $eventTypeName
    if ($eventType -eq 2)
    {
        $driveLetter = $newEvent.SourceEventArgs.NewEvent.DriveName
        $driveLabel = ([wmi]"Win32_LogicalDisk='$driveLetter'").VolumeName
        write-host (get-date -format s) " Drive name = " $driveLetter
        write-host (get-date -format s) " Drive label = " $driveLabel
        # Execute process if drive matches specified condition(s)
        if ($driveLetter -eq 'H:' -and $driveLabel -eq 'Ankit')
            {
            write-host (get-date -format s) " Starting task in 3 seconds..."
            start-sleep -seconds 3
            write-host (get-date -format s)" Sync Process started"
            $tip = "Auto Sync Started.Do not remove USB."
            $text = "SyncToy started syncing. Do not remove USB till next notification."
            baloon-notify $TARGETDIR $tip $text
            Run-SyncToy ("Media Sync") | out-file $logFile -Append -Force
            write-host (get-date -format s) " Sync Process Ended"
            $tip = "Auto Sync Completed"
            $text = "Path to log file ->"
            baloon-notify $logFile $tip $text
            }
    }
    Remove-Event -SourceIdentifier volumeChange
} while (1-eq1) #Loop until next event


Unregister-Event -SourceIdentifier volumeChange

 

Thursday, March 5, 2015

Updating Sickrage - PAIN

the other day I installed sickrage on my raspberry pi and today morning I found that there are 200+ commits are are not updated on my installation.

We I tried all sorts to update my installation but nothing worked out. Ultimately I decided to stay with the current version. BUT to my surprise, my sickrage installation stopped downloading any new episode.

I need to do something now. Below are the steps followed to fix the issue. (taking a backup of sickrage via its web UI is never a bad idea before starting.)



mv /home/pi/sickrage/ /home/pi/sickrage-backup

sudo git clone https://github.com/SiCKRAGETV/SickRage.git /home/pi/sickrage

sudo chown -R 777 /home/pi/sickrage

sudo chmod -R 777 /home/pi/sickrage

cp /home/pi/sickrage-backup/config.ini /home/pi/sickrage/

cp /home/pi/sickrage-backup/sickbeard.db /home/pi/sickrage/

mkdir /home/pi/sickrage/cache

cp -a /home/pi/sickrage-backup/cache/. /home/pi/sickrage/cache/

sudo service sickrage start



Followed by a system reboot the issue is resolved with all my data intact. 

Sunday, March 1, 2015

Installing sickrage on RASPBMC

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install python-cheetah git-core -y
wget http://sourceforge.net/projects/bananapi/files/unrar_5.0.10-1_armhf.deb
sudo dpkg -i unrar_5.0.10-1_armhf.deb
sudo git clone https://github.com/SiCKRAGETV/SickRage.git /home/pi//sickrage
sudo chown -R 777 /home/pi/sickrage
sudo chmod -R 777 /home/pi/sickrage
python /home/pi/sickrage/SickBeard.py -d
sudo apt-get install upstart
sudo nano /etc/init/sickrage.conf
#author "HTPCGuides.com"
#description "Upstart Script to run SickRage as a service on Ubuntu/Debian based systems"

#Set username for the process. Should probably be what you use for logging in

start on runlevel [2345]
stop on runlevel [016]

respawn

exec su - pi -c "python /home/pi/sickrage/SickBeard.py"
sudo service sickrage start

Friday, February 27, 2015

Setup Bit-torrent Sync on RASPBMC

 Fist we need add some repositories. Since Raspbmc do not allow the addition of new repository directly and hence do the following.


sudo apt-get install software-properties-common python-software-properties
sudo apt-get update

Now we can try below command

sudo echo deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free >> /etc/apt/sources.list.d/btsync.list
sudo apt-get update
sudo apt-get install btsync

Note that if you get permission errors on the sources.list.d file, try editing the file manually with Nano:

sudo nano /etc/apt/sources.list.d/btsync.list

and paste in these lines.

deb http://debian.yeasoft.net/btsync wheezy main contrib non-free
deb-src http://debian.yeasoft.net/btsync wheezy main contrib non-free

save and close the file followed by update. 

sudo apt-get update
Sudo apt-get install btsync

Once btsync installation is started - choose the user - "pi" and group - "default"

After the installation of btsync grant read write permission on the external drive.

sudo chmod -R 777 /media/Ankit/
sudo chown pi /media/Ankit/

Open the btsync webpage with URL http://my_Pi_IP:8888/gui