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
2094f0d1
Commit
2094f0d1
authored
Dec 11, 2015
by
miigotu
Browse files
Options
Downloads
Patches
Plain Diff
Make sure subtitle last_search for an episode is convertible to datetime
parent
bb244c55
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/subtitles.py
+22
-22
22 additions, 22 deletions
sickbeard/subtitles.py
with
22 additions
and
22 deletions
sickbeard/subtitles.py
+
22
−
22
View file @
2094f0d1
...
@@ -396,7 +396,7 @@ class SubtitlesFinder(object):
...
@@ -396,7 +396,7 @@ class SubtitlesFinder(object):
logger
.
log
(
u
"
Starting post-process with default settings now that we found subtitles
"
)
logger
.
log
(
u
"
Starting post-process with default settings now that we found subtitles
"
)
processTV
.
processDir
(
sickbeard
.
TV_DOWNLOAD_DIR
)
processTV
.
processDir
(
sickbeard
.
TV_DOWNLOAD_DIR
)
def
run
(
self
,
force
=
False
):
# pylint: disable=unused-argument
def
run
(
self
,
force
=
False
):
# pylint: disable=unused-argument
,too-many-statements,too-many-branches
if
not
sickbeard
.
USE_SUBTITLES
:
if
not
sickbeard
.
USE_SUBTITLES
:
return
return
...
@@ -420,6 +420,13 @@ class SubtitlesFinder(object):
...
@@ -420,6 +420,13 @@ class SubtitlesFinder(object):
# - search count < 2 and diff(airdate, now) > 1 week : now -> 1d
# - search count < 2 and diff(airdate, now) > 1 week : now -> 1d
# - search count < 7 and diff(airdate, now) <= 1 week : now -> 4h -> 8h -> 16h -> 1d -> 1d -> 1d
# - search count < 7 and diff(airdate, now) <= 1 week : now -> 4h -> 8h -> 16h -> 1d -> 1d -> 1d
"""
Defines the hours to wait between 2 subtitles search depending on:
- the episode: new or old
- the number of searches done so far (searchcount), represented by the index of the list
"""
rules
=
{
'
old
'
:
[
0
,
24
],
'
new
'
:
[
0
,
4
,
8
,
4
,
16
,
24
,
24
]}
today
=
datetime
.
date
.
today
().
toordinal
()
today
=
datetime
.
date
.
today
().
toordinal
()
database
=
db
.
DBConnection
()
database
=
db
.
DBConnection
()
...
@@ -437,7 +444,6 @@ class SubtitlesFinder(object):
...
@@ -437,7 +444,6 @@ class SubtitlesFinder(object):
self
.
amActive
=
False
self
.
amActive
=
False
return
return
rules
=
self
.
_get_rules
()
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
datetime
.
now
()
for
ep_to_sub
in
sql_results
:
for
ep_to_sub
in
sql_results
:
...
@@ -453,12 +459,15 @@ class SubtitlesFinder(object):
...
@@ -453,12 +459,15 @@ class SubtitlesFinder(object):
continue
continue
try
:
try
:
try
:
lastsearched
=
datetime
.
datetime
.
strptime
(
ep_to_sub
[
'
lastsearch
'
],
dateTimeFormat
)
except
ValueError
:
lastsearched
=
datetime
.
datetime
.
min
if
((
ep_to_sub
[
'
airdate_daydiff
'
]
>
7
and
ep_to_sub
[
'
searchcount
'
]
<
2
and
if
((
ep_to_sub
[
'
airdate_daydiff
'
]
>
7
and
ep_to_sub
[
'
searchcount
'
]
<
2
and
now
-
datetime
.
datetime
.
strptime
(
ep_to_sub
[
'
lastsearch
'
],
dateTimeFormat
)
>
now
-
lastsearched
>
datetime
.
timedelta
(
hours
=
rules
[
'
old
'
][
ep_to_sub
[
'
searchcount
'
]]))
or
datetime
.
timedelta
(
hours
=
rules
[
'
old
'
][
ep_to_sub
[
'
searchcount
'
]]))
or
(
ep_to_sub
[
'
airdate_daydiff
'
]
<=
7
and
ep_to_sub
[
'
searchcount
'
]
<
7
and
(
ep_to_sub
[
'
airdate_daydiff
'
]
<=
7
and
ep_to_sub
[
'
searchcount
'
]
<
7
and
now
-
datetime
.
datetime
.
strptime
(
ep_to_sub
[
'
lastsearch
'
],
dateTimeFormat
)
>
now
-
lastsearched
>
datetime
.
timedelta
(
hours
=
rules
[
'
new
'
][
ep_to_sub
[
'
searchcount
'
]]))):
datetime
.
timedelta
(
hours
=
rules
[
'
new
'
][
ep_to_sub
[
'
searchcount
'
]]))):
logger
.
log
(
u
'
Downloading subtitles for %s S%02dE%02d
'
logger
.
log
(
u
'
Downloading subtitles for %s S%02dE%02d
'
%
(
ep_to_sub
[
'
show_name
'
],
ep_to_sub
[
'
season
'
],
ep_to_sub
[
'
episode
'
]),
logger
.
DEBUG
)
%
(
ep_to_sub
[
'
show_name
'
],
ep_to_sub
[
'
season
'
],
ep_to_sub
[
'
episode
'
]),
logger
.
DEBUG
)
...
@@ -495,15 +504,6 @@ class SubtitlesFinder(object):
...
@@ -495,15 +504,6 @@ class SubtitlesFinder(object):
self
.
amActive
=
False
self
.
amActive
=
False
@staticmethod
def
_get_rules
():
"""
Define the hours to wait between 2 subtitles search depending on:
- the episode: new or old
- the number of searches done so far (searchcount), represented by the index of the list
"""
return
{
'
old
'
:
[
0
,
24
],
'
new
'
:
[
0
,
4
,
8
,
4
,
16
,
24
,
24
]}
def
run_subs_extra_scripts
(
episode_object
,
found_subtitles
,
video
,
single
=
False
):
def
run_subs_extra_scripts
(
episode_object
,
found_subtitles
,
video
,
single
=
False
):
...
...
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