def group_albums(session):
 def group(item):
  return ((item.albumartist or item.artist), item.album)
 task = None
 while True:
  task = (yield task)
  if task.skip:
   continue
  tasks = []
  for (_, items) in itertools.groupby(task.items, group):
   tasks.append(ImportTask(items=list(items)))
  tasks.append(SentinelImportTask(task.toppath, task.paths))
  task = pipeline.multiple(tasks)

def group_albums ( session ) : def group ( item ) : return ( ( item . albumartist or item . artist ) , item . album ) task = None while True : task = ( yield task ) if task . skip : continue tasks = [ ] for ( _ , items ) in itertools . groupby ( task . items , group ) : tasks . append ( ImportTask ( items = list ( items ) ) ) tasks . append ( SentinelImportTask ( task . toppath , task . paths ) ) task = pipeline . multiple ( tasks )
group the items of a task by albumartist and album name and create a new task for each album .