mergMP

mergMP is an iOS external that adds functions and commands related to the MediaPlayer framework.
This currently includes querying the iPod library and accessing the properties of the found media collections.

Documentation

function mergMPQueryCreate

Release a media query from memory.

Returns a pointer to the query in memory.

command mergMPQueryRelease pQueryPointer

Release a media query from memory.

Parameters:

  • pQueryPointer - a pointer to the query in memory.

command mergMPQueryAddPredicate pQueryPointer,pProperty,pValue

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pProperty - a media item property that can be used as a predicate
    • persistent id - an id for the item
    • album persistent id - an id for the album
    • artist persistent id - an id for the artist
    • album artist persistent id - an id for the album artist
    • album genre persistent id - an id for the genre
    • album composer persistent id - an id for the composer
    • album podcast persistent id - an id for the podcast
    • media types - media types in a list with one per line of:
      • music
      • podcast
      • audio book
      • audio iTunesU
      • any audio
      • movie
      • tv show
      • video podcast
      • music video
      • video iTunesU
      • any video
      • any
    • title
    • album title
    • artist
    • album artist
    • genre
    • album composer
    • is compilation - true if the item is a compilation
    • is in cloud - true if the item is in the cloud rather than on the device
    • podcast title
  • pValue - the value to set the property to. One of:

command mergMPQuerySetGroupingType pQueryPointer,pGroupingType

Group the query results into collections using a grouping type.

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pGroupingType - group item collections as:
    • title - each media item will be in it's own collection
    • album - a collection for each album
    • artist - a collection for each artist
    • album artist - a collection for each album artist
    • composer - a collection for each composer
    • genre - a collection for each genre
    • playlist - a collection for each playlist
    • podcast title - a collection for each podcast title

function mergMPQueryCollectionCount pQueryPointer

Get the number of collections in the query.

Parameters:

  • pQueryPointer - a pointer to the query in memory.

Returns the number of items in the collection

function mergMPQueryCollectionItemCount pQueryPointer,pCollectionNumer

Get the number of items in the media collection.

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pCollectionNumer - a number between 1 and the result of mergMPQueryCollectionCount.

Returns the number of items in the collection

function mergMPQueryCollectionTitle pQueryPointer,pCollectionNumer

Get the title of the collection. For example if the query is grouped by playlist then this would be the playlist title. If it's grouped by album then this would be the album title.

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pCollectionNumer - a number between 1 and the result of mergMPQueryCollectionCount.

Returns the title of the collection

function mergMPItemArtwork pQueryPointer,pCollectionNumber,pItemNumber,pSize

Get an image representing a media item. For example the album cover artwork.

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pCollectionNumber - a number between 1 and the result of mergMPQueryCollectionCount.
  • pItemNumber - a number between 1 and the result of mergMPQueryCollectionItemCount.
  • pSize - the size of the image to return as width,height. Note that apple seems to think when you ask for one image size it should give you something else so don't rely on the size or even aspect ratio of your returned image.

Returns the artwork as PNG data.

function mergMPItemGet pQueryPointer,pCollectionNumber,pItemNumber,pProperty

Get a property of a media item in the collection.

Parameters:

  • pQueryPointer - a pointer to the query in memory.
  • pCollectionNumber - a number between 1 and the result of mergMPQueryCollectionCount.
  • pItemNumber - a number between 1 and the result of mergMPQueryCollectionItemCount.
  • pProperty - the property to get. One of:
    • persistent id - an id for the item
    • album persistent id - an id for the album
    • artist persistent id - an id for the artist
    • album artist persistent id - an id for the album artist
    • album genre persistent id - an id for the genre
    • album composer persistent id - an id for the composer
    • album podcast persistent id - an id for the podcast
    • media type - media types in a list with one per line of:
      • music
      • podcast
      • audio book
      • audio iTunesU
      • any audio
      • movie
      • tv show
      • video podcast
      • music video
      • video iTunesU
      • any video
      • any
    • title
    • album title
    • artist
    • album artist
    • genre
    • album composer
    • playback duration
    • album track number
    • album track count
    • disc number
    • disc count
    • lyrics
    • is compilation - true if the item is a compilation
    • release date - the release date in long seconds since 1970
    • beats per minute
    • comments
    • asset url - the ipod library url which can be used in mergAVPlayer and LiveCode audio player. It can not be used in the LiveCode video player or to read the data of the file.
    • play count - the user's play count for the item
    • skip count - the user's skip count for the item
    • rating - the user's rating for the item
    • last played - the last played date in long seconds since 1970
    • user grouping - the user's grouping of the item

Returns the property value