last.fm bug fix

This commit is contained in:
Peter Molnar 2019-10-19 10:07:37 +01:00
parent 5e5f2e2cf7
commit 6a3b127245
2 changed files with 5 additions and 2 deletions

View file

@ -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)

4
run.py
View file

@ -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()