View Full Version : UPnp driver for foobar
pjgregory
10-21-2011, 07:50 AM
Hi Dean
I have now got most of this working. I can select an album, pass it to foobar and it will play with all the transport controls working, except for "Stop" which seems to start playing the track again.
The other problem I am having is accessing the Playlist information in a "Now Playing display". All of the single Field Text values such as CurYear, CurItem Artist, CurColName etc. are OK. But I cannot get a Media Item Browser to show the current playlist.
Is this data available in the current version of the driver or is it just that I am not setting up the Media Item Browser correctly. The only documentation on how to do this that I have found so far is the VIDABOX training manuals and these don't seem to match the current widget names and fields.
PJG
pjgregory
10-21-2011, 09:42 AM
Looking at the XML repository file produced by J.Rivers, there are a number of fields that are present in the meta data, but not yet exposed in the foobar driver. These would be especially useful for repositories with mixed file types and resolutions.
How about
Comment: (Free Text for album notes)
Bitrate:
AlbumArtist:
FileTYpe: (wav,flac,mpg etc.)
Sample Rate:
Number of Channels:
Bit Depth:
Star Rating:
I would assume that any fields that are not generated by a particular repository would just be set to a blank string.
PJG
Dean Roddey
10-21-2011, 10:11 AM
On the Stop, the way that UPnP defines stop is to stop and unload the media. Really you want to use Pause for most cases in UpnP where you might use Stop in some other systems. Stop doesn't allow you to restart the song again. So, since it unloads the media, the player moves on to the next song in the playlist. If there's only one, and you don't have it in jukebox mode, it just plays that one song again.
On the playlist, it works fine for me. I just installed it in place of my existing player and all my standard media templates worked fine, including the playlist, as best I can recall though I'll check it again.
On the metadata, whether that info is available just depends on the repository you are using, since that's where it comes from. Which repository are you using? Or you do mean what information is made available by the renderer driver for the currently playing track? I'm not sure that it would do you much good for setup purposes, because by the time it shows up the song is already playing, right? So it might be too late to do any setup based on that info. There would have to be some mechanism put into place to allow you to pre-react to the upcoming song or something.
pjgregory
10-21-2011, 12:05 PM
Hi
Yes. The "Stop" behaves just as you say, but not as I expected. As "Pause" stops playing allowing a restart with a "Play" command, I assumed "Stop" would stop playing and clear the play list. I can do this with the ClearPlayList field.
The repository is the J.Rivers XML driver.
I looked at the XML file exported from the library to find the additional fields. When the XML file is loaded into an instance of the Repository Driver, I assume CQC parses the file. If it can already store things such as Title, Year and Genre for each album or track, could it not store this info as well. Even if the information only become available when the track starts playing, it would still be useful, especially the comment field for music notes.
Of course, it it were available when the repository is loaded, then it would open up the future possibility of expanding the Category Browser to making selections on multiple fields - say Genre AND Year AND BitRate etc.
I will work on the Now Playing stuff again tomorrow. Is there an example template anywhere that I could download to see how it is done with the standard CQC renderer?
PJG
Dean Roddey
10-21-2011, 12:40 PM
I could look at adding some more fields, but it's quite a lot of work to do that, so it might be a little while before I could get to it. It affects all of the repository and renderer drivers, the media interface widgets, and the XML GW protocol, the CML methods for accessing repo info, etc... So it has a lot of side effects to add new stuff.
It is the case in all the renderer drivers that Stop (even when it's implemented more normally than UPnP does) doesn't clear the playlist. It just stops playing. I think that Stop vs. Pause has more meaning in the video world, where Pause keeps the image up and Stop actually stops displaying the image. In the music world, it makes less sense and just using Pause typically would be appropriate. But the renderer drivers have to support both video and audio so it has to support Stop as well, even though the foobar driver doesn't have any video support.
Let me look at the playlist thing. Maybe I missed something. But generally you would just put a Media Item Browser (not a mdia repo item browser) on the screen and associate it with the media renderer driver and it should show the playlist. I'm pretty sure that was working for me, but I'll confirm it.
Dean Roddey
10-21-2011, 06:50 PM
BTW, for anyone reading, this is something that probably should be in the beta section, and I'll probably move it there in a bit. This driver was just introduced in the 4.0.5 beta.
pjgregory
10-21-2011, 10:33 PM
Dean
I'll keep posting foobar driver stuff here until you move the thread.
1. I have now got the Media Item Browser working for the Track Titles of each item in the playlist. In the Rev 4.0 documentation for this widget, it mentions a LinkToField command "to associate it with a different field from what it was originally configured for". I have tried this with an [On Load] action for the template, but none of the driver fields will display.
In the Logitec Squeezbox driver that I use for my other players, there are fields such as PlayListAlbums, PlayListArtists, PlaylistDurations, PaylistTitles etc. I can place a number of Field Item Browsers on top of each other and thus see all the information for each track. Can these fields be made available in different Media Item Browsers from the foobar driver.
2. In the CQSLAudio Player (the basis for the foobar driver), it has a PlayList Mode which seems a neat idea, especially the Random Category. But it needs a SetRandomCategory field and this is missing from the foobar driver.
PJG
Dean Roddey
10-22-2011, 12:00 AM
The LinkToField should work, though generally it's done in the OnPreload, so that it's updated before it event starts displaying. What types of widgets are you trying to do it on?
The standard media renderers aren't really like the Squeezebox driver. It's not a standard media renderer driver, and is really something quite different. It would be a lot of work to add that kind of stuff. If I were going to do that I'd end up probably just enhancing the media item browser for multiple fields or something like that. But that would be a good bit of work.
On the set random category, yeh, that should be there. Not sure how I lost that. I'll add it back in for the next drop.
I'll go ahead and move this thread. It'll still be visible here, but it'll take you to the beta section where the thread will live once I move it.
Dean Roddey
10-24-2011, 05:55 PM
Did you ever figure these issues out?
pjgregory
10-25-2011, 11:21 AM
I have been busy today in getting my new audio system sorted out.
I have also hit a problem in relation to where the music is stored. I think that if I run J.Rivers on the same machine that the music directory is stored on, then the library export XML files gives local references to file names, rather than network locations so a foobar player running on a different machine cannot fine the network files.
I have also implemented the "PlaylistMode" field. While I can see that the value of the field is changed, I cannot see any change in behavior. For example, if I set the PaylistMode to "Jukebox", then after each track has finished, I would expect the playlist to get shorter, but I cannot see anything happening.
Will bash on this tomorrow.
PJG
Dean Roddey
10-25-2011, 12:02 PM
The last thing played should be removed in Jukebox mode, that is true. That was working for me in my testing I think, but let me know if you still don't think it's working.
On the paths, you need to set up J.River to access the files via a directory share, not a local drive (or a shared drive either.) Only shared directories are universally accessible throughout the network and to all user accounts.
There is a way in J.River to tell it to change the location path of all of the files, but I can't remember what it is now. But you'll want to share the directory that the music is in. You may also want to set the access rights in teh Windows security to allow at least read access to all users. Then tell J.River to go through its database and change to accessing the files through that shared directory.
Then reload the CQC repository driver and it will then expose the files via that directory share and everything will be happy. If you use our audio player anywhere, it runs in the background, so you may on those machines where it runs set up the CQC service to log in under a regular Administrative account so that it will have network access rights, which it often doesn't under the default SYSTEM account that services run under normally.
Dean Roddey
10-25-2011, 12:04 PM
BTW, it's unfortunate that in this release that made the driver available to you that the theme based template auto-generation stuff is temporarily out of service as it's being changed. Else you could have just auto-generated a set of templates that would demonstrate nicely how all that stuff works and could have just adapted them to your use.
pjgregory
10-26-2011, 04:21 AM
Its nice to know that eventually this stuff will come out of the box, BUT in the meantime...
I have both NORMAL and JUKEBOX playlist modes working as I expect. The SHUFFLE also works in the sense that at the end of a track, or when I press the Next key, the player will jump to a random track rather than the next in the list. However, the list order does not change so it is impossible to see what is coming next. Most players that I have used, resort the list every time the SHUFFLE is pressed - never mind. As I said before, RANDOM CATEGORY is not working as the field to set the category is missing from the driver.
Also missing from the driver is a CurrentPlaylistIndex, that is automatically changed as tracks are played. In the Media Item Browser for the playlist, I can save the StdRTV:SelectIndex using an [OnSelect] action, but I cannot find a way to have this change with the currently playing track. I have tried setting a trigger on the PLSerialNumber field to trigger a template action, but then I cannot see the StdRTV:SelectIndex field in the template.
Once I can access the CurrentPlaylist Index, then I can do some smart template actions will highlight the currently playing track and autoscroll the playlist as tracks are played.
I have posted a question on the JRivers forum about getting the Library XML file with directory share names rather than local names. In the meanwhile, I have manually edited a small XML file and am trying to get the remote player to work.
PJG
pjgregory
10-26-2011, 06:38 AM
In the driver, there are two fields, CurLabel and CurDescr which according to the CQC driver doc, should give information on the Current Label (Studio) and Current Description of the item.
Which Tag fields do these correspond to? I have tried [Comment] and [Description] but with no luck even though I can see that there is information in the XML file. There is no [Label] field in JRivers, but there is a [Copyright]. Is this the one you use?
When you do get around to fixing this, what about a parser that finds all the tags for each item in a repository and creates a CurTagName field for each?
PJG
pjgregory
10-26-2011, 09:10 AM
After a hard days work, I now have everything working - except for the issues I have raised.
My new Audio Interface will control 2 foobar players in different rooms, streaming files from a third computer acting as the music server. Playback in my new music room is HD audio with 24/96 or 24/192 flac files. I can select and play albums and control the room lighting. When I have sorted out the metadata and CurPlaylistIndex issues, I will post my new Interface which is inspired by the Meridian Sooloos system.
PJG
Dean Roddey
10-26-2011, 11:30 AM
I added a PLIndex field. It will be set to 0xFFFFFFFF when there is no track playing, so you have to be careful to check that.
The Label is the Studio. It's called Label because I could only pick one name and it has to work for music or movies, so I used the movies one. But it would normally contain the studio name.
My JR XML content has no label and no description field, and no Copyright for that matter. Can you open up your file in a text browser and cut out the info for a single <item> block and send it to me, so that I can see what info yours has.
The random category stuff is only currently implemented in our player. I'll see if I can quickly get it into this one.
pjgregory
10-26-2011, 12:00 PM
Here are a typical set of item tags for a *.flac file generated by JRivers Library XML. I think that the flac files use vorbis tags which give a much greater range of options than ID3 tags for MP3 files
<Item>
<Field Name="Filename">\\Vetinary\My HDAudio\Jazz\Arne Domnerus\Jazz at the Pawn Shop\02- I'm Confessin'.flac</Field>
<Field Name="Name">I'm Confessin'</Field>
<Field Name="Artist">Arne Domnerus</Field>
<Field Name="Album">Jazz at the Pawn Shop</Field>
<Field Name="Genre">Jazz</Field>
<Field Name="Bitrate">4388</Field>
<Field Name="Image File">Arne Domnerus - Jazz at the Pawn Shop.jpg</Field>
<Field Name="Duration">485.0336561999999958</Field>
<Field Name="Track #">2</Field>
<Field Name="Media Type">Audio</Field>
<Field Name="Album Artist">Arne Domnerus</Field>
<Field Name="Description">30th Anniversary 180gm vinyl pressing</Field>
<Field Name="Date Imported">1319124396</Field>
<Field Name="File Type">flac</Field>
<Field Name="File Size">266104023</Field>
<Field Name="Date Created">1301731637</Field>
<Field Name="Date Modified">1319638180</Field>
<Field Name="Year">1982</Field
<Field Name="Rating">5</Field
<Field Name="Sample Rate">192000</Field>
<Field Name="Channels">2</Field>
<Field Name="Bit Depth">24</Field>
</Item>
Dean Roddey
10-26-2011, 12:36 PM
OK, that's the same as what I have except the descriptoin one. Still not any info about the lable that released the album though. I can check for the Description field and use if it's there.
pjgregory
11-09-2011, 04:42 AM
I have just moved from 4_0_6 to 4_0_8 and I think that the CurDescr field is now broken. It will not provide data for either the "Description" or "Comment" field. The correct form of the tag is
<Field Name="Comment">Analogue Productions 180g LP; Mastered by Doug Sax</Field>
I have also lost all the cover art images and music tarcks as the repository no longer works with the disk share name, rather than the absolute disk reference. So D:\My HDAudio...... is OK but \\MyMachineName\My HDAudio... fails. As a result, I can no longer play tracks over the network.
Is there anything I can check to see where the failure is occurring?
PJG
pjgregory
11-09-2011, 04:54 AM
Forget about the machine name problem. I think I somehow messed up my disk share. Its working again at least on this machine.
PJG
Dean Roddey
11-09-2011, 10:40 AM
I'll look at it.
pjgregory
11-19-2011, 04:41 AM
The "Comment" tag field now works correctly in 4.0.9 - Thanks.
I know I have suggested a long term solution for automatically generating Fields from Tags, but in the mean time, is there any chance you could add "Bitrate", "Sample Rate" and "Bit Depth"? A little cut and paste of the existing code - in 2 places of course.
PJG
Dean Roddey
11-19-2011, 11:02 AM
As I'd mentioned before, that's a large undertaking because any change to the media repository info just touches lots of stuff. So I can't do it in the short term. But I'll put it on the list. At some point I'll have a number of things that need to be addressed in that area and can amortize the effort by doing them all at once.
pjgregory
12-01-2011, 07:58 AM
I have found a problem with the transport controls and the Media Item Browser. With the Transport - Next command, sometimes the playing track will move on by 2 rather than just advance by one. In the same way, when you use the [On Select] action in the Paylist browser, it will sometimes jump to the selected track, but then immediately jump to the next track and start playing it instead.
Up till now, I could not be sure if it was just some problem with the touch screen or an issue with the driver. However as part of my code to create a stringlist of track durations, I step through all of the tracks to store the duration for each one, the core code for each step is:
Devices:FieldWrite2(%(GVar:PlayerName), Transport, Next, True)
Devices:WaitFieldValue(%(GVar:PlayerName).CurItemT otal, %(LVar:CurItemOttal), NotEqual,5000)
Devices:FieldRead2(%(GVar:PlayerName), CurItemTotal, LVar:CurItemTotal, True)
..........
So after issuing a Transport Next command to move to the next track, I wait until the CurItemTotal changes before reading the new value. Athough this mostly works, I do find that the final list misses 2-3 time values in a sequence - evidence that the Next command is actually jumping over a track.
Is this some form of timing issue with the driver or UPnp.
PJG
Dean Roddey
12-01-2011, 10:33 AM
I'm sure it's just an issue with timing. The playlist stuff was never really supposed to be used in that way,and you are going to be pounding on the foobar player pretty hard doing that. Just because my driver has gotten far enough to start filling in the metadata fields doesn't necessarily mean that foobar has fully processed the file, so it may just be skipped over some for that reason.
For what you are trying to do, it would be way better to do a CML class that quries the stuff before the cookie is even sent to the player, where it can look at the information and get it all ready, then queue the stuff on on the player.
pjgregory
12-01-2011, 11:07 PM
For what you are trying to do, it would be way better to do a CML class that quries the stuff before the cookie is even sent to the player, where it can look at the information and get it all ready, then queue the stuff on on the player.
Well I can agree this, but it is not something that I can do. I have inserted 4sec pauses after each Transport.Next command, but it still skips over some tracks. There is also the other problem that when using the [On Select] action in the playlist browser to send a CurItemCookie, the player jumps to the selected track and then immediately skips to the following track and starts playing it, not the one selected.
This is not an issue with hammering the driver with multiple commands. A single command will sometimes cause a track skip so either the foobar player or the driver has some timing issue. Is there any way of handshaking between the player and the driver to ensure that a command has been correctly received and acted upon.
PJG
Dean Roddey
12-01-2011, 11:19 PM
I'll take a look at that. It's pretty much the exactly same logic as other drivers use, since they all share a common playlist manager, but maybe something strange slipped in. Have you tried putting the driver into verbose mode and see it's complaining perhaps that it didn't get an acknowledgement of from the Foobar player and so it thought it failed and tried to move forward to the next one?
Dean Roddey
12-03-2011, 12:23 PM
So, the way Next works is that, since I'm managing the playlist, I first figur out whatever the next song in my playlist is, then send the player a Stop to stop it playing the current content. Then I explicitly send it the new URL to make the current URL, and then send it a Play command.
Since the playlist management is the same in all the renderer drivers we have, I don't think it's problematic. So I'm not sure what's going on. I'm not sending it some kind of 'skip to next' command since it only knows about one song at a time. The only way it would seem to be possible is if I'm somehow seeing an end of media from it from the previous one after the new one is started and so I think it's time to start a new one. I can try eating any outstanding messages after the stop or something, to make sure I don't see it later, assuming it comes in some reasonable time frame.
Dean Roddey
12-03-2011, 02:20 PM
I made the above change, so try it again after this next drop. It at least does no harm and hopefully will cure this issue.
pjgregory
12-13-2011, 05:57 AM
Well I have just got back from my trip and loaded 4.0.12 as that is the most up to date. I tried looking in the Admin Interface - Field Browser for the names of the new fields, but cannot see any. I have now deleted and re-installed both the JRivers media repository and the foobar player, but still I cannot see any of the new fields.
Have you tested the new stuff with my combination of repository and renderer?
PJG
pjgregory
12-13-2011, 07:35 AM
One bit of good news. The UPnp Stop Before Next has fixed the problem with the player skipping a track. My auto scan through all the tracks to build string lists of "Artist - Album" and "Duration" is also working correctly without any artificial Pauses. I need to tidy the logic up a bit and mute the player while it it changing tracks but then it should all work for albums.
Then I need to add the same logic to the Playlist screen which selects individual tracks from multiple albums.
PJG
pjgregory
12-15-2011, 06:12 AM
There is another minor problem. From reading the documentation on the CQC Integrated Player (on with the foobar driver is based), I have found the field "DelPlaylistItem". Writing an ItemCookie to this should remove the item from the playlist. In this code fragment, I either enqueue an item or remove it from the list depending on the sate of LVar:Value
If System::Equals
P1=%(LVar:Value)
P2=4
Devices::FieldWrite2
P1=%(GVar:PlayerName)
P2=DelPlaylistItem
P3=%(GVar:ItemCookie)
P4=True
Else
Devices::FieldWrite2
P1=%(GVar:PlayerName)
P2=EnqueueMedia
P3=%(GVar:ItemCookie)
P4=True
End
The Enqueue path works while the DelPlaylistItem fails with a message saying that "The value written to field AudioHD1.DelPlaylistItem was rejected by the driver".
Any suggestions?
PJG
Dean Roddey
12-15-2011, 11:29 AM
I'll look at it. Maybe something got lost in the translation.
vBulletin v3.5.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.