Adding last played date/time & 2-way comms with Girder

title says it all

Adding last played date/time & 2-way comms with Girder

Postby m_ski on Wed Jun 15, 2005 11:46 am

I have managed to implement a method of adding the current date and time to a database item every time it is played. This then allows xlobby to sort on this field and implement a 'last played' sort order showing most recently played albums at the top of the sort order.

Lastplayed info shown in musicdetails screen...
Image

Main Menu showing last 5 albums played...
Image

The method I have used also demonstrates 2-way communication with Girder using a simple spreadsheet to generate the event xml file. This could be used as the basis for gathering all sorts of information from data sources through Girder - Amp Volume, X10 device status, etc…

The challenge I gave myself was to implement a facility to show the most recently played database items at the top of the sort order as I often find myself searching through lots of albums in order to find the same few albums that I play over and over again.
Unfortunately, it is currently not possible to use the xlobby datetime variable in order to store the current datetime into a database.

In order to add the current datetime the following is carried out in my skin…
1) user presses play album button
2) xlobby sends eventstring to girder (called GetTimeDate)
3) Album starts playing in winamp
4) Meanwhile, eventstring triggers 'Send DateTime to xlobby' multigroup event in Girder
5) Girder Lua script puts Year, Month, Day, Hour, Minute into 5 separate Girder variables (I add constant values to each of these so that they are all different numbers, GirderYear = Year, GirderMonth = Month + 50, GirderDay = Day + 100, GirderHour = Hour + 200, GirderMinute = Minute + 300)
6) Girder uses sendmessage plugin to send each of these variables to xlobby (WParam = 247, LParam = variable name)
7) Xlobby events are then triggered to set the values of GirderYear, GirderMonth, GirderDay, GirderHour & GirderMinute xlobby variables depending on the message sent from Girder. (This is the part where the excel spreadsheet comes in – see below).
8 ) The variables are then added to the current database item in a field called 'lastplayed' in the form YYYY MM DD HH:MM which can then be used as a sort field.
9) After the new last played time has been set in the current item the database must then be sorted again so that the item moves to the correct place in the database.
10) It is now possible to display, for example, the last few albums that have been played on the main menu for quick access without having to enter the 'music' screen.


Attachments: Girder gml file
Xlobby event xml file for datetime example

And if you want to create your own massive event xml files for other Girder variables...
Excel spreadsheet to create xml file
These 3 files can be found in... http://mysite.wanadoo-members.co.uk/mski/Send_DateTime_to_Xlobby.zip

To enable this functionality into another skin…
1) Copy DateTime_from_Girder.xml into xlobby\events folder
2) Add 'Send DateTime to xlobby.gml' to your Girder setup
3) Change the play album event to do the following
Girder:send event string:GetDateTime
Category:Play:music
Timer:Wait:600
category:Variable Set:music:lastplayed: %variable>GirderYear% %variable>GirderMonth% %variable>GirderDay% %variable>GirderHour%:%variable>GirderMinute%
Category:set sort order:music: -1:lastplayed:artist:albumname:tracknumber:trackfilename
4) You can now display the 'lastplayed' field which displays when the album was last played. See my example musicdetails screen.
5) You can also display the last few albums on the main menu page very easily just by displaying a small part of the music category. I have this so it only appears when the cursor is over the 'music' button.
6) This procedure will always change the sort order so that the most recently played albums are at the top of the database which is how I have my database sorted anyway. I am hoping to add features to change the sort order from within the skin so that it can either be in lastplayed order or alphabetic order.

I have done all of these mods onto Steven's latest experimental skin but unfortunately my ISP keeps dropping out my connection when I try and upload the 5Mb zip file. I will try and get the entire skin posted at some point so you can see how I have it working, but hopefully the details above are enough for somebody else to try this out.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Sounds very interesting

Postby timwarner on Wed Jul 20, 2005 11:52 am

This would be something I would like to use when I get some time. Thanks for posting the info.
timwarner
 
Posts: 58
Joined: Thu Feb 17, 2005 9:56 pm
Location: UK