Cores, Plugins, and Rewrites

What a frantic couple of hours.

A user - the same as the previous post(s) - reported another couple of issues involving FileSieve, audio tag data, and Windows path and file names.

The first being that any audio files with a genre with a slash character (which is invalid in a Windows path - when not used a path separator - or filename) wasn't having those slashes replaced with a valid delimiter. This was an easy fix as the slashes were correctly being replaced, but any files that had multiple genres weren't having a delimiter appended after each genre (with the last dangling delimiter being stripped off the end), so you'd end up with a genre of FolkPop as opposed to Folk, Pop.

The second issue involves the way Windows treats directory - and probably file - names that end in a full-stop or a full-stop and a space. To put it bluntly: it doesn't bloody well like it.

FileSieve creates a directory based on a file's audio tag data, such as (minus quotes) D.I.S.C.O. but Windows internally, somewhere, "corrects" that to D.I.S.C.O thus stripping off the trailing full-stop. If there was a space after the full-stop, then it removes that, too.

Of course FileSieve doesn't see this ninja-change that happened internally within Windows and then chucks an error into the log saying that it couldn't find the file. That's because Windows stuck its D in our A.

Then I ran into an issue while beginning to debug the above path issue. Of course I did.

The (audio) Tag and (photo) EXIF plugins. They allow a mask to be set, such as %ALBUM_TITLE%\%TRACK%. %TITLE%.%FILE_EXTENSION%. When an (audio) file is processed, it would be placed into a directory and named as follows:

My Album\01. My Song.mp3

Except it doesn't. The file isn't actually renamed at all; the directory structure is created, but the filename is kept the same as the original.

This, as initial impressions appear, may be due to a core change made within FileSieve's processing. Plugins set a processed item's Path property independently of its Filename property. This means that plugins don't need a pile of additional logic to determine and set an item's path and filename. FileSieve's core will do that.

Unfortunately, it appears the Tag and EXIF plugins weren't updated to make use of this change and so treat both the path and file names as one property. Tomorrow, this changes.