Skip to content

Instantly share code, notes, and snippets.

@sampsyo
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save sampsyo/11336782 to your computer and use it in GitHub Desktop.

Select an option

Save sampsyo/11336782 to your computer and use it in GitHub Desktop.
diff --git a/beets/importer.py b/beets/importer.py
index 0fc11f6..52e06a4 100644
--- a/beets/importer.py
+++ b/beets/importer.py
@@ -254,7 +254,6 @@ class ImportSession(object):
for stage_func in plugins.import_stages():
stages.append(plugin_stage(self, stage_func))
stages += [manipulate_files(self)]
- stages += [finalize(self)]
pl = pipeline.Pipeline(stages)
# Run the pipeline.
@@ -380,7 +379,7 @@ class ImportTask(object):
lib.directory)
def finalize(self, session):
- """Save progress clean up files, and emit plugin event.
+ """Save progress, clean up files, and emit plugin event.
"""
# FIXME the session argument is unfortunate. It should be
# present as an attribute of the task.
@@ -1055,10 +1054,11 @@ def plugin_stage(session, func, task):
task.reload()
-@pipeline.mutator_stage
+@pipeline.stage
def manipulate_files(session, task):
"""A coroutine (pipeline stage) that performs necessary file
- manipulations *after* items have been added to the library.
+ manipulations *after* items have been added to the library and
+ finalizes each task.
"""
if task.skip:
return
@@ -1073,11 +1073,7 @@ def manipulate_files(session, task):
session=session,
)
-
-# FIXME Boilerplate. Maybe we should move this to the `manipulate_files`
-# stage.
-@pipeline.stage
-def finalize(session, task):
+ # Progress, cleanup, and event.
task.finalize(session)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment