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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
4da248ef
Commit
4da248ef
authored
May 26, 2014
by
echel0n
Browse files
Options
Downloads
Patches
Plain Diff
Fixed internal indexer scene name cache which resolved issues with searching and snatching.
parent
c5f933e4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sickbeard/helpers.py
+7
-14
7 additions, 14 deletions
sickbeard/helpers.py
sickbeard/scene_exceptions.py
+19
-5
19 additions, 5 deletions
sickbeard/scene_exceptions.py
with
26 additions
and
19 deletions
sickbeard/helpers.py
+
7
−
14
View file @
4da248ef
...
...
@@ -1014,21 +1014,14 @@ def get_show_by_name(name, useIndexer=False):
showObj
=
sickbeard
.
name_cache
.
retrieveShowFromCache
(
name
)
if
showObj
:
return
showObj
if
not
showObj
and
sickbeard
.
showList
:
showNames
=
list
(
set
(
sickbeard
.
show_name_helpers
.
sceneToNormalShowNames
(
name
)))
for
showName
in
showNames
:
if
showName
in
sickbeard
.
scene_exceptions
.
exceptionIndexerCache
:
showObj
=
findCertainShow
(
sickbeard
.
showList
,
int
(
sickbeard
.
scene_exceptions
.
exceptionIndexerCache
[
showName
]))
if
showObj
:
break
if
name
in
sickbeard
.
scene_exceptions
.
exceptionIndexerCache
:
showObj
=
findCertainShow
(
sickbeard
.
showList
,
int
(
sickbeard
.
scene_exceptions
.
exceptionIndexerCache
[
name
]))
if
useIndexer
and
not
showObj
:
(
sn
,
idx
,
id
)
=
searchIndexerForShowID
(
showN
ame
,
ui
=
classes
.
ShowListUI
)
(
sn
,
idx
,
id
)
=
searchIndexerForShowID
(
n
ame
,
ui
=
classes
.
ShowListUI
)
if
id
:
showObj
=
findCertainShow
(
sickbeard
.
showList
,
int
(
id
))
if
showObj
:
break
# add show to cache
if
showObj
:
...
...
This diff is collapsed.
Click to expand it.
sickbeard/scene_exceptions.py
+
19
−
5
View file @
4da248ef
...
...
@@ -125,12 +125,11 @@ def retrieve_exceptions():
scene_exceptions table in cache.db. Also clears the scene name cache.
"""
global
exceptionCache
,
exceptionSeasonCache
,
exceptionIndexerCache
global
exceptionCache
,
exceptionSeasonCache
exception_dict
=
{}
exceptionCache
=
{}
exceptionSeasonCache
=
{}
exceptionIndexerCache
=
{}
# exceptions are stored on github pages
for
indexer
in
sickbeard
.
indexerApi
().
indexers
:
...
...
@@ -192,9 +191,6 @@ def retrieve_exceptions():
for
cur_exception_dict
in
exception_dict
[
cur_indexer_id
]:
cur_exception
,
curSeason
=
cur_exception_dict
.
items
()[
0
]
# updating internal scene cache
exceptionIndexerCache
[
helpers
.
full_sanitizeSceneName
(
cur_exception
)]
=
cur_indexer_id
# if this exception isn't already in the DB then add it
if
cur_exception
not
in
existing_exceptions
:
myDB
.
action
(
"
INSERT INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?)
"
,
...
...
@@ -208,6 +204,9 @@ def retrieve_exceptions():
else
:
logger
.
log
(
u
"
No scene exceptions update needed
"
)
# build indexer scene name cache
buildIndexerCache
()
def
update_scene_exceptions
(
indexer_id
,
scene_exceptions
):
"""
Given a indexer_id, and a list of all show scene exceptions, update the db.
...
...
@@ -267,3 +266,18 @@ def getSceneSeasons(indexer_id):
myDB
=
db
.
DBConnection
(
"
cache.db
"
)
seasons
=
myDB
.
select
(
"
SELECT DISTINCT season FROM scene_exceptions WHERE indexer_id = ?
"
,
[
indexer_id
])
return
[
cur_exception
[
"
season
"
]
for
cur_exception
in
seasons
]
def
buildIndexerCache
():
logger
.
log
(
u
"
Updating internal scene name cache
"
,
logger
.
MESSAGE
)
global
exceptionIndexerCache
exceptionIndexerCache
=
{}
for
show
in
sickbeard
.
showList
:
for
curSeason
in
[
-
1
]
+
sickbeard
.
scene_exceptions
.
get_scene_seasons
(
show
.
indexerid
):
exceptionIndexerCache
[
helpers
.
full_sanitizeSceneName
(
show
.
name
)]
=
show
.
indexerid
for
name
in
get_scene_exceptions
(
show
.
indexerid
,
season
=
curSeason
):
exceptionIndexerCache
[
name
]
=
show
.
indexerid
exceptionIndexerCache
[
helpers
.
full_sanitizeSceneName
(
name
)]
=
show
.
indexerid
logger
.
log
(
u
"
Updated internal scene name cache
"
,
logger
.
MESSAGE
)
logger
.
log
(
u
"
Internal scene name cache set to:
"
+
str
(
exceptionIndexerCache
),
logger
.
DEBUG
)
\ No newline at end of file
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