diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 63fd4e1a..457f04e4 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -54,6 +54,9 @@ class CacheDBConnection(db.DBConnection): if not self.hasTable(providerName): self.action( "CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)") + else: + # remove duplicates + self.action("DELETE FROM " + providerName + " WHERE url NOT IN (SELECT url FROM " + providerName + " GROUP BY url") except Exception, e: if str(e) != "table [" + providerName + "] already exists": raise