mirror of
https://github.com/krateng/maloja.git
synced 2025-04-16 16:52:18 +03:00
Added album importing, GH-231
This commit is contained in:
parent
a7e4a869cc
commit
8acf142745
@ -485,7 +485,7 @@ def get_artist_id(artistname,create_new=True,dbconn=None):
|
||||
@connection_provider
|
||||
def get_album_id(albumdict,create_new=True,ignore_albumartists=False,dbconn=None):
|
||||
ntitle = normalize_name(albumdict['albumtitle'])
|
||||
artist_ids = [get_artist_id(a,dbconn=dbconn) for a in albumdict.get('artists') or []]
|
||||
artist_ids = [get_artist_id(a,dbconn=dbconn) for a in (albumdict.get('artists') or [])]
|
||||
artist_ids = list(set(artist_ids))
|
||||
|
||||
op = DB['albums'].select(
|
||||
|
@ -80,9 +80,6 @@ def import_scrobbles(inputf):
|
||||
|
||||
# extra info
|
||||
extrainfo = {}
|
||||
if scrobble.get('album_name'): extrainfo['album_name'] = scrobble['album_name']
|
||||
# saving this in the scrobble instead of the track because for now it's not meant
|
||||
# to be authorative information, just payload of the scrobble
|
||||
|
||||
scrobblebuffer.append({
|
||||
"time":scrobble['scrobble_time'],
|
||||
@ -90,6 +87,11 @@ def import_scrobbles(inputf):
|
||||
"artists":scrobble['track_artists'],
|
||||
"title":scrobble['track_title'],
|
||||
"length":scrobble['track_length'],
|
||||
"album":{
|
||||
"albumtitle":scrobble.get('album_name') or None,
|
||||
"artists":scrobble.get('album_artists') or scrobble['track_artists'] or None
|
||||
# TODO: use same heuristics as with parsing to determine album?
|
||||
}
|
||||
},
|
||||
"duration":scrobble['scrobble_duration'],
|
||||
"origin":"import:" + typeid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user