Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sick-Beard
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
Sick-Beard
Commits
e0e8f0e7
Commit
e0e8f0e7
authored
Jun 30, 2011
by
Nic Wolfe
Browse files
Options
Downloads
Patches
Plain Diff
Search newznab providers with exception names too
parent
c134784e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sickbeard/providers/newznab.py
+50
-22
50 additions, 22 deletions
sickbeard/providers/newznab.py
with
50 additions
and
22 deletions
sickbeard/providers/newznab.py
+
50
−
22
View file @
e0e8f0e7
...
@@ -30,6 +30,7 @@ import generic
...
@@ -30,6 +30,7 @@ import generic
from
sickbeard
import
classes
from
sickbeard
import
classes
from
sickbeard.helpers
import
sanitizeSceneName
from
sickbeard.helpers
import
sanitizeSceneName
from
sickbeard
import
scene_exceptions
from
sickbeard
import
encodingKludge
as
ek
from
sickbeard
import
encodingKludge
as
ek
from
sickbeard
import
exceptions
from
sickbeard
import
exceptions
...
@@ -69,37 +70,47 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -69,37 +70,47 @@ class NewznabProvider(generic.NZBProvider):
def
_get_season_search_strings
(
self
,
show
,
season
=
None
):
def
_get_season_search_strings
(
self
,
show
,
season
=
None
):
params
=
{}
if
not
show
:
if
not
show
:
return
params
return
[{}]
to_return
=
[]
# add new query strings for exceptions
name_exceptions
=
scene_exceptions
.
get_scene_exceptions
(
show
.
tvdbid
)
for
cur_exception
in
name_exceptions
:
cur_params
=
{}
# search directly by tvrage id
# search directly by tvrage id
if
show
.
tvrid
:
if
show
.
tvrid
:
params
[
'
rid
'
]
=
show
.
tvrid
cur_
params
[
'
rid
'
]
=
show
.
tvrid
# if we can't then fall back on a very basic name search
# if we can't then fall back on a very basic name search
else
:
else
:
params
[
'
q
'
]
=
sanitizeSceneName
(
show
.
name
)
cur_
params
[
'
q
'
]
=
sanitizeSceneName
(
cur_exception
)
if
season
!=
None
:
if
season
!=
None
:
# air-by-date means &season=2010&q=2010.03, no other way to do it atm
# air-by-date means &season=2010&q=2010.03, no other way to do it atm
if
show
.
air_by_date
:
if
show
.
air_by_date
:
params
[
'
season
'
]
=
season
.
split
(
'
-
'
)[
0
]
cur_
params
[
'
season
'
]
=
season
.
split
(
'
-
'
)[
0
]
if
'
q
'
in
params
:
if
'
q
'
in
cur_
params
:
params
[
'
q
'
]
+=
'
.
'
+
season
.
replace
(
'
-
'
,
'
.
'
)
cur_
params
[
'
q
'
]
+=
'
.
'
+
season
.
replace
(
'
-
'
,
'
.
'
)
else
:
else
:
params
[
'
q
'
]
=
season
.
replace
(
'
-
'
,
'
.
'
)
cur_
params
[
'
q
'
]
=
season
.
replace
(
'
-
'
,
'
.
'
)
else
:
else
:
params
[
'
season
'
]
=
season
cur_
params
[
'
season
'
]
=
season
return
[
params
]
# hack to only add a single result if it's a rageid search
if
not
(
'
rid
'
in
cur_params
and
to_return
):
to_return
.
append
(
cur_params
)
return
to_return
def
_get_episode_search_strings
(
self
,
ep_obj
):
def
_get_episode_search_strings
(
self
,
ep_obj
):
params
=
{}
params
=
{}
if
not
ep_obj
:
if
not
ep_obj
:
return
params
return
[
params
]
# search directly by tvrage id
# search directly by tvrage id
if
ep_obj
.
show
.
tvrid
:
if
ep_obj
.
show
.
tvrid
:
...
@@ -117,7 +128,24 @@ class NewznabProvider(generic.NZBProvider):
...
@@ -117,7 +128,24 @@ class NewznabProvider(generic.NZBProvider):
params
[
'
season
'
]
=
ep_obj
.
season
params
[
'
season
'
]
=
ep_obj
.
season
params
[
'
ep
'
]
=
ep_obj
.
episode
params
[
'
ep
'
]
=
ep_obj
.
episode
return
[
params
]
to_return
=
[
params
]
# only do exceptions if we are searching by name
if
'
q
'
in
params
:
# add new query strings for exceptions
name_exceptions
=
scene_exceptions
.
get_scene_exceptions
(
ep_obj
.
show
.
tvdbid
)
for
cur_exception
in
name_exceptions
:
# don't add duplicates
if
cur_exception
==
ep_obj
.
show
.
name
:
continue
cur_return
=
params
.
copy
()
cur_return
[
'
q
'
]
=
sanitizeSceneName
(
cur_exception
)
to_return
.
append
(
cur_return
)
return
to_return
def
_doGeneralSearch
(
self
,
search_string
):
def
_doGeneralSearch
(
self
,
search_string
):
return
self
.
_doSearch
({
'
q
'
:
search_string
})
return
self
.
_doSearch
({
'
q
'
:
search_string
})
...
...
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