Premise Can't retrieve audio track information in code

Motorola Premise

Shinyshoes

Member
I am attempting to get the digital track information from mp3 files to show on the display pads for my whole house audio system.  When I browse in premise to the audio track, I am able to see the artist, title, album, track, genre, duration, etc. However using code:


dim oTrack
set oTrack= this.CurrentSource.GetValue("CurrentTrack")
this.Artist=oTrack.Artist


The oTrack.Artist always returns "".
 
however if I browse to the track, the info is there........
 
trackinfo.png
 
Any Ideas?

 
 
 
I think....CurrentSource will give you the name of the physical source (Video1, etc). To get the details of the Content that is playing, if you look at the MiniBrowser code (mbMediaZone->mbRenderControlPanel), you'll see that what you want are the properties of the Content that is playing in the zone..MediaZone->NowPlaying t contains the properties of what is currently playing. If you look in Media, the trackname ('NowPlaying') has properties such as Artist, Album, Genre, and TrackName..
 
thus
 
this.NowPlaying.Trackname, this NowPlaying.Artist, and so forth...will give you the info you're trying to extract...
 
Any of the contributors can chime in or set my belief structure correct...
 
I thought the same thing, however I wrote a loop to iterate through all the properties of the "oTrack" object and print to the debug console the .name and the .value of each property.  The artist, title, album, genre etc all appear in the debug console but all the values are blank........
 
I will try tonight to use the nowplaying object to see what I get.  I'll let you know.
 
Thanks for the reply.
 
This will probably fix your issue...
 
As an example, you can grab track names as shown below.  The problem with your code is the CurrentSource is just a container property that only contains the selected AV input (external or internal) or nothing.  The inputs are input objects that get selected as one changes an input selection on a receiver, switcher, etc...
 
It is to the input object that the source is bound to using the "Source" container property of the input object that's selected and not to the CurrentSource container.
 
sTrackName = home.Theater.AVDevices.Receiver.CurrentSource.Source.CurrentTrack.TrackName
 
Also, you are trying to use getvalue to grab an object.  I've never tried this, but according to the help file, this is not the intention.  Use the GetObject methods to generically find objects by type, name, etc...  A track is an object, not a property.  A track name is a property, so sTrackName = this.CurrentSource.Source.CurrentTrack.GetValue("TrackName") will work.
 
However, depending on the event that triggers your code, you should also check for the case of CurrentSource, Source and CurrentTrack containers containing nothing.  Not doing this is asking for trouble and will make your code more error prone.  You need to do this in a nested fashion, so an error will never be thrown.
 
GetValue Method  Premise Scripting Reference
Returns a value on an object.

object.GetValue(Name, Value)


Arguments
object (required)
Any PremiseObject.
Name (required)
String with name of property.


Returned Values
Value
Variant with value of property.

 
Shinyshoes said:
I am attempting to get the digital track information from mp3 files to show on the display pads for my whole house audio system.  When I browse in premise to the audio track, I am able to see the artist, title, album, track, genre, duration, etc. However using code:


dim oTrack
set oTrack= this.CurrentSource.GetValue("CurrentTrack")
this.Artist=oTrack.Artist


The oTrack.Artist always returns "".
 
however if I browse to the track, the info is there........
 
attachicon.gif
trackinfo.png
 
Any Ideas?
 
Back
Top