Lair of the Beast

Dear Readers, it has been a fortnight since I last wrote. When I left you there was plenty of infrastructure but few visible artifacts and at the time I said I felt on the brink of something akin to an avalanche. So, take a seat as there’s quite a lot to get through. But first, I’ll tell you about my new toy!

Inverter

Some weeks ago, I had asked Andrés about using third party libraries and in the discussion he remarked of his distaste for Inversion of Control containers. In a rebellious streak1 I went ahead and wrote one, but its design is around the ObjectManager interface so it sports a slight twist in that it can only give you things that already exist but it will tell you when new things appear.

If the evolving property wrappers were compared to the cheapest, flimsiest snowboard you could buy, then this was like… well, this analogy is going nowhere, but it would be comfortable; you could ride all Nine Circles and if you happened to run down Beelzebub you might not even notice until you got back and the cheering started.

As the last supporting DBus component it has been invaluable, saving time that I was able to apply on the secondary aspect of the project.

MTP Support

Banshee has provided support for MTP devices through libmtp for a long time but the increasing numbers of Android devices supporting it exclusively has hi-lighted some issues with how we handle them.

I’m quite proud to say that I’ve had my mother using Free Software for some years, she loves it and rarely has any problems, but whenever she wants to change her playlists one particular difficulty she has is getting her phone to connect. We had logged one of the major problems she was encountering already.

After a false start and some steering from Andrés I’d like to share a screenshot showing the result of the latest approach and while sparing you the technical details I have to stress that the patch this comes from is yet to be reviewed.

Presently, when Banshee is unable to connect to a DAP it is quite outwardly silent, unless you happen to be listening on a virtual terminal where it’s usually screaming loud enough to break plates. The patch attempts to solve the problem initially by providing a graphical component where Banshee can show the problematic device and then with a magic button for taking remedial action.

Device Unavailable

The approach is very simple, it works remarkably well and MTP devices, once slippery eels where Banshee was concerned, are easy to get a hold of. You can freely disconnect, use them in nautilus and then come back to Banshee.

Bluetooth DAP

For those of you bored until now, here it comes, Bluetooth synchronisation works! <applaud! />

Implementing it took me on an arduous quest into the dusty depths of Banshee’s synchronisation mechanism. I tried to make it bend to my will, alas, it was too strong a foe but with guile I emerged (mostly) victorious.

I saw it’s wrath when first stepping into it’s domain. Little did I know that a third of videos and double that proportion in songs would perish that day. If it weren’t for the fact that the beast also took with it that jaw gratingly annoying Facebook messenger notification sound I might have turned back, licked my wounds and spoke no more. As it was, the minor blessing intrigued and perplexed me.

It was cunning, and had lulled me into a false sense of security. Banshee feeds on metadata; it had the track names, numbers and in some cases the album title and artist name, but it wanted More.

All I had to work with were file names so, fearing a repeat of our first encounter, I wove SQLite queries in the dead of night trying to find the best way to satiate its hunger. After an abortive attempt I was on the back foot, as some might say.

It was clear, the metadata-morsels obtained from Obex FTP would not be enough. Banshee wanted the genre and year, which only a foolhardy optimist would hope to find encoded in a file name, to calculate a unique value for each track. But I had discarded an assumption too early, and filling in the missing information by liberal matching against the local database keeps Banshee from belligerence. Thus, the day was won.

As you can see from the screenshots below, using a remote bluetooth device is identical to using it locally. Albeit without video support as I deemed those files generally too large to transfer over a slow connection.

Preferences View
Source View

Next Quest

With most of the battle behind us, there’s still a few things left to do. The first of which is to make the code resistant enough to its environment, it works but isn’t reliable enough to have Banshee do it without supervision. A few extra types to handle redundancy, some graphical components and a bit of data sorting, and we’ll be looking at providing that killer feature.

Footnotes

  1. Not really, but antagonism is good for stories.
Advertisements

2 thoughts on “Lair of the Beast

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s