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
config –
MusicDBConfig
object holding the MusicDB Configurationdatabase – (optional) A
MusicDatabase
instance
- 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 callsmusicdb.mdbapi.music.MusicDBMusic.AddAlbum()
.- Returns
True
on success, otherwiseFalse
.
- 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:
"video"
:ImportVideo()
"album"
:ImportAlbum()
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
isTrue
, 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
) WhenTrue
, importing artwork from the imported content will be triggered.
- Returns
True
on success, otherwiseFalse
- 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.