Monday, April 4, 2011

Extracting currently playing track information in Banshee

Last class, half of the team was out so it was just Shaun and I working on the project. Shaun was having Linux troubles as well as getting the Banshee software, Mono Develop and the Banshee Community Extensions branch  set up right. So, while I was assisting him with that I was also working on figuring out how our team would extract the track title, artist name and album title from a currently playing track. Before the class I had been struggling through every possible class in the source code and during the last class I figured out how to extract the information! I found reference to a TrackInfo object in the PlayerEngine sub class called CurrentTrack in the BaseTrackListView class. The actual reference looked like this:

current_track = ServiceManager.PlayerEngine.CurrentTrack;

After this reference into our Social extension skeleton code and extracted TrackInfo attributes such as DisplayTrackTitle, DisplayArtistName and DisplayAlbumTitle, I ran Banshee and had the information spit out onto a command line once I had a song playing, and it worked! You never know what you'll find just by digging around inside the source code. Even though I found this reference in the BaseTrackListView class, a search of the source code found that this reference is found in many other classes as well. The next step now will be to figure out how to load this information into a Gwibber window as well as getting the window to show up in Banshee.

No comments:

Post a Comment