COLLECTION(1)

NAME
Audio::XMMSClient::Collection - Media collections for Audio::XMMSClient

SYNOPSIS
  use Audio::XMMSClient;

  my $coll = Audio::XMMSClient::Collection->new('match', {
          artist => 'Solche',
  });

METHODS

  new

Arguments: $type, \%attributes?
Arguments: $type, %attributes?
Return Value: $collection

  my $coll = Audio::XMMSClient::Collection->new('match', {
          artist => 'Solche',
  });

Create a new collection instance of type $type. Also sets the collections %attributes, if given.

  parse

Arguments: $pattern
Return Value: $collection

  my $coll = Audio::XMMSClient::Collection->parse("artist:Solche +compilation");

Try to parse the given $pattern to produce a collection structure.

  set_idlist

Arguments: @ids
Return Value: none

  $coll->set_idlist(qw/1 42 1337/);

Set the list of ids in the given collection. Note that the idlist is only relevant for idlist collections.

  add_operand

Arguments: $operand
Return Value: none

  $coll->add_operand($other_coll);

Add the $operand to a given collection.

  remove_operand

Arguments: $operand
Return Value: none

  $coll->remove_operand($other_coll);

Remove all the occurences of the $operand in the given collection.

  idlist_append

Arguments: $id
Return Value: $success

  my $success = $coll->idlist_append(5);

Append an $id to the idlist.

  idlist_insert

Arguments: $index, $id
Return Value: $success

  my $success = $coll->idlist_insert(42, 2);

Insert an $id at a given $index in the idlist.

  idlist_move

Arguments: $from, $to
Return Value: $success

  my $success = $coll->idlist_move(0, 3);

Move a value of the idlist to a new position.

  idlist_clear

Arguments: none
Return Value: $success

  my $success = $coll->idlist_clear;

Empties the idlist.

  idlist_get_index

Arguments: $index
Return Value: $value | undef

  my $value = $coll->idlist_get_index(2);

Retrieves the value at the given $index in the idlist.

  idlist_set_index

Arguments: $index, $value
Return Value: $success

  my $success = $coll->idlist_set_index(3, 1);

Sets the $value at the given $index in the idlist.

  idlist_get_size

Arguments: none
Return Value: $size

  my $size = $coll->idlist_get_size;

Get the size of the idlist.

  get_type

Arguments: none
Return Value: $type

  my $type = $coll->get_type;

Return the type of the collection. Valid types are "reference", "union", "intersection", "complement", "has", "equals", "notequal", "match", "smaller", "smallereq", "greater", "greatereq", "order", "limit", "mediaset", "idlist"

  get_idlist

Arguments: none
Return Value: @ids

  my @ids = $coll->get_idlist;

Return the list of ids stored in the collection. Note that this must not be confused with the content of the collection, which must be queried using "coll_query_ids" in Audio::XMMSClient.

  operands

Arguments: none
Return Value: @operands

  my @operands = $coll->operands;

Get a list of operands of the collection.

  attribute_set

Arguments: $key, $value
Return Value: none

  $coll->attribute_set(field => 'artist');

Set an attribute $key to $value in the given collection.

  attribute_remove

Arguments: $key
Return Value: $success

  my $success = $coll->attribute_remove;

Remove an attribute $key from the given collection. The return value indicated whether the attribute was found (and removed).

  attribute_get

Arguments: $key
Return Value: $value | undef

  my $value = $coll->attribute_get('field');

Retrieve the $value of the attribute $key of the given collection.

  attribute_list

Arguments: none
Return Value: %attributes

  my %attributes = $coll->attributes_list;

Get a hash of all %attributes of the given collection.

  universe

Arguments: none
Return Value: $collection

  my $universe = Audio::XMMSClient::Collection->universe;

Returns a collection referencing the whole media library, i.e. the "All Media" collection.

AUTHOR
Florian Ragwitz <rafl@debian.org>

SEE ALSO
Audio::XMMSClient

COPYRIGHT AND LICENSE
Copyright (C) 2006-2008, Florian Ragwitz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.