Commit 4341467b authored by Gerion Entrup's avatar Gerion Entrup
Browse files

collector: some fixes

parent 7192d224
......@@ -19,7 +19,8 @@ class Main:
def init_database(self, dbfile):
engine = create_engine('sqlite:///' + dbfile,
connect_args={'check_same_thread':False},
poolclass=StaticPool)#, echo=True)
#echo = True,
poolclass=StaticPool)
patch_model_schemas(NO_SCHEMAS)
Base.metadata.create_all(engine)
session_factory = sessionmaker(bind=engine)
......
......@@ -27,7 +27,7 @@ class Collector(threading.Thread):
def run(self):
while True:
mbid, path = Paths.get()
fetch_recording(mbid, path)
self.fetch_recording(mbid, path)
self._session.commit()
Paths.task_done()
self._session.close()
......@@ -80,7 +80,7 @@ class Collector(threading.Thread):
return mediumformat
def create_track(self, trackdata, release, recording, mediumdata):
track = self._session.query(Recording).filter_by(gid=trackdata['id']).first()
track = self._session.query(Track).filter_by(gid=trackdata['id']).first()
if track is None:
track = Track()
track.gid = trackdata['id']
......@@ -107,7 +107,6 @@ class Collector(threading.Thread):
recording.ftype = path.split('.')[-1]
recording.length = result['length']
recording.artist_credit = self.create_artist_credit(result['artist-credit'], result['artist-credit-phrase'])
self._session.add(recording)
#extended mapping
......@@ -156,7 +155,7 @@ class Collector(threading.Thread):
return artist
def fetch_release(self, mbid):
release = self._session.query(Artist).filter_by(gid=mbid).first()
release = self._session.query(Release).filter_by(gid=mbid).first()
if release is None:
result = self.fetcher.get_table_by_id(mbid, 'release')
......
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