IMP: Updated the getUpcoming API method.

Updated the getUpcoming API method to fetch results that match "This Week's Upcoming" as found under "Wanted -> Upcoming Issues" in the Web Interface.
This commit is contained in:
davalanche 2016-09-20 22:34:06 -06:00 committed by evilhero
parent cef076ee83
commit 273df1827c
2 changed files with 12 additions and 2 deletions

View File

@ -24,7 +24,9 @@ getComic&id=$comicid (fetch artist data. returns the artist object (see above) a
getIssue&id=$comicid (fetch data from album page. Returns the album object, a description object and a tracks object. Tracks contain: AlbumASIN, AlbumTitle, TrackID, Format, TrackDuration (ms), ArtistName, TrackTitle, AlbumID, ArtistID, Location, TrackNumber, CleanName (stripped of punctuation /styling), BitRate)
getUpcoming (Returns: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, ReleaseDate, AlbumID, ArtistID, Type)
getUpcoming[&include_downloaded_issues=Y] (fetch "This Week's Upcoming". Add the &include_downloaded_issues parameter to.. include downloaded issues.
This essentially forces the results to look like they would have at the start of the week, when all of the
issues were still Wanted. Returns: Status, ComicName, IssueID, DisplayComicName, IssueNumber, IssueDate, ComicID)
getWanted (Returns: Status, AlbumASIN, DateAdded, AlbumTitle, ArtistName, ReleaseDate, AlbumID, ArtistID, Type)

View File

@ -160,7 +160,15 @@ class Api(object):
return
def _getUpcoming(self, **kwargs):
self.data = self._dic_from_query("SELECT * from upcoming WHERE IssueID is NULL order by IssueDate DESC")
if 'include_downloaded_issues' in kwargs and kwargs['include_downloaded_issues'].upper() == 'Y':
select_status_clause = "w.STATUS IN ('Wanted', 'Downloaded')"
else:
select_status_clause = "w.STATUS = 'Wanted'"
self.data = self._dic_from_query(
"SELECT w.COMIC AS ComicName, w.ISSUE AS IssueNumber, w.ComicID, w.IssueID, w.SHIPDATE AS IssueDate, w.STATUS AS Status, c.ComicName AS DisplayComicName \
FROM weekly w JOIN comics c ON w.ComicID = c.ComicID WHERE w.COMIC IS NOT NULL AND w.ISSUE IS NOT NULL AND \
w.weeknumber = strftime('%W', 'now') AND w.year = strftime('%Y', 'now') AND " + select_status_clause + " ORDER BY c.ComicSortName")
return
def _getWanted(self, **kwargs):