diff --git a/API_REFERENCE b/API_REFERENCE index 1365c16e..98c8c231 100644 --- a/API_REFERENCE +++ b/API_REFERENCE @@ -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) diff --git a/mylar/api.py b/mylar/api.py index 4cc6b079..d2ac071c 100644 --- a/mylar/api.py +++ b/mylar/api.py @@ -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):