mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 10:05:13 +01:00
Merge branch 'beetbox:master' into master
This commit is contained in:
commit
fbd665a417
2 changed files with 15 additions and 0 deletions
|
|
@ -1122,6 +1122,19 @@ class ArchiveImportTask(SentinelImportTask):
|
|||
archive = handler_class(util.py3_path(self.toppath), mode='r')
|
||||
try:
|
||||
archive.extractall(extract_to)
|
||||
|
||||
# Adjust the files' mtimes to match the information from the
|
||||
# archive. Inspired by: https://stackoverflow.com/q/9813243
|
||||
for f in archive.infolist():
|
||||
# The date_time will need to adjusted otherwise
|
||||
# the item will have the current date_time of extraction.
|
||||
# The (0, 0, -1) is added to date_time because the
|
||||
# function time.mktime expects a 9-element tuple.
|
||||
# The -1 indicates that the DST flag is unknown.
|
||||
date_time = time.mktime(f.date_time + (0, 0, -1))
|
||||
fullpath = os.path.join(extract_to, f.filename)
|
||||
os.utime(fullpath, (date_time, date_time))
|
||||
|
||||
finally:
|
||||
archive.close()
|
||||
self.extracted = True
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ New features:
|
|||
* :ref:`import-options`: Add support for re-running the importer on paths in
|
||||
log files that were created with the ``-l`` (or ``--logfile``) argument.
|
||||
:bug:`4379` :bug:`4387`
|
||||
* Preserve mtimes from archives
|
||||
:bug:`4392`
|
||||
* Add :ref:`%sunique{} <sunique>` template to disambiguate between singletons.
|
||||
:bug:`4438`
|
||||
* Add a new ``import.ignored_alias_types`` config option to allow for
|
||||
|
|
|
|||
Loading…
Reference in a new issue