PDA

View Full Version : A few questions about Slim::DataStores::DBI::Track



Danny Rego
2005-02-26, 14:41
Why is it, when I access $track->artist() it returns me a list of names? Example -> "Van Halen Van Halen David Lee Roth/E. Van Halen/ A. Van Halen/Michael Anthony".

Also...when I access $track->band() it always seems to return nothing? Does "band" have a use? I've never noticed/seen it in tags before?

(for those wondering about WebLogger...I've got it working with v6, and I'm just adding a few more goodies. It should be released in the next few days)

Danny Rego

Dan Sully
2005-02-26, 14:53
* Danny Rego shaped the electrons to say...

> Why is it, when I access $track->artist() it returns me a list of names?
> Example -> "Van Halen Van Halen David Lee Roth/E. Van Halen/ A. Van
> Halen/Michael Anthony".

Are you asking why it gives you a list of names instead of a list of objects?

Or why it gives you a list at all, instead of just a single value (name or object) ?

For the latter - a track can have multiple artists associated with it.

For the former, early on that list was stringified.. I'm not sure if it's still valid.

> Also...when I access $track->band() it always seems to return nothing?
> Does "band" have a use? I've never noticed/seen it in tags before?

Yes - ID3 & Vorbis tags can contain a 'BAND' tag. I've not seen it in the wild however.

It's similar to the Composer & Conductor tags.

-D
--
Minds are like parachutes... they work best when open.

Danny Rego
2005-02-26, 15:01
>> Why is it, when I access $track->artist() it returns me a list of names?
>> Example -> "Van Halen Van Halen David Lee Roth/E. Van Halen/ A. Van
>> Halen/Michael Anthony".
>
> Are you asking why it gives you a list of names instead of a list of
> objects?

Are you saying that I can get it to return objects, intstead of the string?
(ask for an array I take it?!)

> Or why it gives you a list at all, instead of just a single value (name or
> object) ?

This is exactly what I was wondering...is there a setting somewhere to turn
off this behaviour?? I think this is a terrible way to display the artist.

(by the way...to all involved...nice job on the DataStore stuff....very
easy/nice/logical to work with)

Danny Rego

Dan Sully
2005-02-26, 15:06
* Danny Rego shaped the electrons to say...

>>Are you asking why it gives you a list of names instead of a list of objects?
>
>Are you saying that I can get it to return objects, intstead of the string?
>(ask for an array I take it?!)

Yes. $track->contributors() will return an array of Contributor objects. Or a
Class::DBI iterator if used in scalar context.

>>Or why it gives you a list at all, instead of just a single value (name or object) ?
>
>This is exactly what I was wondering...is there a setting somewhere to turn
>off this behaviour?? I think this is a terrible way to display the artist.

I agree - and looking at the code, it's not in use very many places, so if
someone wants to have a go at making it disappear, by all means.

>(by the way...to all involved...nice job on the DataStore stuff....very
>easy/nice/logical to work with)

Thanks. :)

-D
--
There was supposed to be a big kaboom.

mherger
2005-03-23, 08:04
[..]
> (by the way...to all involved...nice job on the DataStore stuff....very
> easy/nice/logical to work with)

I'm still a little stuck with this. I know how I can get a single song and
its information etc. But I don't see a way to access the collection. How
can I eg. easily iterate over all the artists or albums?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

Dan Sully
2005-03-23, 11:41
* Michael Herger shaped the electrons to say...

>>(by the way...to all involved...nice job on the DataStore stuff....very
>>easy/nice/logical to work with)
>
>I'm still a little stuck with this. I know how I can get a single song and
>its information etc. But I don't see a way to access the collection. How
>can I eg. easily iterate over all the artists or albums?

my @contributors = $ds->find('contributor', {}, 'contributor');

That should do it.

-D
--
<Nigel> Please refrain from fearing the reaper.

mherger
2005-03-23, 12:54
On Wed, 23 Mar 2005 10:41:31 -0800, Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

> * Michael Herger shaped the electrons to say...
>
>>> (by the way...to all involved...nice job on the DataStore
>>> stuff....very easy/nice/logical to work with)
>>
>> I'm still a little stuck with this. I know how I can get a single song
>> and its information etc. But I don't see a way to access the
>> collection. How can I eg. easily iterate over all the artists or
>> albums?
>
> my @contributors = $ds->find('contributor', {}, 'contributor');
>
> That should do it.

This is too simple to be true... And I was messing with the second
parameter :-). Thanks!

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)