mirror of
https://github.com/krateng/maloja.git
synced 2025-06-04 01:20:58 +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
|
@connection_provider
|
||||||
def get_album_id(albumdict,create_new=True,ignore_albumartists=False,dbconn=None):
|
def get_album_id(albumdict,create_new=True,ignore_albumartists=False,dbconn=None):
|
||||||
ntitle = normalize_name(albumdict['albumtitle'])
|
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))
|
artist_ids = list(set(artist_ids))
|
||||||
|
|
||||||
op = DB['albums'].select(
|
op = DB['albums'].select(
|
||||||
|
@ -80,9 +80,6 @@ def import_scrobbles(inputf):
|
|||||||
|
|
||||||
# extra info
|
# extra info
|
||||||
extrainfo = {}
|
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({
|
scrobblebuffer.append({
|
||||||
"time":scrobble['scrobble_time'],
|
"time":scrobble['scrobble_time'],
|
||||||
@ -90,6 +87,11 @@ def import_scrobbles(inputf):
|
|||||||
"artists":scrobble['track_artists'],
|
"artists":scrobble['track_artists'],
|
||||||
"title":scrobble['track_title'],
|
"title":scrobble['track_title'],
|
||||||
"length":scrobble['track_length'],
|
"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'],
|
"duration":scrobble['scrobble_duration'],
|
||||||
"origin":"import:" + typeid,
|
"origin":"import:" + typeid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user