MediaArt.Process

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object MediaArt.Process MediaArt.Process GObject.Object->MediaArt.Process Gio.Initable->MediaArt.Process

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new ()

buffer (type, flags, related_file, buffer, mime, artist, title, cancellable)

buffer_async (type, flags, related_file, buffer, mime, artist, title, io_priority, cancellable, callback, *user_data)

buffer_finish (result)

file (type, flags, file, artist, title, cancellable)

file_async (type, flags, file, artist, title, io_priority, cancellable, callback, *user_data)

file_finish (result)

uri (type, flags, uri, artist, title, cancellable)

uri_async (type, flags, uri, artist, title, io_priority, cancellable, callback, *user_data)

uri_finish (result)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class MediaArt.Process(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

MediaArt.ProcessClass

A class implementation for processing and extracting media art.

classmethod new()
Raises:

GLib.Error

Returns:

A new MediaArt.Process object on success or None if error is set. This object must be freed using GObject.Object.unref().

Return type:

MediaArt.Process

Initialize a GObject.Object for processing and extracting media art.

This function initializes cache hash tables and backend plugins,

New in version 0.5.0.

buffer(type, flags, related_file, buffer, mime, artist, title, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if file could be processed or False if error is set.

Return type:

bool

Processes a memory buffer represented by buffer and len. If you have extracted any embedded media art and passed this in as buffer, the image data will be converted to the correct format and saved in the media art cache.

Either artist OR title can be None, but they can not both be None.

If file is on a removable filesystem, the media art file will be saved in a cache on the removable file system rather than on the host machine.

New in version 0.5.0.

buffer_async(type, flags, related_file, buffer, mime, artist, title, io_priority, cancellable, callback, *user_data)
Parameters:

Processes media art. Precisely the same operation as MediaArt.Process.buffer() 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.

Dbufferng 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.

New in version 0.7.0.

buffer_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True on success, otherwise False when error will be set.

Return type:

bool

Finishes the asynchronous operation started with MediaArt.Process.file_async().

New in version 0.7.0.

file(type, flags, file, artist, title, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if file could be processed or False if error is set.

Return type:

bool

Process file and check if media art exists and if it is up to date with artist and title provided. Either artist OR title can be None, but they can not both be None.

NOTE: This function MAY retrieve media art for artist and title combinations. It is not guaranteed and depends on download services available over DBus at the time.

In cases where download is unavailable, MediaArt.Process.file() will only try to procure a cache for possible media art found in directories surrounding the location of file. If a buffer or memory chunk needs to be saved to disk which has been retrieved from an MP3 (for example), you should use MediaArt.Process.buffer().

The modification time (mtime) of file is checked against the cached stored for artist and title. If the cache is old or doesn’t exist, it will be updated. What this actually does is update the mtime of the cache (a symlink) on the disk.

If there is no actual media art stored locally (for example, it’s stored in a directory on a removable device), it is copied locally (usually to an XDG cache directory).

If file is on a removable filesystem, the media art file will be saved in a cache on the removable file system rather than on the host machine.

New in version 0.3.0.

file_async(type, flags, file, artist, title, io_priority, cancellable, callback, *user_data)
Parameters:

Processes media art. Precisely the same operation as MediaArt.Process.file() 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.

New in version 0.7.0.

file_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True on success, otherwise False when error will be set.

Return type:

bool

Finishes the asynchronous operation started with MediaArt.Process.file_async().

New in version 0.7.0.

uri(type, flags, uri, artist, title, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if uri could be processed or False if error is set.

Return type:

bool

This function calls MediaArt.Process.file(), but takes the uri as a string rather than a Gio.File object. Either artist OR title can be None, but they can not both be None.

New in version 0.5.0.

uri_async(type, flags, uri, artist, title, io_priority, cancellable, callback, *user_data)
Parameters:

Processes media art. Precisely the same operation as MediaArt.Process.uri() 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.

New in version 0.7.0.

uri_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True on success, otherwise False when error will be set.

Return type:

bool

Finishes the asynchronous operation started with MediaArt.Process.file_async().

New in version 0.7.0.