Fix style errors reported by Flake8.

This commit is contained in:
Stig Inge Lea Bjørnsen 2014-05-12 22:31:26 +02:00
parent f8abd50090
commit 34c256925e

View file

@ -4,7 +4,8 @@ time (mtime) of the item's source file before import.
from __future__ import unicode_literals, absolute_import, print_function
import logging, os
import logging
import os
from beets import config
from beets import util
@ -12,6 +13,7 @@ from beets.plugins import BeetsPlugin
log = logging.getLogger('beets')
class ImportMtimesPlugin(BeetsPlugin):
def __init__(self):
super(ImportMtimesPlugin, self).__init__()
@ -19,10 +21,12 @@ class ImportMtimesPlugin(BeetsPlugin):
'preserve_mtimes': False,
})
@ImportMtimesPlugin.listen('import_task_start')
def check_config(task, session):
config['importmtimes']['preserve_mtimes'].get(bool)
def write_file_mtime(path, mtime):
"""Write the given mtime to the destination path.
"""
@ -34,6 +38,7 @@ def write_file_mtime(path, mtime):
# value: the file mtime of the file the item was imported from
item_mtime = dict()
def write_item_mtime(item, mtime):
"""Write the given mtime to an item's `mtime` field and to the mtime of the
item's file.
@ -47,6 +52,7 @@ def write_item_mtime(item, mtime):
write_file_mtime(util.syspath(item.path), mtime)
item.mtime = mtime
@ImportMtimesPlugin.listen('before_item_moved')
@ImportMtimesPlugin.listen('item_copied')
def record_import_mtime(item, source, destination):
@ -63,6 +69,7 @@ def record_import_mtime(item, source, destination):
util.displayable_path(destination),
util.displayable_path(source))
@ImportMtimesPlugin.listen('album_imported')
def update_album_times(lib, album):
album_mtimes = []
@ -78,6 +85,7 @@ def update_album_times(lib, album):
album.added = min(album_mtimes)
album.store()
@ImportMtimesPlugin.listen('item_imported')
def update_item_times(lib, item):
mtime = item_mtime[item.path]