mirror of
https://github.com/beetbox/beets.git
synced 2026-02-22 15:22:42 +01:00
import log: flush on write; close on crash (#337)
This commit is contained in:
parent
dfc5ddb942
commit
531ebd19bb
3 changed files with 33 additions and 28 deletions
|
|
@ -57,6 +57,7 @@ def tag_log(logfile, status, path):
|
|||
"""
|
||||
if logfile:
|
||||
print >>logfile, '%s %s' % (status, path)
|
||||
logfile.flush()
|
||||
|
||||
def log_choice(config, task):
|
||||
"""Logs the task's current choice if it should be logged.
|
||||
|
|
|
|||
|
|
@ -593,35 +593,37 @@ def import_files(lib, paths, copy, write, autot, logpath, art, threaded,
|
|||
if resume is None and quiet:
|
||||
resume = False
|
||||
|
||||
# Perform the import.
|
||||
importer.run_import(
|
||||
lib = lib,
|
||||
paths = paths,
|
||||
resume = resume,
|
||||
logfile = logfile,
|
||||
color = color,
|
||||
quiet = quiet,
|
||||
quiet_fallback = quiet_fallback,
|
||||
copy = copy,
|
||||
write = write,
|
||||
art = art,
|
||||
delete = delete,
|
||||
threaded = threaded,
|
||||
autot = autot,
|
||||
choose_match_func = choose_match,
|
||||
should_resume_func = should_resume,
|
||||
singletons = singletons,
|
||||
timid = timid,
|
||||
choose_item_func = choose_item,
|
||||
query = query,
|
||||
incremental = incremental,
|
||||
ignore = ignore,
|
||||
)
|
||||
try:
|
||||
# Perform the import.
|
||||
importer.run_import(
|
||||
lib = lib,
|
||||
paths = paths,
|
||||
resume = resume,
|
||||
logfile = logfile,
|
||||
color = color,
|
||||
quiet = quiet,
|
||||
quiet_fallback = quiet_fallback,
|
||||
copy = copy,
|
||||
write = write,
|
||||
art = art,
|
||||
delete = delete,
|
||||
threaded = threaded,
|
||||
autot = autot,
|
||||
choose_match_func = choose_match,
|
||||
should_resume_func = should_resume,
|
||||
singletons = singletons,
|
||||
timid = timid,
|
||||
choose_item_func = choose_item,
|
||||
query = query,
|
||||
incremental = incremental,
|
||||
ignore = ignore,
|
||||
)
|
||||
|
||||
# If we were logging, close the file.
|
||||
if logfile:
|
||||
print >>logfile, ''
|
||||
logfile.close()
|
||||
finally:
|
||||
# If we were logging, close the file.
|
||||
if logfile:
|
||||
print >>logfile, ''
|
||||
logfile.close()
|
||||
|
||||
# Emit event.
|
||||
plugins.send('import', lib=lib, paths=paths)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ Changelog
|
|||
layer. See :ref:`writing-plugins`.
|
||||
* A reasonable error message is now shown when the import log file cannot be
|
||||
opened.
|
||||
* The import log file is now flushed and closed properly so that it can be used
|
||||
to monitor import progress, even when the import crashes.
|
||||
* Fix a bug in the ``rewrite`` plugin that broke the use of multiple rules for
|
||||
a single field.
|
||||
* Fix a crash with non-ASCII characters in bytestring metadata fields (e.g.,
|
||||
|
|
|
|||
Loading…
Reference in a new issue