mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-07 03:48:02 -05:00
Deletes duplicates found in tv provider cache before creating unique index for provider table or just performs cleanup of any duplicate record period.
This commit is contained in:
parent
9f8c49ce88
commit
13cbffb6d4
@ -54,6 +54,9 @@ class CacheDBConnection(db.DBConnection):
|
|||||||
if not self.hasTable(providerName):
|
if not self.hasTable(providerName):
|
||||||
self.action(
|
self.action(
|
||||||
"CREATE TABLE [" + providerName + "] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT)")
|
"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:
|
except Exception, e:
|
||||||
if str(e) != "table [" + providerName + "] already exists":
|
if str(e) != "table [" + providerName + "] already exists":
|
||||||
raise
|
raise
|
||||||
|
Loading…
Reference in New Issue
Block a user