Gjsify LogoGjsify Logo

Index

Functions

  • buffer_to_jpeg(buffer: Uint8Array, buffer_mime: string, target: string): boolean
  • This function performs the same operation as media_art_file_to_jpeg() with the exception that a raw buffer can be used instead providing len and the buffer_mime too.

    Parameters

    • buffer: Uint8Array

      Raw buffer representing content to save

    • buffer_mime: string

      MIME type for buffer

    • target: string

      Output file name (not URI) to save converted content to

    Returns boolean

  • file_to_jpeg(filename: string, target: string): boolean
  • Save filename to target as JPEG format. The filename may not be a JPEG in the first place.

    Parameters

    • filename: string

      Original file name (not URI) to convert

    • target: string

      Output file name (not URI) to save converted content to

    Returns boolean

  • get_file(artist: string, title: string, prefix: string): [boolean, Gio.File]
  • 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 #GFiles must be freed with g_object_unref() if non-%NULL.

    This operation should not use i/o, but it depends on the backend GFile implementation.

    All string inputs must be valid UTF8. Use g_utf8_validate() if the input has not already been validated.

    Parameters

    • artist: string

      the artist

    • title: string

      the title

    • prefix: string

      the prefix for cache files, for example "album"

    Returns [boolean, Gio.File]

  • get_path(artist: string, title: string, prefix: string): [boolean, string]
  • This function calls media_art_get_file() by creating a #GFile for uri and passing the same arguments to media_art_get_file(). For more details about what this function does, see media_art_get_file().

    Get the path to media art for a given resource. Newly allocated data returned in cache_path must be freed with g_free().

    All string inputs must be valid UTF8. Use g_utf8_validate() if the input has not already been validated.

    Parameters

    • artist: string

      the artist

    • title: string

      the title

    • prefix: string

      the prefix, for example "album"

    Returns [boolean, string]

  • plugin_init(max_width: number): void
  • 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, media_art_plugin_shutdown() is called before tear down of the plugin system or plugin itself.

    Parameters

    • max_width: number

      The maximum width that an image is allowed to be

    Returns void

  • plugin_shutdown(): void
  • 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, media_art_plugin_init() is called after the plugin is loaded.

    Returns void

  • remove(artist: string, album: string, cancellable: Gio.Cancellable): boolean
  • Removes media art for given album/artist provided.

    If artist and album are %NULL, ALL media art cache is removed.

    All string inputs must be valid UTF8. Use g_utf8_validate() if the input has not already been validated.

    Parameters

    • artist: string

      artist the media art belongs to

    • album: string

      album the media art belongs or %NULL

    • cancellable: Gio.Cancellable

      optional #GCancellable object, %NULL to ignore.

    Returns boolean

  • Removes media art for given album/artist provided. Precisely the same operation as media_art_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 %G_IO_ERROR_CANCELLED.

    During an async request no other sync and async calls are allowed, and will result in %G_IO_ERROR_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 %G_PRIORITY_DEFAULT.

    All string inputs must be valid UTF8. Use g_utf8_validate() if the input has not already been validated.

    Parameters

    • artist: string

      artist the media art belongs to

    • album: string

      album the media art belongs or %NULL

    • io_priority: number

      the [I/O priority][io-priority] of the request

    • source_object: GObject.Object

      the #GObject this task belongs to, can be %NULL.

    • cancellable: Gio.Cancellable

      optional #GCancellable object, %NULL to ignore

    • callback: AsyncReadyCallback

      a #GAsyncReadyCallback to call when the request is satisfied

    Returns void

  • strip_invalid_entities(original: string): string
  • 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 g_free().

    This functions is used internally by media_art_get_file() and media_art_get_path(). You will not normally need to call it yourself.

    This function provides the following features:

    1. Invalid characters include: ()[]<>{}_!#$^&*+=|/"'?~;
    2. Text inside brackets of (), {}, [] and <> pairs are removed.
    3. Multiples of space characters are removed.

    This function expects that the input is valid UTF-8. Use g_utf8_validate() if the input has not already been validated.

    Parameters

    • original: string

      original string

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method