Skip to content

Commit

Permalink
fix: encoding messages now show the correct file
Browse files Browse the repository at this point in the history
maxhoesel committed Oct 1, 2021
1 parent 36791cf commit 92ce723
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/musicbird/encode.py
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ def _db_update_worker(db: LibraryDB, input_q: Queue, output: Queue) -> None:
return
db.add_or_update_file(file)
output.put(file)
logger.info(f"Processed file: {file.path}")
else:
time.sleep(1)

@@ -116,12 +117,8 @@ def encode(config: Dict, db: LibraryDB, pretend=False) -> bool:
db_thread.start()

with concurrent.futures.ThreadPoolExecutor(config["threads"]) as executor:
futures = []
for file in to_encode:
futures.append(executor.submit(_encode_worker, file, config, successful_encodes, failed_encodes))
for future in concurrent.futures.as_completed(futures):
if future.result():
logger.info(f"Encoded file: {file.path}")
executor.submit(_encode_worker, file, config, successful_encodes, failed_encodes)

# Encode jobs have finished, add termination object to DB queue
successful_encodes.put(None)

0 comments on commit 92ce723

Please sign in to comment.