Commit 924ac22f authored by Gerion Entrup's avatar Gerion Entrup
Browse files

model: add column 'fgid' into recording table

The mbid written into the metadata can differ from the fetched mbid, so
storing it enables detection of files with old metadata.
parent 19e9d9b2
...@@ -110,6 +110,7 @@ class Collector(threading.Thread): ...@@ -110,6 +110,7 @@ class Collector(threading.Thread):
recording = Recording() recording = Recording()
recording.gid = result['id'] recording.gid = result['id']
recording.name = result['title'] recording.name = result['title']
recording.fgid = mbid
recording.path = path recording.path = path
recording.ftype = os.path.splitext(path)[1][1:] recording.ftype = os.path.splitext(path)[1][1:]
recording.artist_credit = self.create_artist_credit( recording.artist_credit = self.create_artist_credit(
...@@ -131,7 +132,7 @@ class Collector(threading.Thread): ...@@ -131,7 +132,7 @@ class Collector(threading.Thread):
releasedata['id'], Table.release)['medium-list'] releasedata['id'], Table.release)['medium-list']
for medium in mediumlist: for medium in mediumlist:
for track in medium['track-list']: for track in medium['track-list']:
if track['recording']['id'] == mbid: if track['recording']['id'] == result['id']:
self.create_track(track, self.create_track(track,
release, release,
recording, recording,
......
...@@ -3,8 +3,12 @@ from mbdata.models import Base, Recording ...@@ -3,8 +3,12 @@ from mbdata.models import Base, Recording
def patch_recording(): def patch_recording():
# store the path of the file
setattr(Recording, 'path', Column(String, nullable=False)) setattr(Recording, 'path', Column(String, nullable=False))
# store the ending of the file (ogg,mp3,...)
setattr(Recording, 'ftype', Column(String, nullable=False)) setattr(Recording, 'ftype', Column(String, nullable=False))
# store the mbid written in the file
setattr(Recording, 'fgid', Column(String, nullable=False))
class BrainzFS(Base): class BrainzFS(Base):
......
4b442925-9d2a-41e0-b958-4c2739a09d45
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