Just Playlists 1.6.6—Bug Fix: Rotation While Loading a Playlist Sometimes Reset Last Playlist

February 26th, 2010

I found and fixed a fairly nasty bug in Just Playlists, so I’m releasing a new version, even though the last one hasn’t been out long.

If you were on the playlist chooser screen, clicked on a playlist, and then happened to rotate your phone during the load, the save data for the last playlist you were using could have been corrupted, so that the next time you loaded it, it would have forgotten where you were and would ask if you wanted to shuffle it.  Also, if you exited and re-ran the program, it may have started without a playlist loaded, just like the first time you ran the program after installing it.  I’ve corrected both problems.

While I was at it, I also added a clickable link to this blog in the “About…” dialog box.

Just Playlists 1.6.5—Faster Track Information Display Transitions, Text Crawls, Bug Fixes

February 23rd, 2010

I’ve managed to shorten the time it takes to load the artwork and tag information as tracks change during continuous playback.  Most of the time, the track starts to play at almost the same time as the information loads on the screen and the seekbar resets to 0.  If you’re running other things on your phone or memory is short, it could affect the time things take to happen.  But, overall, it should work a lot better.

I also found a good way to enable long text lines to crawl across the screen, rather than just using ellipses to indicate some of the text has run off the screen.  I’ve implemented this wherever I could that made sense to me.

Beyond this, I found a few more bugs that could cause crashes or strange program behavior.  My favorite one was when my phone crashed and, after it restarted, Just Playlists thought that my playlist files had changed and started offering me the option to shuffle them.  As it turns out, sometimes the version of Android I have running on my phone seems to get confused about the time zone and sets file modification dates improperly.  Thus, Just Playlists sees the file as changed because of the new timestamp and offers to reload them from scratch.  To avoid this, I now store the playlist files’ MD5 checksums and only consider a file to have been changed if this changes.  Thus, the actual content of the file must change and not just its last modified timestamp.

As I stated in a previous post, the next enhancement to the program will be a playlist creator/editor.  This will probably be a bit of work, so the next update might not be for a while, unless I find or hear about a major bug in the current version.  I hope I can also roll out the playlist editor in increments, adding features over time.

Just Playlists 1.5.2—Show Database, Notification Preference Setting

February 14th, 2010

Time for a new version of Just Playlists.  In this version, the “Show Database” option menu item is active.  It shows the contents of the program’s database, which is where information is saved about each playlist you’ve used.  There is one entry per playlist, with a variety of data saved that allows the program to start playing a playlist from where you left off the last time you used it.  You can delete an entry by long-clicking on it.  The only entry you can’t delete is the top one—which is the currently-loaded playlist.  Entries are sorted in descending order by the date they were last loaded.  The currently-loaded playlist’s entry is the first and the playlist you haven’t loaded in the longest time is at the bottom.  Deleting a playlist entry doesn’t delete the playlist file from your microSD card.  Thus, deleting any entry for a playlist is pretty much the same as setting it up to reload from scratch—after deleting the entry, the next time you load the playlist, you’ll be asked if you want to shuffle it or not and a new database entry will be created.

The only time may want to delete a playlist entry is if you have deleted the playlist M3U file from your microSD card.  Once you’ve done this, you’ll see that the database entry for that playlist will say “File not found” in yellow text for the “File mod time” database field of the entry.  There is no modification time because the file no longer exists.  Leaving the database entry in the database doesn’t hurt anything, but it’s nice not to have unused stuff cluttering up the database.  If you have a huge number of unused entries, it could slow down the program a bit, so this is another reason you may want to delete “orphaned” entries.

The new preference I’ve added allows you to tell the program not to display its icon in the notification bar when it isn’t actively playing a song.  This is how the default Android music player works.  I prefer having the notification icon showing whenever the program is running—just so I can get back to it from any screen.  If it bugs you to have it showing, unchecking the option in the “Preferences” screen will take care of it.

For the next version of the program, I’m going to see if I can speed up the load time of the album artwork and track information when the next track starts playing during a regular playback session.  Right now, it can take a second or more for the info to load after the new track starts playing.  After that, I’ll take a look at creating a built-in playlist creator/editor for the program.  I haven’t considered this a high priority, since it seems to me creating complex playlists is going to be cumbersome on the phone compared to doing it on a computer and then uploading.  But for quick, small playlists, it could be handy.

