Last active
August 29, 2015 14:25
-
-
Save miigotu/82bca725b6021af4d2b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| import sqlite3 | |
| WANTED = 3 | |
| SKIPPED = 5 | |
| IGNORED = 7 | |
| statusStrings = { | |
| WANTED: "Wanted", | |
| SKIPPED: "Skipped", | |
| IGNORED: "Ignored" | |
| } | |
| db = sqlite3.connect('sickbeard.db') | |
| def get_episodes_with_statuses(status_list): | |
| results = db.execute("SELECT s.indexer, s.indexer_id, s.show_name, " + | |
| "e.season, e.episode, e.name, e.status " + | |
| "FROM tv_episodes as e INNER JOIN tv_shows AS s " + | |
| "WHERE e.status IN (?,?,?) AND e.showid = s.indexer_id;", | |
| status_list) | |
| for item in results: | |
| print u'%s - S%02dE%02d - %s (%s: %s) is %s' % (item[2], item[3], item[4], item[5], u'tvdbid' if item[0] is 1 else u'rageid', item[1], statusStrings[int(item[6])]) | |
| get_episodes_with_statuses([WANTED, SKIPPED, IGNORED]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment