Import Tasks Management

This module organizes the import process of music inside the Music Directory into the MusicDB Database.

ImportManager Class

class musicdb.taskmanagement.importmanager.ImportManager(config, database)[source]

This class manages importing content from the Music Directory into the MusicDB Database. The class is derived from musicdb.taskmanagement.taskmanager.TaskManager.

Parameters
Raises

TypeError – When the arguments are not of the correct type.

ImportAlbum(task)[source]

Task state must be "importingmusic" and content type must be "album". This method calls musicdb.mdbapi.music.MusicDBMusic.AddAlbum().

Returns

True on success, otherwise False.

ImportMusic(task, includeartwork=False)[source]

This method imports content from the Music Directory into the MusicDB Database. Depending on the contenttype different import methods are called:

The task must be in "startmusicimport" state, otherwise nothing happens but printing an error message. If post processing was successful, the task state gets updated to "importcomplete". When an error occurred, the state will become "invalidcontent" or "importfailed".

In case includeartwork is True, the task state get set to "startartworkimport" instead of "importcomplete". This triggers importing the artwork of the imported music content as well.

Parameters
  • task (dict) – the task object of an import-task

  • includeartwork (bool) – (Optional, default: False) When True, importing artwork from the imported content will be triggered.

Returns

True on success, otherwise False

ImportVideo(task)[source]

Task state must be "startimport" and content type must be "video"

Returns

True on success.

InitiateImport(contenttype, contentpath)[source]

The contentpath addresses the content that shall be imported. This path must be relative to the music directory. The task state will be set to "startmusicimport"

Parameters
  • contenttype (str) – Type of the content: ("video", "album")

  • contentpath (str) – Path to the content that shall be imported. For example to an Album.

Returns

The task ID as string or None if something failed.