Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage
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
Commits
35179525
Commit
35179525
authored
May 20, 2014
by
echel0n
Browse files
Options
Downloads
Patches
Plain Diff
Fix to insure pre-release downloads/snatches don't get reset back to unaired.
parent
76e8c73c
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/databases/mainDB.py
+24
-5
24 additions, 5 deletions
sickbeard/databases/mainDB.py
with
24 additions
and
5 deletions
sickbeard/databases/mainDB.py
+
24
−
5
View file @
35179525
...
@@ -29,6 +29,7 @@ from sickbeard.name_parser.parser import NameParser, InvalidNameException
...
@@ -29,6 +29,7 @@ from sickbeard.name_parser.parser import NameParser, InvalidNameException
MIN_DB_VERSION
=
9
# oldest db version we support migrating from
MIN_DB_VERSION
=
9
# oldest db version we support migrating from
MAX_DB_VERSION
=
31
MAX_DB_VERSION
=
31
class
MainSanityCheck
(
db
.
DBSanityCheck
):
class
MainSanityCheck
(
db
.
DBSanityCheck
):
def
check
(
self
):
def
check
(
self
):
self
.
fix_missing_table_indexes
()
self
.
fix_missing_table_indexes
()
...
@@ -129,13 +130,16 @@ class MainSanityCheck(db.DBSanityCheck):
...
@@ -129,13 +130,16 @@ class MainSanityCheck(db.DBSanityCheck):
curDate
=
datetime
.
date
.
today
()
curDate
=
datetime
.
date
.
today
()
sqlResults
=
self
.
connection
.
select
(
sqlResults
=
self
.
connection
.
select
(
"
SELECT episode_id, showid FROM tv_episodes WHERE airdate > ? AND status != ?
"
,
[
curDate
.
toordinal
(),
common
.
UNAIRED
])
"
SELECT episode_id, showid FROM tv_episodes WHERE airdate > ? AND status not in (?,?,?,?,?)
"
,
[
curDate
.
toordinal
(),
common
.
UNAIRED
,
common
.
DOWNLOADED
,
common
.
SNATCHED
,
common
.
SNATCHED_PROPER
,
common
.
SNATCHED_BEST
])
for
cur_orphan
in
sqlResults
:
for
cur_orphan
in
sqlResults
:
logger
.
log
(
u
"
UNAIRED episode detected! episode_id:
"
+
str
(
cur_orphan
[
"
episode_id
"
])
+
"
showid:
"
+
str
(
logger
.
log
(
u
"
UNAIRED episode detected! episode_id:
"
+
str
(
cur_orphan
[
"
episode_id
"
])
+
"
showid:
"
+
str
(
cur_orphan
[
"
showid
"
]),
logger
.
DEBUG
)
cur_orphan
[
"
showid
"
]),
logger
.
DEBUG
)
logger
.
log
(
u
"
Fixing unaired episode status with episode_id:
"
+
str
(
cur_orphan
[
"
episode_id
"
]))
logger
.
log
(
u
"
Fixing unaired episode status with episode_id:
"
+
str
(
cur_orphan
[
"
episode_id
"
]))
self
.
connection
.
action
(
"
UPDATE tv_episodes SET status = ? WHERE episode_id = ?
"
,
[
common
.
UNAIRED
,
cur_orphan
[
"
episode_id
"
]])
self
.
connection
.
action
(
"
UPDATE tv_episodes SET status = ? WHERE episode_id = ?
"
,
[
common
.
UNAIRED
,
cur_orphan
[
"
episode_id
"
]])
else
:
else
:
logger
.
log
(
u
"
No UNAIRED episodes, check passed
"
)
logger
.
log
(
u
"
No UNAIRED episodes, check passed
"
)
...
@@ -329,6 +333,7 @@ class RenameSeasonFolders(AddSizeAndSceneNameFields):
...
@@ -329,6 +333,7 @@ class RenameSeasonFolders(AddSizeAndSceneNameFields):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
Add1080pAndRawHDQualities
(
RenameSeasonFolders
):
class
Add1080pAndRawHDQualities
(
RenameSeasonFolders
):
"""
Add support for 1080p related qualities along with RawHD
"""
Add support for 1080p related qualities along with RawHD
...
@@ -463,6 +468,7 @@ class Add1080pAndRawHDQualities(RenameSeasonFolders):
...
@@ -463,6 +468,7 @@ class Add1080pAndRawHDQualities(RenameSeasonFolders):
logger
.
log
(
u
"
Performing a vacuum on the database.
"
,
logger
.
DEBUG
)
logger
.
log
(
u
"
Performing a vacuum on the database.
"
,
logger
.
DEBUG
)
self
.
connection
.
action
(
"
VACUUM
"
)
self
.
connection
.
action
(
"
VACUUM
"
)
class
AddShowidTvdbidIndex
(
Add1080pAndRawHDQualities
):
class
AddShowidTvdbidIndex
(
Add1080pAndRawHDQualities
):
"""
Adding index on tvdb_id (tv_shows) and showid (tv_episodes) to speed up searches/queries
"""
"""
Adding index on tvdb_id (tv_shows) and showid (tv_episodes) to speed up searches/queries
"""
...
@@ -483,6 +489,7 @@ class AddShowidTvdbidIndex(Add1080pAndRawHDQualities):
...
@@ -483,6 +489,7 @@ class AddShowidTvdbidIndex(Add1080pAndRawHDQualities):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddLastUpdateTVDB
(
AddShowidTvdbidIndex
):
class
AddLastUpdateTVDB
(
AddShowidTvdbidIndex
):
"""
Adding column last_update_tvdb to tv_shows for controlling nightly updates
"""
"""
Adding column last_update_tvdb to tv_shows for controlling nightly updates
"""
...
@@ -498,14 +505,15 @@ class AddLastUpdateTVDB(AddShowidTvdbidIndex):
...
@@ -498,14 +505,15 @@ class AddLastUpdateTVDB(AddShowidTvdbidIndex):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddDBIncreaseTo15
(
AddLastUpdateTVDB
):
class
AddDBIncreaseTo15
(
AddLastUpdateTVDB
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
15
return
self
.
checkDBVersion
()
>=
15
def
execute
(
self
):
def
execute
(
self
):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddIMDbInfo
(
AddDBIncreaseTo15
):
class
AddIMDbInfo
(
AddDBIncreaseTo15
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
16
return
self
.
checkDBVersion
()
>=
16
...
@@ -519,6 +527,7 @@ class AddIMDbInfo(AddDBIncreaseTo15):
...
@@ -519,6 +527,7 @@ class AddIMDbInfo(AddDBIncreaseTo15):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddProperNamingSupport
(
AddIMDbInfo
):
class
AddProperNamingSupport
(
AddIMDbInfo
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
17
return
self
.
checkDBVersion
()
>=
17
...
@@ -536,6 +545,7 @@ class AddEmailSubscriptionTable(AddProperNamingSupport):
...
@@ -536,6 +545,7 @@ class AddEmailSubscriptionTable(AddProperNamingSupport):
self
.
addColumn
(
'
tv_shows
'
,
'
notify_list
'
,
'
TEXT
'
,
None
)
self
.
addColumn
(
'
tv_shows
'
,
'
notify_list
'
,
'
TEXT
'
,
None
)
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddProperSearch
(
AddEmailSubscriptionTable
):
class
AddProperSearch
(
AddEmailSubscriptionTable
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
19
return
self
.
checkDBVersion
()
>=
19
...
@@ -561,6 +571,7 @@ class AddDvdOrderOption(AddProperSearch):
...
@@ -561,6 +571,7 @@ class AddDvdOrderOption(AddProperSearch):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddSubtitlesSupport
(
AddDvdOrderOption
):
class
AddSubtitlesSupport
(
AddDvdOrderOption
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
21
return
self
.
checkDBVersion
()
>=
21
...
@@ -573,6 +584,7 @@ class AddSubtitlesSupport(AddDvdOrderOption):
...
@@ -573,6 +584,7 @@ class AddSubtitlesSupport(AddDvdOrderOption):
self
.
addColumn
(
"
tv_episodes
"
,
"
subtitles_lastsearch
"
,
"
TIMESTAMP
"
,
str
(
datetime
.
datetime
.
min
))
self
.
addColumn
(
"
tv_episodes
"
,
"
subtitles_lastsearch
"
,
"
TIMESTAMP
"
,
str
(
datetime
.
datetime
.
min
))
self
.
incDBVersion
()
self
.
incDBVersion
()
class
ConvertTVShowsToIndexerScheme
(
AddSubtitlesSupport
):
class
ConvertTVShowsToIndexerScheme
(
AddSubtitlesSupport
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
22
return
self
.
checkDBVersion
()
>=
22
...
@@ -677,6 +689,7 @@ class ConvertInfoToIndexerScheme(ConvertIMDBInfoToIndexerScheme):
...
@@ -677,6 +689,7 @@ class ConvertInfoToIndexerScheme(ConvertIMDBInfoToIndexerScheme):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddArchiveFirstMatchOption
(
ConvertInfoToIndexerScheme
):
class
AddArchiveFirstMatchOption
(
ConvertInfoToIndexerScheme
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
26
return
self
.
checkDBVersion
()
>=
26
...
@@ -690,6 +703,7 @@ class AddArchiveFirstMatchOption(ConvertInfoToIndexerScheme):
...
@@ -690,6 +703,7 @@ class AddArchiveFirstMatchOption(ConvertInfoToIndexerScheme):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddSceneNumbering
(
AddArchiveFirstMatchOption
):
class
AddSceneNumbering
(
AddArchiveFirstMatchOption
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
27
return
self
.
checkDBVersion
()
>=
27
...
@@ -726,6 +740,7 @@ class ConvertIndexerToInteger(AddSceneNumbering):
...
@@ -726,6 +740,7 @@ class ConvertIndexerToInteger(AddSceneNumbering):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddRequireAndIgnoreWords
(
ConvertIndexerToInteger
):
class
AddRequireAndIgnoreWords
(
ConvertIndexerToInteger
):
"""
Adding column rls_require_words and rls_ignore_words to tv_shows
"""
"""
Adding column rls_require_words and rls_ignore_words to tv_shows
"""
...
@@ -745,6 +760,7 @@ class AddRequireAndIgnoreWords(ConvertIndexerToInteger):
...
@@ -745,6 +760,7 @@ class AddRequireAndIgnoreWords(ConvertIndexerToInteger):
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddSportsOption
(
AddRequireAndIgnoreWords
):
class
AddSportsOption
(
AddRequireAndIgnoreWords
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
30
return
self
.
checkDBVersion
()
>=
30
...
@@ -760,14 +776,17 @@ class AddSportsOption(AddRequireAndIgnoreWords):
...
@@ -760,14 +776,17 @@ class AddSportsOption(AddRequireAndIgnoreWords):
# update sports column
# update sports column
logger
.
log
(
u
"
[4/4] Updating tv_shows to reflect the correct sports value...
"
,
logger
.
MESSAGE
)
logger
.
log
(
u
"
[4/4] Updating tv_shows to reflect the correct sports value...
"
,
logger
.
MESSAGE
)
ql
=
[]
ql
=
[]
historyQuality
=
self
.
connection
.
select
(
"
SELECT * FROM tv_shows WHERE LOWER(classification) =
'
sports
'
AND air_by_date = 1 AND sports = 0
"
)
historyQuality
=
self
.
connection
.
select
(
"
SELECT * FROM tv_shows WHERE LOWER(classification) =
'
sports
'
AND air_by_date = 1 AND sports = 0
"
)
for
cur_entry
in
historyQuality
:
for
cur_entry
in
historyQuality
:
ql
.
append
([
"
UPDATE tv_shows SET sports = ? WHERE show_id = ?
"
,
[
cur_entry
[
"
air_by_date
"
],
cur_entry
[
"
show_id
"
]]])
ql
.
append
([
"
UPDATE tv_shows SET sports = ? WHERE show_id = ?
"
,
[
cur_entry
[
"
air_by_date
"
],
cur_entry
[
"
show_id
"
]]])
ql
.
append
([
"
UPDATE tv_shows SET air_by_date = 0 WHERE show_id = ?
"
,
[
cur_entry
[
"
show_id
"
]]])
ql
.
append
([
"
UPDATE tv_shows SET air_by_date = 0 WHERE show_id = ?
"
,
[
cur_entry
[
"
show_id
"
]]])
self
.
connection
.
mass_action
(
ql
)
self
.
connection
.
mass_action
(
ql
)
self
.
incDBVersion
()
self
.
incDBVersion
()
class
AddSceneNumberingToTvEpisodes
(
AddSportsOption
):
class
AddSceneNumberingToTvEpisodes
(
AddSportsOption
):
def
test
(
self
):
def
test
(
self
):
return
self
.
checkDBVersion
()
>=
31
return
self
.
checkDBVersion
()
>=
31
...
...
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