Posts tagged ‘quodroid’

Recent Developments

I’ve been awfully busy the past few weeks, but finally had three separate evenings to sit down and code on some of my little projects this week. I’m anticipating having more time in a couple weeks, as I gave notice on my job on Thursday. I am, however planning a move and exploring numerous job opportunities in my home province.

I managed to fix a couple bugs on WhoHasMy. As previously reported this project was originally coded in 48 hours for the Django Dash competition. We tied for fifth place and have traded the resulting bitbucket account for a github prize. I’m very happy with the placement given that my brilliant co-developers had nil django experience going into the competition and I hadn’t touched it professionally in months. I added a TOS to the page as requested in a comment on my earlier post, fixed some ordering bugs in the lists, fixed a couple broken links, and made it easier to add information about friends when you loan an item to someone not currently in the system. And here we thought it was 100% bug free when we finished our 48 hour stint and stumbled off to bed.

I have also spent a fair bit of time improving Quodroid, the Android app for controlling quod libet on my laptop from my phone. It now uses fancy icon buttons, allows you to specify the host and port you want to connect to, lists the currently playing song whenever you perform an action, allows volume control, and gives a semi-sane error message when the phone can’t connect. In short, its actually useful and usable by someone other than myself. I’ve been using it regularly the past few days. I still have to arrange it to perform the network stuff in a service instead of the main activity, which occasionally becomes unresponsive if the server is slow to respond. I’m actually becoming more comfortable with Java again as I develop this, its not as evil as I thought, but it certainly cuts into productivity.

Today, I made a few changes to opterator. I wrote my first app (a contrived example code-test for a job I’m pursuing) that actually used opterator a couple weeks back and found it was missing a few features. It now the ability to have multiple copies of a single option. Turns out this actually worked, all you had to do was use the ‘append’ action. I wrote three tests, didn’t change a line of code and poof, I had append support! I then realized that storing the action in the docstring was unnecessary as it could be introspected from the type of the keyword argument. This makes the @param docstrings a lot more readable and informative. As simple as this little module is, I feel its one of my more brilliant innovations.

I’ve also tossed around the idea of having multiple opterated main methods in a single module and allow the decorator to pick which one to call depending on the options. This seemed cool at first, but I think it may violate the ‘one best way’ policy of Python. I also realized that deriving sensible error messages and usage strings would be really painful, from the end user’s perspective, so I’m holding off on this until I’ve decided how best to do it.

Quodroid, an app just for me

I’ve spent a few days reading through the Android developer docs and trying to get Eclipse to cooperate with my outlook on software development. It took giving up on Eclipse to get any real coding done. It was a bit tricky, as I’m not the all-star Java programmer I once was, and I got bogged down on silly syntax errors and library issues. For example, I forgot that ‘new’ is a keyword in Java, and trying to instantiate a class without it results in errors that don’t say, “what do you think this is, Python?”.

The pet project I started is an extremely simple music remote control to interact with Quod Libet, my music player of choice, running on my laptop. So now if I have my phone at the couch I don’t have to get up and walk six steps to my desk to pause or skip to the next song.

The overall architecture is mildly embarrassing, but works well. I’ve got a very simple server running on my laptop that accepts three urls — prevous, next, and play-pause. When one of these is received, it sends a control command to quod libet to perform the associated action. The android client simply displays three ultra-ugly buttons that send requests to a (hard-coded, no less) IP and Presto! I can skip tracks and pause my music!

It’s barely working yet and the design is atrocious, but I’ve posted the initial version to github for peer review and patches storage.

I really just wrote this for myself, the fact that I’m releasing it is mostly because a) I have a blog now and b) I have a github account now.

I’ve got several things on my to-do list, most importantly improving the client interface. I want to add volume control as well, and the ability to return the current song whenever an action is invoked. I might even add a polling feature to update the displayed song on the phone. I also need to do some config stuff, hard-coding the url may actually not be that flexible.