Just Playlists 1.4.2—Minor Improvements and Bug Fixes

February 7th, 2010

Though I don’t have the “Show Database” feature ready yet, I improved a couple things and fixed some bugs that make a release worth it.  The bugs may have caused crashes when you rapidly changed between playlists or used the “Show Playlist” menu item.  As to the improvements, first, if you use the “Show Playlist” menu item to see the contents of the current playlist, the current track will be highlighted in green text.  In 1.4.1, the track won’t be updated if you have the playlist screen open when the next song begins to play.  In 1.4.2, it will.  If you leave the playlist screen open, the currently-playing track will always be in green and at the top of the screen.

The other improvement is sort of a bug fix.  It’s actually more of a workaround for a problem with Android’s Java implementation.  When using Just Playlists, you may have had the track’s artwork not show up even though you have artwork embedded in the file.  This shouldn’t happen any longer—unless the artwork really isn’t there.

For the curious, here are the gory details.  I use Java’s getCanonicalPath() method to turn the track name read in from an M3U playlist file into a fully-qualified file path with all relative references resolved.  This is used as a lookup key for ID3 tag information in Android’s database of scanned media information.  But, there seems to be a bug in Android’s Java implementation such that every so often, the method will throw a NoSuchElementException.  This isn’t supposed to happen.  According to Google’s issue tracker, this is a known problem in Android 2.0 and will be fixed in a future release.  So, it may not be happening any longer in Android 2.0.1 and 2.1.  I’ve also seen it in version 1.6.  I’ve added a try/catch block that handles this exception and uses the un-resolved track name from the M3U file if need be.  The key derived from this isn’t guaranteed to be unique in the media database, but it most likely will be and so will retrieve the proper ID3 tag info—including the artwork for the track.

Just Playlists 1.4.1—Show Current Playlist, Choose Any Track to Play

January 31st, 2010

It’s time for another upgrade to the program.  Besides a few more small tweaks and fixes here and there, I’ve added a “Show Playlist” menu item to the main screen options menu (the one that appears when you press the “Menu” button”).  This will show the contents of the current playlist, in the current play order.  That is, if you chose to shuffle the list, it will be shown shuffled, with the currently playing track highlighted in green text.  The tracks are numbered in the order they’ll be played.  You can touch any track to start playing it.  And, if you touch and hold a track, a pop-up context menu will appear, with the ID3 tag information as the menu header.  The track information displayed in the list isn’t from the ID3 tags of the track files.  It’s taken from the playlist filename itself, with the track file’s name sans extension shown first, the directory it is in next, and the next directory level up shown after that.  I use this info instead of the tag info because it loads faster.  It’s also nice to be able to see the file names if you’re like me and name in “artist/album/tracknumber – trackname” fashion.  If you need to see the tag info for a track, just touch and hold for the pop-up info.

You’ll also notice a “Show Database” menu item.  Right now, it doesn’t do anything but display a “Coming Soon” informational message.  For the next release, this item will bring up a display of all the saved information for each playlist you’ve played.  It will also allow you to delete any of the saved entries.  This is particularly handy for cleaning out old entries for which there are no longer playlist files on your microSD card.  The entries don’t take much space in the program’s internal database, so if you never use this feature, it’s not a big deal and won’t affect Just Playlist’s performance.  But this gives you control of a previously-hidden part of the program, which is almost always a good thing.

Just Playlists 1.3.1—Pop-up Menus When Choosing Playlists, Minor Tweaks

January 21st, 2010

I’ve added a couple things to Just Playlists.  I debated holding off on releasing them until I get some more substantial work done on the program, but these are fairly useful additions.

First, I renamed the “Touch” item in the options menu to “Reload”.  Now, rather than just updating the current playlist for later reloading, you can choose to reload the playlist immediately.  For Just Playlists, a “reload” means reading the playlist in from the microSD card as if this is the first time the program has seen it.  You will be given the option to shuffle the playlist, and the saved track position will be deleted.  Also, the idea of touching a file is a Unix-y thing that may confuse a lot of people.

The second addition is context menus in the playlist load screen.  This means you can press and hold on a playlist name and see a pop-up menu.  This menu allows you to choose to either load the playlist to where you left off last time you used it, or you can choose to reload the playlist from scratch, without using the saved position information from the last time you used the playlist.  The load option is identical to simply touching the playlist name, which works the same as previously.

One last change was made due to feedback from a program user (thanks Eric!).  The music file names in your playlist files can now use either forward slashes or back slashes between each element in the filename’s path.  In the past, you could only use forward slashes.  This may be helpful if you export M3U playlists out of Windows Media Player, which uses back slashes.

Just Playlists 1.2.0—Bluetooth Headset Controls

January 16th, 2010

I’ve upgraded Just Playlists—up to version 1.2.0 now.  I did some behind-the-scenes stuff to make it behave better, but the major thing is the addition of the ability to enable control of the player via your Bluetooth headset’s music control buttons.  The technical parlance for this is that you can now take advantage of Bluetooth’s AVRCP (Audio/Video Remote Control Profile).  If you have a Bluetooth headset that allows you to listen to music, it probably also has buttons for play/pause, next track, and previous track.  If you go into the preferences for Just Playlists, you can choose to enable these controls for use with the program.  The default is disabled.

It’s important to understand a little bit more about how Android handles Bluetooth headset buttons.  If you don’t have any other music player on your phone, the default Android music player program will receive headset button pushes, starting up if you push the play button and so on.  Other music playing programs that you download from the Market that can use Bluetooth headset controls should have a preference setting to enable/disable their ability to receive these button pushes.  Thus, if you enable another program to receive them, the default music program should no longer respond when you push a headset music control button.  If you enable more than one program to use the controls, you may have the wrong program respond to a button push.  Thus, I’d recommend only enabling one program at a time to receive these button pushes—and disable all of them if you want the default music player to respond.

If you enable Just Playlists to respond to button pushes, it won’t start playing when you push a button unless it is already running.  I decided I don’t like a music program starting up on its own if I accidently hit one of the control buttons.  Once you’ve explicitly started Just Playlists, it will respond.

Once again, my only Android hardware is a G1, so if you use the Bluetooth control stuff on another type of phone and it doesn’t work as described, let me know.

i2aCleaner—Perl Script to Remove Unused Music from Android microSD Card

January 6th, 2010

One problem with using the itunes2android Perl script to create playlists and populate your Android microSD card for use with the Just Playlists app is that it’s a bit hard to remove music selectively in the future.  For instance, if you have several playlists that you created using itunes2android and then decide you’d like to remove one of the playlists and the music that it references, you’d have to go through the music directory and delete the directories and music files manually.  Even worse, if you delete music that is still referenced in another playlist, that playlist won’t be able to find it.

I wrote the i2aCleaner script to get around this problem.  If you want to remove the music associated with a playlist, just delete the playlist out of your \Music\Playlists directory on your microSD card and then, while it’s mounted under Windows, run i2aCleaner.  This script looks at all your playlist files and removes any music from under the music directory created by itunes2android that isn’t referenced in any playlist.  In my case and in the example I used when describing itunes2android, this is the D:\Music\ipod directory when your microSD card is mounted.  Again referring to the original example and assuming you put the i2aCleaner script in C:\scripts on your computer, the command line to do this would be

perl c:\scripts\i2acleaner.pl d ipod

where “d” is the drive letter of your mounted phone or microSD card and “ipod” is the name of the directory where your music is stored under \Music on the microSD card.

The script will get rid of all unused music and directories.  It won’t affect anything else in your D:\Music directory.

Remember that this script will only work right if you use the itunes2android script to manage your playlists.  And if you have music that you moved over to the microSD card in some other way, it shouldn’t be kept under the \Music\ipod directory, since it will get deleted by i2aCleaner if not referenced by the playlist files.

You can download a ZIP archive with the i2aCleaner script here.

Just Playlists 1.1.2—Improvements and Bug Fixes

January 6th, 2010

I’ve finished work on the second iteration of Just Playlists—version 1.1.2.  Here’s a summary of the improvements and fixes:

  • Added a “Preferences” menu item, which opens a standard Android preferences screen.  Look here for new features that can be enabled and disabled.
  • The current track’s position index in the playlist and the total number of tracks in the playlist can be displayed next to the playlist name on the main screen.  The default is not to show this.
  • Choose to have a playlist stop playing when the last song is reached or loop back and start over at the first track in the playlist.  The previous version repeated.  The default in the new version is to stop.
  • Fixed various crashes and inconsistent program behavior when the screen was rotated during loading of playlists while transitioning between screens.
  • When the program starts, the loading progress message box will appear.
  • If the last playlist to be loaded before the program is closed is changed, you’ll be given to opportunity to shuffle it when the program starts and re-loads this playlist.

I’ll continue adding the other features I mentioned in my previous post about the program, as well as a few other things that I think will be useful.  My first priority will be to fix any other bugs I find and to clean up the code as I find better ways to do things under Android.  The next new features will probably be the ability to look at the music tracks in the current playlist and Bluetooth headset control.

Amazon’s Elastic Compute Cloud for Low-Use Game Hosting

December 31st, 2009

My friend Dan and I enjoy playing first-person shooters, where it’s just the two of us going head-to-head in a game.  It’s something we’ve been doing off and on since the days of serial cables connecting two Commodore Amiga’s in one room.  Dan has since moved across the country from me, but the growth of the Internet and gaming technology has allowed us to keep the gaming going, even if it involves a bit more complexity now.  A few years ago, I was looking for an inexpensive way to host a game server that would have a reasonably low and equivalent latency for both of us.  At the time, the virtual hosting services I looked at were running about $25/mo, which isn’t bad but seemed like overkill, given that we’d only be using the server once a week or so (late-night Friday sessions are the norm for us).

As luck would have it, about this time Amazon introduced their virtual hosting/cloud computing service called the Elastic Compute Cloud (EC2).  It allows users to create an image for a virtual server that can be activated and shut down easily, with service charges at $0.10/hour for a running instance plus a bit for data transmission.  When the instance is not running, the user is only charged for data storage of the image on Amazon’s Simple Storage Service (S3), at $0.15/GB per month (charges listed here may vary in the future or over different configurations).  So with several gigs of storage and running a few hours each week, this is a much better deal than paying for an always-running virtual server.

One annoying thing when EC2 first became available was that you couldn’t make changes to data stored with the instance.  Building and provisioning an instance would take a few hours.  After that, it could be started and stopped within minutes, but any changes would be lost between boots.  If you wanted to upload a new map for your game, you’d have to rebuild the instance.  Within the last year or so, Amazon introduced Elastic Block Storage (EBS).  This allows a user to create a volume within S3 that can be mounted by an instance at boot time.  Any changes on that volume are permanent.  Snapshots of the volume state can also be made, allowing for recovery if the volume data becomes corrupted or you need to return to a previous state of the volume.  Of course, you do have to pay for the data space used by these volumes and snapshots, but the pricing, as I indicated above, is pretty reasonable.  Even when Dan and I have done quite a few hours a month of gaming, I seldom go over $3/mo in total charges.

If you do the math, using EC2 for a game server that is up and running constantly is no bargain.  If this is your need, it’s definitely better to look at a virtual hosting service rather than EC2.  But, if you only need the game server running a few times a month, EC2 is pretty hard to beat.

Half-Life 2 Deathmatch (HL2DM) is the game of choice for me and my friend right now.  It’s been ideal under EC2, since the standalone Steam server runs under Linux and is easily configured and controlled using the command line and scripts.  At some point, I’d like to post more details on my installation.  I have some cool features going—including using a Linux service that communicates the dynamic IP of the EC2 instance to DynDNS.org and associates it with a hostname so that when we fire up Half-Life 2, we don’t have to point the game to a new IP each time and instead just reference a static hostname.

Here are a couple handy URL’s if you’re interested in giving EC2 and a Half-Life 2 game server a try:

Amazon Web Services (AWS) Management Console

http://aws.amazon.com/console/

Source Dedicated Server (srcds)

http://www.srcds.com/