Toying with the SickBeard database – SQLite

I’m moving around a bunch of data managed by SickBeard because I’m running out of drive space.  While SickBeard nicely allows for mass changes, it isn’t so friendly when it comes to gleaning certain information, such as a list of shows that reside in a common path.  SQL to the rescue.

Currently SickBeard uses SQLite as its default database.  Head to SQLite’s download page and grab the appropriate copy of the command line shell (in my case, Precompiled Binaries for Windows).  Stick it in the install path for SickBeard, where sickbeard.db resides.  Because I like to be safe I made a copy of my database, which I named sickbeard_2.db, just in case I did something stupid and broke it.

In a CMD window, path to the aforementioned location and fire up SQLite:

SQLite3.exe

Open the database with

.open filename.db

01

You can list tables simply with

.tables

02

We’re after the information found in the tv_shows table. Want to see the columns in that table?

pragma table_info(tv_shows);

03

This simple query gets me what I am after, which is all the shows located in the Toons directory:

SELECT location, show_name FROM tv_shows WHERE location LIKE '%Toons%';

04

To dump the data to a file rather than to the screen:

.mode csv
.output FILE.csv
SELECT location, show_name FROM tv_shows WHERE location LIKE '%Toons%';
.output stdout

05

Find FILE.csv in the directory containing SQLite3 and the db.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*