last.fm bug fix
This commit is contained in:
parent
5e5f2e2cf7
commit
6a3b127245
2 changed files with 5 additions and 2 deletions
|
@ -9,6 +9,7 @@ import arrow
|
||||||
import settings
|
import settings
|
||||||
import keys
|
import keys
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
from math import floor
|
||||||
|
|
||||||
Track = namedtuple(
|
Track = namedtuple(
|
||||||
"Track", ["timestamp", "artist", "album", "title", "artistid", "albumid", "img"]
|
"Track", ["timestamp", "artist", "album", "title", "artistid", "albumid", "img"]
|
||||||
|
@ -97,6 +98,8 @@ class LastFM(object):
|
||||||
return json.loads(r.text).get("recenttracks")
|
return json.loads(r.text).get("recenttracks")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
startpage = floor(len(self.existing) / int(self.params.get("limit")))
|
||||||
|
self.params.update({"page": startpage})
|
||||||
try:
|
try:
|
||||||
data = self.fetch()
|
data = self.fetch()
|
||||||
tracks = self.extracttracks(data)
|
tracks = self.extracttracks(data)
|
||||||
|
|
4
run.py
4
run.py
|
@ -7,8 +7,8 @@ import Flickr
|
||||||
import Artstation
|
import Artstation
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
# lfm = LastFM.LastFM()
|
lfm = LastFM.LastFM()
|
||||||
# lfm.run()
|
lfm.run()
|
||||||
|
|
||||||
opml = common.Follows()
|
opml = common.Follows()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue