Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
d2657612
Commit
d2657612
authored
10 years ago
by
echel0n
Browse files
Options
Downloads
Patches
Plain Diff
Small SQL syntax fix
parent
27ce2283
No related branches found
Branches containing commit
Tags
v4.0.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sickbeard/tvcache.py
+6
-4
6 additions, 4 deletions
sickbeard/tvcache.py
tests/encoding_tests.py
+0
-12
0 additions, 12 deletions
tests/encoding_tests.py
with
6 additions
and
16 deletions
sickbeard/tvcache.py
+
6
−
4
View file @
d2657612
...
...
@@ -36,6 +36,7 @@ from sickbeard import clients
from
name_parser.parser
import
NameParser
,
InvalidNameException
,
InvalidShowException
from
sickbeard
import
encodingKludge
as
ek
class
CacheDBConnection
(
db
.
DBConnection
):
def
__init__
(
self
,
providerName
):
db
.
DBConnection
.
__init__
(
self
,
"
cache.db
"
)
...
...
@@ -47,7 +48,7 @@ class CacheDBConnection(db.DBConnection):
"
CREATE TABLE [
"
+
providerName
+
"
] (name TEXT, season NUMERIC, episodes TEXT, indexerid NUMERIC, url TEXT, time NUMERIC, quality TEXT, release_group TEXT)
"
)
else
:
sqlResults
=
self
.
select
(
"
SELECT url, COUNT(url)
as
count FROM [
"
+
providerName
+
"
] GROUP BY url HAVING count > 1
"
)
"
SELECT url, COUNT(url)
AS
count FROM [
"
+
providerName
+
"
] GROUP BY url HAVING count > 1
"
)
for
cur_dupe
in
sqlResults
:
self
.
action
(
"
DELETE FROM [
"
+
providerName
+
"
] WHERE url = ?
"
,
[
cur_dupe
[
"
url
"
]])
...
...
@@ -75,6 +76,7 @@ class CacheDBConnection(db.DBConnection):
if
str
(
e
)
!=
"
table lastUpdate already exists
"
:
raise
class
TVCache
():
def
__init__
(
self
,
provider
):
...
...
@@ -233,7 +235,7 @@ class TVCache():
if
not
parse_result
:
# create showObj from indexer_id if available
showObj
=
None
showObj
=
None
if
indexer_id
:
showObj
=
helpers
.
findCertainShow
(
sickbeard
.
showList
,
indexer_id
)
...
...
@@ -305,8 +307,8 @@ class TVCache():
else
:
for
epObj
in
episode
:
cl
.
append
([
"
SELECT * FROM [
"
+
self
.
providerID
+
"
] WHERE indexerid = ? AND season = ? AND episodes LIKE ?
"
"
AND quality IN (
"
+
"
,
"
.
join
(
[
str
(
x
)
for
x
in
epObj
.
wantedQuality
])
+
"
)
"
,
"
SELECT * FROM [
"
+
self
.
providerID
+
"
] WHERE indexerid = ? AND season = ? AND episodes LIKE ?
AND quality IN (
"
+
"
,
"
.
join
(
[
str
(
x
)
for
x
in
epObj
.
wantedQuality
])
+
"
)
"
,
[
epObj
.
show
.
indexerid
,
epObj
.
season
,
"
%|
"
+
str
(
epObj
.
episode
)
+
"
|%
"
]])
sqlResults
=
myDB
.
mass_action
(
cl
,
fetchall
=
True
)
...
...
This diff is collapsed.
Click to expand it.
tests/encoding_tests.py
+
0
−
12
View file @
d2657612
...
...
@@ -28,20 +28,8 @@ class EncodingTests(unittest.TestCase):
if
not
sickbeard
.
SYS_ENCODING
or
sickbeard
.
SYS_ENCODING
in
(
'
ANSI_X3.4-1968
'
,
'
US-ASCII
'
,
'
ASCII
'
):
sickbeard
.
SYS_ENCODING
=
'
UTF-8
'
if
not
hasattr
(
sys
,
"
setdefaultencoding
"
):
reload
(
sys
)
try
:
# pylint: disable=E1101
# On non-unicode builds this will raise an AttributeError, if encoding type is not valid it throws a LookupError
sys
.
setdefaultencoding
(
sickbeard
.
SYS_ENCODING
)
except
:
sys
.
exit
(
"
Sorry, you MUST add the SickRage folder to the PYTHONPATH environment variable
\n
"
+
"
or find another way to force Python to use
"
+
sickbeard
.
SYS_ENCODING
+
"
for string encoding.
"
)
for
s
in
strings
:
try
:
show_name
=
s
.
decode
(
sickbeard
.
SYS_ENCODING
,
'
xmlcharrefreplace
'
)
show_dir
=
ek
.
ek
(
os
.
path
.
join
,
rootDir
,
sanitizeFileName
(
s
))
self
.
assertTrue
(
isinstance
(
show_dir
,
unicode
))
except
Exception
,
e
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment