For work with Amarok 2.3.1, MySQL 5.1.51, and Python 2.6.5. For each file in the directory, check if it is a audio file (mp3, flac, ogg, m4a). Find the id of the file's URL by looking in the URLS table. Next, look in the statistics table.  If there is an entry, increase the playcount. If there is not an entry, set the playcount to the given number and create some auxillary table entries for score and rating.
Adding logic for importing/merging data from a sample iTunes library from a iTunes library
version: 0.0.3 - Minor style changes to some database logic
version 0.0.4: added mp4 as an allowable file extension