Commit d3507edb authored by echel0n's avatar echel0n
Browse files

Merge branch 'release/9.3.68'

parents ee09ea44 51f6fb2d
# Changelog
- * 8579fd7 - 2018-09-01: Release v9.3.67
- * 14eb31c - 2018-09-04: Release v9.3.68
- * 78d23e1 - 2018-09-04: Added 'tv_episodes_by_indexerid' database index. Added database test case. Fixed TV episode database upsert code. Misc variable name cleanup.
- * c11dace - 2018-09-01: Release v9.3.67
- * 1430717 - 2018-09-01: Fixed issue #255 - total episode count incorrect. Improved memory usage from database calls. Misc code cleanup.
- * 569f95c - 2018-09-01: Release v9.3.66
- * 33b3f9c - 2018-09-01: Disabled changelog from popping after a new update
......
......@@ -315,18 +315,10 @@ class srDatabase(object):
os.rename(self.old_db_path + '-shm', '{}-shm.{}_old'.format(self.old_db_path, random))
def all(self, *args, **kwargs):
data = [x['doc'] for x in self.db.all(with_doc=True, *args, **kwargs)]
while True:
if not len(data):
break
yield data.pop()
return (x['doc'] for x in self.db.all(with_doc=True, *args, **kwargs))
def get_many(self, *args, **kwargs):
data = [x['doc'] for x in self.db.get_many(with_doc=True, *args, **kwargs)]
while True:
if not len(data):
break
yield data.pop()
return (x['doc'] for x in self.db.get_many(with_doc=True, *args, **kwargs))
def get(self, *args, **kwargs):
x = self.db.get(with_doc=True, *args, **kwargs)
......
......@@ -24,7 +24,8 @@ import sickrage
from sickrage.core.databases import srDatabase
from sickrage.core.databases.main.index import MainTVShowsIndex, MainTVEpisodesIndex, MainIMDBInfoIndex, \
MainXEMRefreshIndex, MainSceneNumberingIndex, MainIndexerMappingIndex, MainHistoryIndex, \
MainBlacklistIndex, MainWhitelistIndex, MainFailedSnatchHistoryIndex, MainFailedSnatchesIndex, MainVersionIndex
MainBlacklistIndex, MainWhitelistIndex, MainFailedSnatchHistoryIndex, MainFailedSnatchesIndex, MainVersionIndex, \
MainTVEpisodesByIndexerIDIndex
class MainDB(srDatabase):
......@@ -34,6 +35,7 @@ class MainDB(srDatabase):
'version': MainVersionIndex,
'tv_shows': MainTVShowsIndex,
'tv_episodes': MainTVEpisodesIndex,
'tv_episodes_by_indexerid': MainTVEpisodesByIndexerIDIndex,
'imdb_info': MainIMDBInfoIndex,
'xem_refresh': MainXEMRefreshIndex,
'scene_numbering': MainSceneNumberingIndex,
......
......@@ -37,6 +37,7 @@ class MainVersionIndex(HashIndex):
if data.get('_t') == 'version' and data.get('database_version'):
return data.get('database_version'), None
class MainTVShowsIndex(HashIndex):
_version = 1
......@@ -67,6 +68,21 @@ class MainTVEpisodesIndex(HashIndex):
return data.get('showid'), None
class MainTVEpisodesByIndexerIDIndex(HashIndex):
_version = 1
def __init__(self, *args, **kwargs):
kwargs['key_format'] = 'I'
super(MainTVEpisodesByIndexerIDIndex, self).__init__(*args, **kwargs)
def make_key(self, key):
return key
def make_key_value(self, data):
if data.get('_t') == 'tv_episodes' and data.get('indexerid'):
return data.get('indexerid'), None
class MainIMDBInfoIndex(HashIndex):
_version = 1
......
......@@ -39,10 +39,10 @@ MANUAL_SEARCH_HISTORY = []
MANUAL_SEARCH_HISTORY_SIZE = 100
def fifo(myList, item, maxSize=100):
if len(myList) >= maxSize:
myList.pop(0)
myList.append(item)
def fifo(my_list, item, max_size=100):
if len(my_list) >= max_size:
my_list.pop(0)
my_list.append(item)
class SearchQueue(srQueue):
......
......@@ -92,7 +92,7 @@ class BacklogSearcher(object):
# go through non air-by-date shows and see if they need any episodes
for curShow in show_list:
if curShow.paused:
sickrage.app.log.debug("Skipping backlog for {} because the show is paused".format(curShow.name))
sickrage.app.log.debug("Skipping search for {} because the show is paused".format(curShow.name))
continue
self._last_backlog_search = self._get_last_backlog_search(curShow.indexerid)
......
......@@ -52,6 +52,7 @@ class DailySearcher(object):
for curShow in sickrage.app.showlist:
if curShow.paused:
sickrage.app.log.debug("Skipping search for {} because the show is paused".format(curShow.name))
continue
segments = self._get_segments(curShow, datetime.date.today())
......@@ -73,10 +74,6 @@ class DailySearcher(object):
wanted = []
if show.paused:
sickrage.app.log.debug("Not checking for episodes of {} because the show is paused".format(show.name))
return wanted
anyQualities, bestQualities = Quality.splitQuality(show.quality)
allQualities = list(set(anyQualities + bestQualities))
......
......@@ -25,6 +25,8 @@ import threading
from collections import OrderedDict
from xml.etree.ElementTree import ElementTree
from CodernityDB.database import RecordNotFound
import sickrage
from sickrage.core.common import Quality, UNKNOWN, UNAIRED, statusStrings, dateTimeFormat, SKIPPED, NAMING_EXTEND, \
NAMING_LIMITED_EXTEND, NAMING_LIMITED_EXTEND_E_PREFIXED, NAMING_DUPLICATE, NAMING_SEPARATED_REPEAT
......@@ -533,8 +535,8 @@ class TVEpisode(object):
# don't update show status if show dir is missing, unless it's missing on purpose
if not os.path.isdir(
self.show.location) and not sickrage.app.config.create_missing_show_dirs and not sickrage.app.config.add_shows_wo_dir:
sickrage.app.log.info(
"The show dir %s is missing, not bothering to change the episode statuses since it'd probably be invalid" % self.show.location)
sickrage.app.log.info("The show dir %s is missing, not bothering to change the episode statuses since "
"it'd probably be invalid" % self.show.location)
return False
if self.location:
......@@ -549,7 +551,8 @@ class TVEpisode(object):
UNAIRED])
self.status = UNAIRED
elif self.status in [UNAIRED, UNKNOWN]:
# Only do UNAIRED/UNKNOWN, it could already be snatched/ignored/skipped, or downloaded/archived to disconnected media
# Only do UNAIRED/UNKNOWN, it could already be snatched/ignored/skipped, or downloaded/archived to
# disconnected media
sickrage.app.log.debug(
"Episode has already aired, marking it %s" % statusStrings[self.show.default_ep_status])
self.status = self.show.default_ep_status if self.season > 0 else SKIPPED # auto-skip specials
......@@ -730,15 +733,15 @@ class TVEpisode(object):
raise EpisodeDeletedException()
def saveToDB(self, forceSave=False):
def saveToDB(self, force_save=False):
"""
Saves this episode to the database if any of its data has been changed since the last save.
forceSave: If True it will save to the database even if no data has been changed since the
force_save: If True it will save to the database even if no data has been changed since the
last save (aka if the record is not dirty).
"""
if not self.dirty and not forceSave:
if not self.dirty and not force_save:
return
sickrage.app.log.debug("%i: Saving episode to database: %s" % (self.show.indexerid, self.name))
......@@ -772,12 +775,10 @@ class TVEpisode(object):
}
try:
dbData = [x for x in sickrage.app.main_db.get_many('tv_episodes', self.show.indexerid)
if x['indexerid'] == self.indexerid][0]
dbData = sickrage.app.main_db.get('tv_episodes_by_indexerid', self.indexerid)
dbData.update(tv_episode)
sickrage.app.main_db.update(dbData)
except:
except RecordNotFound:
sickrage.app.main_db.insert(tv_episode)
def fullPath(self):
......
......@@ -731,6 +731,7 @@ class TVShow(object):
# need some examples of wtf episode 0 means to decide if we want it or not
if episode == 0:
continue
try:
curEp = self.getEpisode(season, episode)
except EpisodeNotFoundException:
......@@ -1214,9 +1215,8 @@ class TVShow(object):
"%s: Error occurred when downloading subtitles for %s" % (self.indexerid, self.name))
sickrage.app.log.error(traceback.format_exc())
def saveToDB(self, forceSave=False):
if not self.dirty and not forceSave:
def saveToDB(self, force_save=False):
if not self.dirty and not force_save:
return
sickrage.app.log.debug("%i: Saving show to database: %s" % (self.indexerid, self.name))
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-09-01 21:40-0700\n"
"PO-Revision-Date: 2018-09-02 04:40\n"
"POT-Creation-Date: 2018-09-04 22:06-0700\n"
"PO-Revision-Date: 2018-09-05 05:06\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Arabic\n"
"MIME-Version: 1.0\n"
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-09-01 21:40-0700\n"
"PO-Revision-Date: 2018-09-02 04:41\n"
"POT-Creation-Date: 2018-09-04 22:06-0700\n"
"PO-Revision-Date: 2018-09-05 05:06\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Catalan\n"
"MIME-Version: 1.0\n"
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-09-01 21:40-0700\n"
"PO-Revision-Date: 2018-09-02 04:41\n"
"POT-Creation-Date: 2018-09-04 22:06-0700\n"
"PO-Revision-Date: 2018-09-05 05:06\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Czech\n"
"MIME-Version: 1.0\n"
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-09-01 21:40-0700\n"
"PO-Revision-Date: 2018-09-02 04:41\n"
"POT-Creation-Date: 2018-09-04 22:06-0700\n"
"PO-Revision-Date: 2018-09-05 05:06\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Danish\n"
"MIME-Version: 1.0\n"
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-09-01 21:40-0700\n"
"PO-Revision-Date: 2018-09-02 04:41\n"
"POT-Creation-Date: 2018-09-04 22:06-0700\n"
"PO-Revision-Date: 2018-09-05 05:07\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment