Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- MediaArt.buffer_to_jpeg(buffer, buffer_mime, target)¶
- Parameters:
- Raises:
- Returns:
True
if conversion was successful, otherwiseFalse
is returned if error is set.- Return type:
This function performs the same operation as
MediaArt.file_to_jpeg
() with the exception that a raw buffer can be used instead providing len and the buffer_mime too.New in version 0.1.0.
- MediaArt.error_quark()¶
- Returns:
the #GQuark used to identify media art errors in
GLib.Error
structures.- Return type:
The error domain for
MediaArt.Error
.New in version 0.2.0.
- MediaArt.file_to_jpeg(filename, target)¶
- Parameters:
- Raises:
- Returns:
True
if conversion was successful, otherwiseFalse
is returned if error is set.- Return type:
Save filename to target as JPEG format. The filename may not be a JPEG in the first place.
New in version 0.1.0.
- MediaArt.get_file(artist, title, prefix)¶
- Parameters:
- Returns:
- Return type:
Gets the files pointing to cache files suitable for storing the media art provided by the artist, title and file arguments. cache_file will point to a location in the XDG user cache directory..
The cache_file relates to a symlink stored in XDG cache directories for the user. A cache_file would be expected to look like file:///home/martyn/.cache/media-art/…. This is normally the location that is most useful (assuming the cache has been extracted in the first place).
When done, both
Gio.File
s must be freed withGObject.Object.unref
() if non-None
.This operation should not use i/o, but it depends on the backend
Gio.File
implementation.All string inputs must be valid UTF8. Use
GLib.utf8_validate
() if the input has not already been validated.New in version 0.2.0.
- MediaArt.get_path(artist, title, prefix)¶
- Parameters:
- Returns:
True
if cache_path was returned, otherwiseFalse
.- cache_path:
a string representing the path to the cache for this media art path or
None
- Return type:
This function calls
MediaArt.get_file
() by creating aGio.File
for uri and passing the same arguments toMediaArt.get_file
(). For more details about what this function does, seeMediaArt.get_file
().Get the path to media art for a given resource. Newly allocated data returned in cache_path must be freed with
GLib.free
().All string inputs must be valid UTF8. Use
GLib.utf8_validate
() if the input has not already been validated.New in version 0.2.0.
- MediaArt.plugin_init(max_width)¶
- Parameters:
max_width (
int
) – The maximum width that an image is allowed to be
This function facilitates a plugin’s need to create any internal caches before anything else is done. This function must exist in each plugin and is called immediately after the plugin is loaded. Conversely,
MediaArt.plugin_shutdown
() is called before tear down of the plugin system or plugin itself.New in version 0.1.0.
- MediaArt.plugin_shutdown()¶
This function facilitates a plugin’s need to clean up any internal caches. This function must exist in each plugin and is called immediately after the plugin is loaded. Conversely,
MediaArt.plugin_init
() is called after the plugin is loaded.New in version 0.1.0.
- MediaArt.remove(artist, album, cancellable)¶
- Parameters:
artist (
str
) – artist the media art belongs tocancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.
- Raises:
- Returns:
- Return type:
Removes media art for given album/artist provided.
If artist and album are
None
, ALL media art cache is removed.All string inputs must be valid UTF8. Use
GLib.utf8_validate
() if the input has not already been validated.New in version 0.2.0.
- MediaArt.remove_async(artist, album, io_priority, source_object, cancellable, callback, *user_data)¶
- Parameters:
artist (
str
) – artist the media art belongs toio_priority (
int
) – the I/O priority of the requestsource_object (
GObject.Object
orNone
) – theGObject.Object
this task belongs to, can beNone
.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Removes media art for given album/artist provided. Precisely the same operation as
MediaArt.remove
() is performing, but asynchronously.When all i/o for the operation is finished the callback will be called.
In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported. If a request is cancelled the callback will be called with
Gio.IOErrorEnum.CANCELLED
.During an async request no other sync and async calls are allowed, and will result in
Gio.IOErrorEnum.PENDING
errors.Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is
GLib.PRIORITY_DEFAULT
.All string inputs must be valid UTF8. Use
GLib.utf8_validate
() if the input has not already been validated.New in version 0.7.0.
- MediaArt.remove_finish(source_object, result)¶
- Parameters:
source_object (
GObject.Object
orNone
) – theGObject.Object
this task belongs to, can beNone
.result (
Gio.AsyncResult
) – aGio.AsyncResult
.
- Raises:
- Returns:
- Return type:
Finishes the asynchronous operation started with
MediaArt.remove_async
().New in version 0.7.0.
- MediaArt.strip_invalid_entities(original)¶
- Parameters:
- Returns:
original stripped of invalid characters which must be freed. On error or if original is
None
,None
is returned.- Return type:
Strip a albumname or artistname string to prepare it for calculating the media art path with it. Certain characters and charactersets will be stripped and a newly allocated string returned which you must free with
GLib.free
().This functions is used internally by
MediaArt.get_file
() andMediaArt.get_path
(). You will not normally need to call it yourself.This function provides the following features:
Invalid characters include: ()[]<>{}_!@#$^&*+=|\/”’?~;
Text inside brackets of (), {}, [] and <> pairs are removed.
Multiples of space characters are removed.
This function expects that the input is valid UTF-8. Use
GLib.utf8_validate
() if the input has not already been validated.New in version 0.2.0.