MediaArt.Process¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class MediaArt.Process(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A class implementation for processing and extracting media art.
- classmethod new()¶
- Raises:
- Returns:
A new
MediaArt.Process
object on success orNone
if error is set. This object must be freed usingGObject.Object.unref
().- Return type:
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:
type (
MediaArt.Type
) – The type of mediaflags (
MediaArt.ProcessFlags
) – The options given for how to process the media artrelated_file (
Gio.File
) – File related to the media artbuffer (
bytes
orNone
) – a buffer containing file data, orNone
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore
- Raises:
- Returns:
- Return type:
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 beNone
.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:
type (
MediaArt.Type
) – The type of mediaflags (
MediaArt.ProcessFlags
) – The options given for how to process the media artrelated_file (
Gio.File
) – File related to the media artbuffer (
bytes
orNone
) – a buffer containing file data, orNone
io_priority (
int
) – the I/O priority of the requestcancellable (
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
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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes the asynchronous operation started with
MediaArt.Process.file_async
().New in version 0.7.0.
- file(type, flags, file, artist, title, cancellable)¶
- Parameters:
type (
MediaArt.Type
) – The type of mediaflags (
MediaArt.ProcessFlags
) – The options given for how to process the media artfile (
Gio.File
) – File to be processedcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore
- Raises:
- Returns:
- Return type:
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 beNone
.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 useMediaArt.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:
type (
MediaArt.Type
) – The type of mediaflags (
MediaArt.ProcessFlags
) – The options given for how to process the media artfile (
Gio.File
) – File to be processedio_priority (
int
) – the I/O priority of the requestcancellable (
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
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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes the asynchronous operation started with
MediaArt.Process.file_async
().New in version 0.7.0.
- uri(type, flags, uri, artist, title, cancellable)¶
- Parameters:
type (
MediaArt.Type
) – The type of media that contained the image dataflags (
MediaArt.ProcessFlags
) – How the media art is processeduri (
str
) – URI of the media file that contained the datacancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore
- Raises:
- Returns:
- Return type:
This function calls
MediaArt.Process.file
(), but takes the uri as a string rather than aGio.File
object. Either artist OR title can beNone
, but they can not both beNone
.New in version 0.5.0.
- uri_async(type, flags, uri, artist, title, io_priority, cancellable, callback, *user_data)¶
- Parameters:
type (
MediaArt.Type
) – The type of mediaflags (
MediaArt.ProcessFlags
) – The options given for how to process the media arturi (
str
) – A string representing a URI to be processedio_priority (
int
) – the I/O priority of the requestcancellable (
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
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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes the asynchronous operation started with
MediaArt.Process.file_async
().New in version 0.7.0.