Commit 44a0b2bb authored by echel0n's avatar echel0n
Browse files

Merge branch 'release/10.0.38'

parents a4055ed8 570d70c1
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
   
All notable changes to this project will be documented in this file. Dates are displayed in UTC. All notable changes to this project will be documented in this file. Dates are displayed in UTC.
   
#### [10.0.38](https://git.sickrage.ca/SiCKRAGE/sickrage/compare/10.0.37...10.0.38)
#### [10.0.37](https://git.sickrage.ca/SiCKRAGE/sickrage/compare/10.0.36...10.0.37) #### [10.0.37](https://git.sickrage.ca/SiCKRAGE/sickrage/compare/10.0.36...10.0.37)
   
> 3 September 2021
- Fixed cache database migration issues related to oauth2 and announcements tables [`d239c77`](https://git.sickrage.ca/SiCKRAGE/sickrage/commit/d239c773feb2eb41459451f1aaba95caf66816eb) - Fixed cache database migration issues related to oauth2 and announcements tables [`d239c77`](https://git.sickrage.ca/SiCKRAGE/sickrage/commit/d239c773feb2eb41459451f1aaba95caf66816eb)
   
#### [10.0.36](https://git.sickrage.ca/SiCKRAGE/sickrage/compare/10.0.35...10.0.36) #### [10.0.36](https://git.sickrage.ca/SiCKRAGE/sickrage/compare/10.0.35...10.0.36)
......
{ {
"name": "sickrage", "name": "sickrage",
"version": "10.0.37", "version": "10.0.38",
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
......
[bumpversion] [bumpversion]
current_version = 10.0.37 current_version = 10.0.38
commit = False commit = False
tag = False tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))? parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# along with SiCKRAGE. If not, see <http://www.gnu.org/licenses/>. # along with SiCKRAGE. If not, see <http://www.gnu.org/licenses/>.
# ############################################################################## # ##############################################################################
__version__ = "10.0.37" __version__ = "10.0.38"
__install_type__ = "" __install_type__ = ""
import argparse import argparse
......
This diff is collapsed.
...@@ -1518,7 +1518,7 @@ class CMD_SiCKRAGESearchSeriesProvider(ApiV1Handler): ...@@ -1518,7 +1518,7 @@ class CMD_SiCKRAGESearchSeriesProvider(ApiV1Handler):
results = [] results = []
series_provider = sickrage.app.series_providers[self.series_provider_id.upper()] series_provider = sickrage.app.series_providers[SeriesProviderID[self.series_provider_id.upper()]]
series_provider_language = self.lang or sickrage.app.config.general.series_provider_default_language series_provider_language = self.lang or sickrage.app.config.general.series_provider_default_language
if self.name and not self.series_id: # only name was given if self.name and not self.series_id: # only name was given
...@@ -1813,11 +1813,9 @@ class CMD_ShowAddExisting(ApiV1Handler): ...@@ -1813,11 +1813,9 @@ class CMD_ShowAddExisting(ApiV1Handler):
if not os.path.isdir(self.location): if not os.path.isdir(self.location):
return _responds(RESULT_FAILURE, msg='Not a valid location') return _responds(RESULT_FAILURE, msg='Not a valid location')
series_provider_id = SeriesProviderID[self.series_provider_id]
series_provider_result = CMD_SiCKRAGESearchSeriesProvider(self.application, self.request, **{ series_provider_result = CMD_SiCKRAGESearchSeriesProvider(self.application, self.request, **{
'series_id': self.series_id, 'series_id': self.series_id,
'series_provider_id': series_provider_id 'series_provider_id': self.series_provider_id
}).run() }).run()
series_name = None series_name = None
...@@ -1827,6 +1825,8 @@ class CMD_ShowAddExisting(ApiV1Handler): ...@@ -1827,6 +1825,8 @@ class CMD_ShowAddExisting(ApiV1Handler):
return _responds(RESULT_FAILURE, msg="Empty results returned, check series_id and try again") return _responds(RESULT_FAILURE, msg="Empty results returned, check series_id and try again")
if len(series_provider_result['data']['results']) == 1 and 'name' in series_provider_result['data']['results'][0]: if len(series_provider_result['data']['results']) == 1 and 'name' in series_provider_result['data']['results'][0]:
series_name = series_provider_result['data']['results'][0]['name'] series_name = series_provider_result['data']['results'][0]['name']
else:
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
first_aired = series_provider_result['data']['results'][0]['first_aired'] first_aired = series_provider_result['data']['results'][0]['first_aired']
...@@ -1849,7 +1849,7 @@ class CMD_ShowAddExisting(ApiV1Handler): ...@@ -1849,7 +1849,7 @@ class CMD_ShowAddExisting(ApiV1Handler):
newQuality = Quality.combine_qualities(iqualityID, aqualityID) newQuality = Quality.combine_qualities(iqualityID, aqualityID)
sickrage.app.show_queue.add_show( sickrage.app.show_queue.add_show(
series_provider_id=series_provider_id, series_id=int(self.series_id), show_dir=self.location, series_provider_id=SeriesProviderID[self.series_provider_id.upper()], series_id=int(self.series_id), showDir=self.location,
default_status=sickrage.app.config.general.status_default, quality=newQuality, flatten_folders=int(self.flatten_folders), default_status=sickrage.app.config.general.status_default, quality=newQuality, flatten_folders=int(self.flatten_folders),
subtitles=self.subtitles, default_status_after=sickrage.app.config.general.status_default_after, skip_downloaded=self.skip_downloaded subtitles=self.subtitles, default_status_after=sickrage.app.config.general.status_default_after, skip_downloaded=self.skip_downloaded
) )
...@@ -1958,11 +1958,9 @@ class CMD_ShowAddNew(ApiV1Handler): ...@@ -1958,11 +1958,9 @@ class CMD_ShowAddNew(ApiV1Handler):
return _responds(RESULT_FAILURE, msg="Status prohibited") return _responds(RESULT_FAILURE, msg="Status prohibited")
default_ep_status_after = self.future_status default_ep_status_after = self.future_status
series_provider_id = SeriesProviderID[self.series_provider_id]
series_provider_result = CMD_SiCKRAGESearchSeriesProvider(self.application, self.request, **{ series_provider_result = CMD_SiCKRAGESearchSeriesProvider(self.application, self.request, **{
'series_id': self.series_id, 'series_id': self.series_id,
'series_provider_id': series_provider_id 'series_provider_id': self.series_provider_id
}).run() }).run()
series_name = None series_name = None
...@@ -1972,6 +1970,8 @@ class CMD_ShowAddNew(ApiV1Handler): ...@@ -1972,6 +1970,8 @@ class CMD_ShowAddNew(ApiV1Handler):
return _responds(RESULT_FAILURE, msg="Empty results returned, check series_id and try again") return _responds(RESULT_FAILURE, msg="Empty results returned, check series_id and try again")
if len(series_provider_result['data']['results']) == 1 and 'name' in series_provider_result['data']['results'][0]: if len(series_provider_result['data']['results']) == 1 and 'name' in series_provider_result['data']['results'][0]:
series_name = series_provider_result['data']['results'][0]['name'] series_name = series_provider_result['data']['results'][0]['name']
else:
return _responds(RESULT_FAILURE, msg="Unable to retrieve information from indexer")
first_aired = series_provider_result['data']['results'][0]['first_aired'] first_aired = series_provider_result['data']['results'][0]['first_aired']
...@@ -1995,8 +1995,8 @@ class CMD_ShowAddNew(ApiV1Handler): ...@@ -1995,8 +1995,8 @@ class CMD_ShowAddNew(ApiV1Handler):
chmod_as_parent(show_path) chmod_as_parent(show_path)
sickrage.app.show_queue.add_show( sickrage.app.show_queue.add_show(
series_provider_id=series_provider_id, series_id=int(self.series_id), show_dir=show_path, default_status=new_status, quality=new_quality, series_provider_id=SeriesProviderID[self.series_provider_id.upper()], series_id=int(self.series_id), showDir=show_path, default_status=new_status,
flatten_folders=int(self.flatten_folders), lang=self.lang, subtitles=self.subtitles, anime=self.anime, scene=self.scene, quality=new_quality, flatten_folders=int(self.flatten_folders), lang=self.lang, subtitles=self.subtitles, anime=self.anime, scene=self.scene,
search_format=self.search_format, default_status_after=default_ep_status_after, skip_downloaded=self.skip_downloaded search_format=self.search_format, default_status_after=default_ep_status_after, skip_downloaded=self.skip_downloaded
) )
...@@ -2363,10 +2363,12 @@ class CMD_ShowSeasons(ApiV1Handler): ...@@ -2363,10 +2363,12 @@ class CMD_ShowSeasons(ApiV1Handler):
if episode_dict['airdate'] > datetime.date.min: if episode_dict['airdate'] > datetime.date.min:
dtEpisodeAirs = srdatetime.SRDateTime(sickrage.app.tz_updater.parse_date_time(episode_dict['airdate'], show_obj.airs, show_obj.network), dtEpisodeAirs = srdatetime.SRDateTime(sickrage.app.tz_updater.parse_date_time(episode_dict['airdate'], show_obj.airs, show_obj.network),
convert=True).dt convert=True).dt
episode_dict['airdate'] = srdatetime.SRDateTime(dtEpisodeAirs).srfdate(d_preset=dateFormat) episode_dict['airdate'] = str(srdatetime.SRDateTime(dtEpisodeAirs).srfdate(d_preset=dateFormat))
else: else:
episode_dict['airdate'] = 'Never' episode_dict['airdate'] = 'Never'
episode_dict['subtitles_lastsearch'] = str(episode_dict['subtitles_lastsearch'])
curSeason = int(episode_dict['season']) curSeason = int(episode_dict['season'])
curEpisode = int(episode_dict['episode']) curEpisode = int(episode_dict['episode'])
......
...@@ -29,11 +29,6 @@ class SeriesProviderShowCache(OrderedDict): ...@@ -29,11 +29,6 @@ class SeriesProviderShowCache(OrderedDict):
self.maxsize = 100 self.maxsize = 100
super(SeriesProviderShowCache, self).__init__(*args, **kwargs) super(SeriesProviderShowCache, self).__init__(*args, **kwargs)
def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
super(SeriesProviderShowCache, self).__setitem__(key, value)
while len(self) > self.maxsize:
self.pop(list(self.keys())[0], None)
def add_item(self, sid, seas, ep, attrib, value): def add_item(self, sid, seas, ep, attrib, value):
if sid not in self: if sid not in self:
self[sid] = SeriesProviderShow() self[sid] = SeriesProviderShow()
...@@ -49,6 +44,11 @@ class SeriesProviderShowCache(OrderedDict): ...@@ -49,6 +44,11 @@ class SeriesProviderShowCache(OrderedDict):
self[sid].data[key] = value self[sid].data[key] = value
def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
super(SeriesProviderShowCache, self).__setitem__(key, value)
while len(self) > self.maxsize:
self.pop(list(self.keys())[0], None)
class SeriesProviderShow(dict): class SeriesProviderShow(dict):
"""Holds a dict of seasons, and show data. """Holds a dict of seasons, and show data.
...@@ -58,6 +58,39 @@ class SeriesProviderShow(dict): ...@@ -58,6 +58,39 @@ class SeriesProviderShow(dict):
super(SeriesProviderShow, self).__init__(**kwargs) super(SeriesProviderShow, self).__init__(**kwargs)
self.data = {} self.data = {}
def get(self, key, default=None):
return getattr(self, key, default)
def aired_on(self, date):
ret = self.search(str(date), 'firstaired')
if len(ret) == 0:
sickrage.app.log.debug("Could not find any episodes on TheTVDB that aired on {}".format(date))
return None
return ret
def search(self, term=None, key=None):
"""
Search all episodes in show. Can search all data, or a specific key (for
example, episodename)
Always returns an array (can be empty). First index contains the first
match, and so on.
Each array index is an Episode() instance, so doing
search_results[0]['episodename'] will retrieve the episode name of the
first match.
Search terms are converted to lower case (unicode) strings.
"""
results = []
for cur_season in self.values():
searchresult = cur_season.search(term=term, key=key)
if len(searchresult) != 0:
results.extend(searchresult)
return results
def __getstate__(self): def __getstate__(self):
return self.__dict__ return self.__dict__
...@@ -99,42 +132,27 @@ class SeriesProviderShow(dict): ...@@ -99,42 +132,27 @@ class SeriesProviderShow(dict):
# doesn't exist, so attribute error. # doesn't exist, so attribute error.
raise SeriesProviderAttributeNotFound("Cannot find show attribute {}".format(repr(key))) raise SeriesProviderAttributeNotFound("Cannot find show attribute {}".format(repr(key)))
def aired_on(self, date):
ret = self.search(str(date), 'firstaired')
if len(ret) == 0:
sickrage.app.log.debug("Could not find any episodes on TheTVDB that aired on {}".format(date))
return None
return ret
def search(self, term=None, key=None): class SeriesProviderSeason(dict):
""" def __init__(self):
Search all episodes in show. Can search all data, or a specific key (for super(SeriesProviderSeason, self).__init__()
example, episodename) self.data = {}
Always returns an array (can be empty). First index contains the first
match, and so on.
Each array index is an Episode() instance, so doing def get(self, key, default=None):
search_results[0]['episodename'] will retrieve the episode name of the return getattr(self, key, default)
first match.
Search terms are converted to lower case (unicode) strings. def search(self, term=None, key=None):
"""Search all episodes in season, returns a list of matching Episode
instances.
""" """
results = [] results = []
for ep in self.values():
for cur_season in self.values(): result = ep.search(term=term, key=key)
searchresult = cur_season.search(term=term, key=key) if result is not None:
if len(searchresult) != 0: results.append(result)
results.extend(searchresult)
return results return results
class SeriesProviderSeason(dict):
def __init__(self):
super(SeriesProviderSeason, self).__init__()
self.data = {}
def __getstate__(self): def __getstate__(self):
return self.__dict__ return self.__dict__
...@@ -170,42 +188,13 @@ class SeriesProviderSeason(dict): ...@@ -170,42 +188,13 @@ class SeriesProviderSeason(dict):
else: else:
raise SeriesProviderAttributeNotFound("Cannot find season attribute {}".format(repr(key))) raise SeriesProviderAttributeNotFound("Cannot find season attribute {}".format(repr(key)))
def search(self, term=None, key=None):
"""Search all episodes in season, returns a list of matching Episode
instances.
"""
results = []
for ep in self.values():
result = ep.search(term=term, key=key)
if result is not None:
results.append(result)
return results
class SeriesProviderEpisode(dict): class SeriesProviderEpisode(dict):
def __init__(self): def __init__(self):
super(SeriesProviderEpisode, self).__init__() super(SeriesProviderEpisode, self).__init__()
def __repr__(self): def get(self, key, default=None):
seasno = int(self.get('airedseason', 0)) return getattr(self, key, default)
epno = int(self.get('airedepisodenumber', 0))
epname = self.get('episodename')
if epname is not None:
return "<Episode %02dx%02d - %s>" % (seasno, epno, epname)
else:
return "<Episode %02dx%02d>" % (seasno, epno)
def __getattr__(self, key):
if key in self:
return self[key]
raise AttributeError
def __getitem__(self, key):
try:
return dict.__getitem__(self, key)
except KeyError:
raise SeriesProviderAttributeNotFound("Cannot find episode attribute {}".format(repr(key)))
def search(self, term=None, key=None): def search(self, term=None, key=None):
"""Search episode data for term, if it matches, return the Episode (self). """Search episode data for term, if it matches, return the Episode (self).
...@@ -227,3 +216,23 @@ class SeriesProviderEpisode(dict): ...@@ -227,3 +216,23 @@ class SeriesProviderEpisode(dict):
continue continue
if cur_value.find(term.lower()) > -1: if cur_value.find(term.lower()) > -1:
return self return self
def __repr__(self):
seasno = int(self.get('airedseason', 0))
epno = int(self.get('airedepisodenumber', 0))
epname = self.get('episodename')
if epname is not None:
return "<Episode %02dx%02d - %s>" % (seasno, epno, epname)
else:
return "<Episode %02dx%02d>" % (seasno, epno)
def __getattr__(self, key):
if key in self:
return self[key]
raise AttributeError
def __getitem__(self, key):
try:
return dict.__getitem__(self, key)
except KeyError:
raise SeriesProviderAttributeNotFound("Cannot find episode attribute {}".format(repr(key)))
10.0.37 10.0.38
\ No newline at end of file \ No newline at end of file
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