Commit 0aafc694 authored by Gerion Entrup's avatar Gerion Entrup
Browse files

collector: write meaningful track id

possible because of forcing musicbrainzngs >= 0.5
parent 57658e5c
......@@ -105,18 +105,18 @@ class Collector:
return mediumformat
def create_track(self, trackdata, release, recording, mediumdata):
#TODO check for dublicates, very unlikely that there are actual ones and the gid is missing
track = Track()
#TODO write fake value, actually value not feasible to request with current api
track.gid = 'fake'
track.recording = recording
track.medium = self.session.query(Medium).filter(and_(Medium.position == mediumdata['position'],
Medium.release == release)).one()
track.artist_credit = recording.artist_credit
track.position = trackdata['position']
track.number = trackdata['number']
track.name = recording.name
track.length = trackdata['length']
track = self.session.query(Recording).filter_by(gid=trackdata['id']).first()
if track is None:
track = Track()
track.gid = trackdata['id']
track.recording = recording
track.medium = self.session.query(Medium).filter(and_(Medium.position == mediumdata['position'],
Medium.release == release)).one()
track.artist_credit = recording.artist_credit
track.position = trackdata['position']
track.number = trackdata['number']
track.name = recording.name
track.length = trackdata['length']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment