mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 03:22:22 -05:00
Change API now uses Timezone setting at General Config/Interface/User Interface/ at relevant endpoints
This commit is contained in:
parent
5d89270d29
commit
ae94ab6d80
@ -49,6 +49,7 @@
|
||||
* Fix and repositioned show_message on display show to use bootstrap styling
|
||||
* Remove commented out html from display show accidently left in during UI changes
|
||||
* Fix display issue of season tables in displayShow view / Display Specials
|
||||
* Change API now uses Timezone setting at General Config/Interface/User Interface/ at relevant endpoints
|
||||
|
||||
|
||||
### 0.2.1 (2014-10-22 06:41:00 UTC)
|
||||
@ -79,4 +80,4 @@
|
||||
|
||||
### 0.1.0 (2014-10-16 12:35:15 UTC)
|
||||
|
||||
* Initial release
|
||||
* Initial release
|
||||
|
@ -34,6 +34,7 @@ from sickbeard import search_queue
|
||||
from sickbeard import image_cache
|
||||
from sickbeard import classes
|
||||
from sickbeard import processTV
|
||||
from sickbeard import network_timezones, sbdatetime
|
||||
from sickbeard.exceptions import ex
|
||||
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
||||
from common import Quality, qualityPresetStrings, statusStrings
|
||||
@ -47,6 +48,7 @@ from lib import subliminal
|
||||
|
||||
dateFormat = "%Y-%m-%d"
|
||||
dateTimeFormat = "%Y-%m-%d %H:%M"
|
||||
timeFormat = '%A %I:%M %p'
|
||||
|
||||
RESULT_SUCCESS = 10 # only use inside the run methods
|
||||
RESULT_FAILURE = 20 # only use inside the run methods
|
||||
@ -773,6 +775,10 @@ class CMD_ComingEpisodes(ApiCall):
|
||||
if ep["paused"] and not self.paused:
|
||||
continue
|
||||
|
||||
ep['airs'] = str(ep['airs']).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
|
||||
dtEpisodeAirs = network_timezones.parse_date_time(int(ep['airdate']), ep['airs'], ep['network'])
|
||||
ep['airdate'] = dtEpisodeAirs.toordinal()
|
||||
|
||||
status = "soon"
|
||||
if ep["airdate"] < today:
|
||||
status = "missed"
|
||||
@ -785,20 +791,20 @@ class CMD_ComingEpisodes(ApiCall):
|
||||
status = "soon"
|
||||
|
||||
# skip unwanted
|
||||
if self.type != None and not status in self.type:
|
||||
if self.type is not None and not status in self.type:
|
||||
continue
|
||||
|
||||
ordinalAirdate = int(ep["airdate"])
|
||||
if not ep["network"]:
|
||||
ep["network"] = ""
|
||||
ep["airdate"] = _ordinal_to_dateForm(ordinalAirdate)
|
||||
|
||||
ep["quality"] = _get_quality_string(ep["quality"])
|
||||
# clean up tvdb horrible airs field
|
||||
ep["airs"] = str(ep["airs"]).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
|
||||
ep['airs'] = sbdatetime.sbdatetime.sbftime(dtEpisodeAirs, t_preset=timeFormat).lstrip('0').replace(' 0', ' ')
|
||||
# start day of the week on 1 (monday)
|
||||
ep["weekday"] = 1 + datetime.date.fromordinal(ordinalAirdate).weekday()
|
||||
ep['weekday'] = 1 + datetime.date.fromordinal(dtEpisodeAirs.toordinal()).weekday()
|
||||
# Add tvdbid for backward compability
|
||||
ep["tvdbid"] = ep['indexerid']
|
||||
ep['airdate'] = sbdatetime.sbdatetime.sbfdate(dtEpisodeAirs, d_preset=dateFormat)
|
||||
|
||||
# TODO: check if this obsolete
|
||||
if not status in finalEpResults:
|
||||
@ -860,7 +866,7 @@ class CMD_Episode(ApiCall):
|
||||
elif not showPath: # show dir is broken ... episode path will be empty
|
||||
episode["location"] = ""
|
||||
# convert stuff to human form
|
||||
episode["airdate"] = _ordinal_to_dateForm(episode["airdate"])
|
||||
episode['airdate'] = sbdatetime.sbdatetime.sbfdate(network_timezones.parse_date_time(int(episode['airdate']), showObj.airs, showObj.network), d_preset=dateFormat)
|
||||
status, quality = Quality.splitCompositeStatus(int(episode["status"]))
|
||||
episode["status"] = _get_status_Strings(status)
|
||||
episode["quality"] = _get_quality_string(quality)
|
||||
@ -1803,13 +1809,12 @@ class CMD_Show(ApiCall):
|
||||
showDict["network"] = ""
|
||||
showDict["status"] = showObj.status
|
||||
|
||||
nextAirdate = showObj.nextaired
|
||||
if nextAirdate:
|
||||
nextAirdate = _ordinal_to_dateForm(nextAirdate)
|
||||
if showObj.nextaired:
|
||||
dtEpisodeAirs = network_timezones.parse_date_time(showObj.nextaired, showDict['airs'], showDict['network'])
|
||||
showDict['airs'] = sbdatetime.sbdatetime.sbftime(dtEpisodeAirs, t_preset=timeFormat).lstrip('0').replace(' 0', ' ')
|
||||
showDict['next_ep_airdate'] = sbdatetime.sbdatetime.sbfdate(dtEpisodeAirs, d_preset=dateFormat)
|
||||
else:
|
||||
nextAirdate = ''
|
||||
|
||||
showDict["next_ep_airdate"] = nextAirdate
|
||||
showDict['next_ep_airdate'] = ''
|
||||
|
||||
return _responds(RESULT_SUCCESS, showDict)
|
||||
|
||||
@ -2312,7 +2317,8 @@ class CMD_ShowSeasons(ApiCall):
|
||||
status, quality = Quality.splitCompositeStatus(int(row["status"]))
|
||||
row["status"] = _get_status_Strings(status)
|
||||
row["quality"] = _get_quality_string(quality)
|
||||
row["airdate"] = _ordinal_to_dateForm(row["airdate"])
|
||||
dtEpisodeAirs = network_timezones.parse_date_time(row['airdate'],showObj.airs,showObj.network)
|
||||
row['airdate'] = sbdatetime.sbdatetime.sbfdate(dtEpisodeAirs, d_preset=dateFormat)
|
||||
curSeason = int(row["season"])
|
||||
curEpisode = int(row["episode"])
|
||||
del row["season"]
|
||||
@ -2334,7 +2340,8 @@ class CMD_ShowSeasons(ApiCall):
|
||||
status, quality = Quality.splitCompositeStatus(int(row["status"]))
|
||||
row["status"] = _get_status_Strings(status)
|
||||
row["quality"] = _get_quality_string(quality)
|
||||
row["airdate"] = _ordinal_to_dateForm(row["airdate"])
|
||||
dtEpisodeAirs = network_timezones.parse_date_time(row['airdate'], showObj.airs, showObj.network)
|
||||
row['airdate'] = sbdatetime.sbdatetime.sbfdate(dtEpisodeAirs, d_preset=dateFormat)
|
||||
if not curEpisode in seasons:
|
||||
seasons[curEpisode] = {}
|
||||
seasons[curEpisode] = row
|
||||
@ -2556,11 +2563,6 @@ class CMD_Shows(ApiCall):
|
||||
""" display_is_int_multi( self.indexerid )shows in sickbeard """
|
||||
shows = {}
|
||||
for curShow in sickbeard.showList:
|
||||
nextAirdate = curShow.nextaired
|
||||
if nextAirdate:
|
||||
nextAirdate = _ordinal_to_dateForm(nextAirdate)
|
||||
else:
|
||||
nextAirdate = ''
|
||||
|
||||
if self.paused != None and bool(self.paused) != bool(curShow.paused):
|
||||
continue
|
||||
@ -2580,9 +2582,14 @@ class CMD_Shows(ApiCall):
|
||||
"show_name": curShow.name,
|
||||
"status": curShow.status,
|
||||
"subtitles": curShow.subtitles,
|
||||
"next_ep_airdate": nextAirdate
|
||||
}
|
||||
|
||||
if curShow.nextaired:
|
||||
dtEpisodeAirs = network_timezones.parse_date_time(curShow.nextaired, curShow.airs, showDict['network'])
|
||||
showDict['next_ep_airdate'] = sbdatetime.sbdatetime.sbfdate(dtEpisodeAirs, d_preset=dateFormat)
|
||||
else:
|
||||
showDict['next_ep_airdate'] = ''
|
||||
|
||||
showDict["cache"] = CMD_ShowCache(self.handler, (), {"indexerid": curShow.indexerid}).run()["data"]
|
||||
if not showDict["network"]:
|
||||
showDict["network"] = ""
|
||||
@ -2590,6 +2597,7 @@ class CMD_Shows(ApiCall):
|
||||
shows[curShow.name] = showDict
|
||||
else:
|
||||
shows[curShow.indexerid] = showDict
|
||||
|
||||
return _responds(RESULT_SUCCESS, shows)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user