diff --git a/LastFM.py b/LastFM.py index d1b13e9..b3a21c9 100644 --- a/LastFM.py +++ b/LastFM.py @@ -9,6 +9,7 @@ import arrow import settings import keys from pprint import pprint +from math import floor Track = namedtuple( "Track", ["timestamp", "artist", "album", "title", "artistid", "albumid", "img"] @@ -97,6 +98,8 @@ class LastFM(object): return json.loads(r.text).get("recenttracks") def run(self): + startpage = floor(len(self.existing) / int(self.params.get("limit"))) + self.params.update({"page": startpage}) try: data = self.fetch() tracks = self.extracttracks(data) diff --git a/run.py b/run.py index b963efb..b9dbffa 100644 --- a/run.py +++ b/run.py @@ -7,8 +7,8 @@ import Flickr import Artstation from pprint import pprint -# lfm = LastFM.LastFM() -# lfm.run() +lfm = LastFM.LastFM() +lfm.run() opml = common.Follows()