holman/play — pull request #54 by medwards (2011-12-05 22:13:34+00:00)
Title: Revert "Revert "Don't import things that AudioInfo can't parse and provi...

...de pruning function for databases that have gotten messed up (or music libraries which have deleted files)" and remove information output of what things weren't imported.

This reverts commit abbed94c20edb236c1d9d539f7ee1815d972f4db but also removes information output of what things weren't imported (from the original commit that was reverted).
------------------------------
So, not mentioned in too much detail in the original branch -
fs_getmetadata will raise an AudioInfoError if the file isn't of a parseable type (note that this list isn't extensive, I'm fairly sure my Homeworld 2 ripped AIFs aren't included). If this is caught and ignored in the fs_getmetadata call then import_song will still create an entry for it because it can work with nil values. So we rescue in import_song and because fs_getmetadata is a necessary call before the ActiveRecords are created we can assume that invalid files won't be imported as 'songs.'

Additionally the logic has been tweaked to find/create Artists/Albums separately from song record creation and to update a song if it already exists in the database. This should cause less pain to people who are in the process of cleaning up their library metadata.

Finally prune_songs isn't called from anywhere, but I've used it periodically in irb and its handy if I screw up my library or we decide to pull music from the library.