8 Jun 2017

Removing stubborn shows from Kodi

I love Kodi for all my media watching needs, but I have on occasion ended up with a TV show that appears in the GUI but which has been removed from the library.

Initially, I thought the only fix was to go into the database and remove the entry from there, however I have found the following method to be easier and safer.
  1. Make sure you have deleted the directory of the show you want to remove.
    If the directory exists, Kodi will re-add the show next time it scans for new material.
  2. Find the ID of the show you want to remove.
    There are many ways of doing this, but the RPC call keeps us consistent with the next step. http://kodi in the example should be replaced with your Kodi URL.

    curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "id": 1 }' -H 'content-type: application/json;' http://kodi/jsonrpc
  3. Delete the offending entry - TV show ID 68 in this example.

    curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": { "tvshowid": 68 } }' -H 'content-type: application/json;' http://kodi/jsonrpc

If all went well, Kodi should respond with something like

content-type: application/json;' http://kodi/jsonrpc   
       "id": 1,
       "jsonrpc": "2.0",
       "result": "OK"

20 Feb 2012

PS3 Hard Disk Upgrade

I recently upgraded the hard disk in my PlayStation 3. Following, mostly, this excellent FAQ over on Whirlpool, I was able to replace the 120GB drive in my PlayStation Slim with a 640 GB drive.

I encountered two major obstacles attempting to upgrade;
  1. I was unable to backup the original drive, as my backup drive was not detected, and
  2. Although I could select the correct backup to restore following the drive replacement, after a reboot the backup drive was no longer available.

First Issue

I have an external USB hard disk I was attempting to backup onto. This drive was not initially detected by the PS3. I formatted the drive to FAT32 as seemingly endless Googling told me to, after which it should have just worked. This was not the case for me. I kept receiving the notice "connect storage media at the save destination".

I had formatted the drive using the fat32format utility, as for some bizarre reason Windows 7 does not allow me to do so natively.  The partition was type 0x0B, the format FAT32. It should have worked. I tried again from my Linux box. Deleted the partition, created type 0x0B, formatted FAT32. Still, the error persisted.

Eventually and in desperation I downloaded the "SwissKnife" utility. This is mentioned in the FAQ as one of the suggested utilities for formatting the new disk for the PS3. This worked. The drive was detected and the backup proceeded. I have no idea why the partition and format created by this utility should be any different from those created by any other utility.

Once the backup was done (it took about 3-4 hours), I had no trouble replacing the drive. One screw to get the caddy out, four screws to swap the caddy to the new drive. Easy.

Second Issue

Having got the new drive installed, I continued following the FAQ to get the firmware installed and the system booting into the familiar PS3 XMB interface. I selected the Restore option and was presented with a menu to select the backup to restore. My backup was listed in the familiar yyyymmddhhmm format from which I could select it. The PS3 then reformats the internal drive, reboots and attempts to restore from the external backup disk.

At this point I received the notice "check that you have connected only the storage media containing the backup". What?? The backup was just listed - where did it go? I rebooted the PS3 and tried again. The result was the same. I tried the other USB port; same result.

At this point I suspected there was something wrong with the backup. I repeated the backup and tried restoring again with the same result. I found that the drive would be detected when the PS3 was powered up, but after a reboot it would be inaccessible. I started to suspect something weird was going on with the PlayStation's USB controller.

Clutching at straws at this point, I decided to hook the backup drive up to the PS3 via a USB hub. This did the trick. The drive appeared and stayed present through a reboot. The restore ran to completion and worked flawlessly. In my case I had used a hub with an external power supply, although I don't know if this is what made the difference.

11 Dec 2008

Directory History

You can use the pushd and popd commands for jumping backwards and forwards through a directory stack in order, but you can also use an incredibly handy shortcut for jumping to an arbitrary directory in the stack.

Once you have some entries in your directory stack, jump between them at ease with "cd ~x", where x is the position of the desired directory in the stack. "dirs -v" will even number the stack entries for you, if you can't be bothered counting through them. Notice the current directory changing in my shell prompts below.

[ian@lyekka]~% pushd /var/log
/var/log ~
[ian@lyekka]/var/log% pushd /tmp
/tmp /var/log ~
[ian@lyekka]/tmp% pushd /usr/local/bin
/usr/local/bin /tmp /var/log ~
[ian@lyekka]/usr/local/bin% dirs -v
0       /usr/local/bin
1       /tmp
2       /var/log
3       ~
[ian@lyekka]/usr/local/bin% cd ~2
[ian@lyekka]/var/log% cd ~1
You can, of course, also just popd back to the previous directory on the stack. See your shell manual for more information on these commands.