The song was loading, but attributes weren't updating. I also use this
patch to begin playback when a song is loaded (I was tired of manually
pressing play every time)
I use the same Track() class that the library does. I have to create
an instance of this class each time the function is called, but this is
ok since it is not the case I am trying to optimize for.
The cleaned up version chooses what function to call based on file
extention. I use map.get() to pick a function, and use the open_music()
function as the default.
By using pickle correctly, I can now load in files significantly faster
than the old way. Library loading times have gone from about 3 seconds
to 0.25 seconds. I like this.
I can now import files from an Ocarina 4.1 library exported as xml.
Ocarina 4.2 keeps track of a list of sources, but 4.1 does not. For
importing to work properly, the library needs to be rescanned before
running the import. The import will set the playcount and score
attributes for each file.