How to change the qualities of sickbeard / sickrage tvshows all at once via sqlite instead of going one by one thru the gui (in the gui you get there by going to shows->click on your tv show->click on edit->set quality to custom->and multi select the qualities you want, usually you would want to select all 720ps and all the 1080ps including rawHD). I later learned that you can do this via “MASS UPDATE” with the GUI. However this has its benefits too, if you have thousands of TV shows this method might be quicker and more fluid.
SIDENOTE: I recommend reading all of the side notes to understand how the qualities work with sickrage
Open up sqlite3 of the sickbeard.db file
# go to sickrage folder cd /apps/sickrage # make backup of the sickrage database cp sickbeard.db sickbeard.db-bak # stop sickrage (optional), this is how you stop it if you have systemctl/systemd - on your system you might stop it differently - also instead of stopping it, you could just do a sickrage restart at the end of the steps systemctl stop sickrage # go into the sqlite interpretter/editor sqlite3 sickbeard.db
Run this to list all of your tvshows
SELECT show_id,show_name,quality FROM tv_shows;
To see everything listed in order of quality
SELECT show_id,show_name,quality FROM tv_shows ORDER BY quality;
To see every TV show listed in order of name:
SELECT show_id,show_name,quality FROM tv_shows ORDER BY show_name;
SIDENOTE: you can run “.mode line” and “select * from tv_shows;” if you want to see more info about your tvshows. You can run “.tables” to see all of the other tables, other than tv_shows, such as the tv_episodes tables. you can view it with “select * from tv_episodes;“. “.mode line” is just an easier way to view lots of information crammed into many columns, because it prints each row as a paragraph and each column is a line in that paragraph. I believe the default one is “.mode list” or “.mode csv“, with thoses the header is not printed you can get it to print with “.headers on“, change to “.headers off” if you dont want to see the header. Notice that all of the dot commands dont need to end with a semi colon.
Idenetify your qualities. specifically the ones you want to change and keep.
quality=336 (only 1080p, rarely finds anything, my old default that didnt download much because it rarely found anything, no screenshow of the settings)
quality=33292796(1080p 720p, main quality, new default, see screenshot below)
quality=33522175 (any quality pretty much, good for daily shows like letterman show, see screenshot below)
quality=32768500 (720p, for cartoons, no screenshot of the settings)
SIDENOTE: What do these qualities mean? and what about more qualitys? read highlighted sidenotes below. Also read this: https://github.com/SiCKRAGETV/SickRage/wiki/Quality-Settings
I had alot of tv shows that werent downloading because I had their quality setting set to only 1080p, because I didnt set the default qualitys correctly at first. So sickrage was rarely finding tv shows. I had to allow more qualities like 1080p and 720p.
I noticed that the tv shows that I set correctly had quality 33292796 (note 33522175 & 32768500 are good for other shows). I noticed that the ones that were rarely downloading had that 1080p only quality (which is 336). So I need to update all of the tv_show enteries that have quality=336 and change it to quality=327685000.
UPDATE tv_shows SET quality=33292796 WHERE quality=336;
Now save and quit with “.exit” and dont forget to start or restart your sickrage. For me, since I use systemd, therefore I have to use the systemctl command to start/stop/restart. I use “systemctl start sickrage” to start it, or “systemctl restart sickrage“.
SIDENOTE: UPDATE, SELECT, WHERE, SET, etc… these keywords can be all caps or lowercase sql doesnt care. Its easier on the eyes if they are all caps.
SIDENOTE: if you want to update all of the shows to that quality “UPDATE tv_shows SET quality=33292796;“
SIDENOTE: here is tv_shows schema (how it was created). notice that the quality (prefer and wanted) are kept as one numeric variable. sickrage knows how to interpret them for what it needs.
CREATE TABLE tv_shows(show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer NUMERIC, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC, archive_firstmatch NUMERIC, rls_require_words TEXT, rls_ignore_words TEXT, sports NUMERIC, anime NUMERIC, scene NUMERIC, default_ep_status NUMERIC
SIDENOTE: you can do this with windows you will just need cygwin and sqlite3. I guess you can do it without cygwin with just using sqlite3. or some other sqlite3 editor. I know gui versions of sqlite3 exist.
SIDENOTE (what Allowed and Preferred mean): the above Allowed and Preferred settings are setup in such a way that something is downloaded first with the Allowed settings (so it will find the 720ps and 1080p or even the SDs if you have that quality option selected). Then it will continouly look for the best quality in Preferred, until it gets that quality (so it will look for 1080p, even if you have selected 720p and 1080 and sd as preferred). So if for example it downloaded a 720p episode. It will mark that episode as “Backlog: Low Quality” (meaning download this old episode because its low quality and we prefer higher quality, anything 1 day old or more is considered backloged). I know that the Preferred Quality is also marked as 720 and 1080p however it still looks for that 1080p. Also with these settings episodes that you already have that are in quality you downloaded (720p or SD) they will download again in 1080p, it will look for them. However it wont look for the 1080p episodes that you have again. If you look at your Backlog you will see wanted (episodes that you dont have) and low quality (episodes that you have but it wants to get in a better / preferred quality)
SIDENOTE (dont backlog low quality): if you want sickrage to not download episodes again, even if its for a higher quality. This is called dont backlog low quality. If you look at your backlog list you will not see any low qualities there. Then you need to set your quality settings without Preferred selected. Like this:
I set quality 508 on most tvshows that are not animated.
I set quality 511 on Anime and cartoons because I dont care about super quality (although I just read an interesting article that says 1080p is better for animated and its easier to see it there)
SIDENOTE (default quality): when you add new tv shows sickrage sets the quality for Allowed and Preferred based on the quality_default settings in the config.ini.
# cat config.ini | grep quality quality_default = 508
You can stop sickrage and edit that and start sickrage again. Or forget about editing config.ini and stopping sickrage, as you can just change the default setting from the GUI (as all of the settings in config.ini you should find them in the GUI and change there). When you add tv_shows click thru the options until you select quality, and select what you want and then click “Save Defaults”. That will save your selected quality options as the default ones for the next tv shows. Actaully there is a couple more places to change that option in the GUI, they all look the same with the quality chooser and the “Save Defaults” button and they are all located aound the add tv shows area.
Very descriptive blog, I enjoyed that bit. Will there be a part 2?
Thanks :). I’m not sure what to include in part 2. I believe I covered everything. Maybe I could cover how to come up with the quality numbers, but that will involve bit-math and I don’t want to jump into that. Also the math could change as sickrage gets updated (if its quality settings change up). If anything I should probably clean this article up and organize it better, but I wont get around to doing that (because kossboss.com is like “my notes”) and id rather write newer material. Also after I wrote this article I found out that you can make mass quality changes straight from the GUI in the “Mass Update” tab, so I thought I wasted time. Then I realized that time wasnt wasted, as there are users that have thousands of TV shows whom would prefer to use the SQLite method covered here over the GUI method (from experience text/cli is always faster that GUI). I covered that in one of the sidenotes above.