Mr_Noodle wrote:I believe iTunes should delete the original. I know when I delete files in iTunes, it brings up an alert with the option to throw it in the trash.
This is because you have iTunes set to manage your files (e.g. you have the option "Keep iTunes Media folder organized" and "Copy files to iTunes Media folder when adding to library" are both checked.)
If a user does NOT use iTunes to manage the library, iTunes will not offer to delete the file. Many users must choose this option when their audio library grows large, and it becomes necessary to store media on an external storage device. In this case, deleting a song in iTunes deletes the library entry in that instance of iTunes, and also deletes it on all devices to which that library syncs, but
does not offer to delete the file.
Thus, having the ability to delete an iTunes entry on deletion of a file in a watched folder is highly valuable to those users.
In fact, I can make a case that "in general", providing a mechanism for a rule to fire on file deletion is a valuable function. Consider these use cases:
- A user may wish to know if a valid, or malicious application attempts to remove a file from a critically-watched folder, and thus set up a notification when a file is deleted from that folder.
- Tracking deletion date. A user may wish to add a comment containing a date/time stamp to a file that is moved to the trash; this may be a useful item of info if a user wishes to restore a deleted file in the case there are several files with the same name.
- (The captioned use case for iTunes)
- (Similar use case for iPhoto)
I acknowledge this complicates the UI a bit, since the entire rule panel makes a presumption about when a rule will be evaluated.
I suggest a phased approach: Handle the iTunes (and maybe iPhoto) use case first, then consider if a larger capability is required.
An iTunes/iPhoto-only feature could be provided by an easter-egg type hack:
- IF the user sets "Kind" is "Music" in the conditions area;
- THEN
1) Add an entry to the file attribute selector in the conditions section (e.g. the one that has "Passes AppleScript"), adding an entry "Removed from folder", with secondary attributes of (only) "Is" and "True"
-- This allows the user to set a second condition "Removed from Folder"; this provides a 2-rule match that will fire when "Kind is Music" and "Removed from folder is true". There is an error condition that must be checked: This rule only makes sense when "All" of the conditions are met. I'll leave it to you to figure out how to handle that.
-- Yes, I realize this makes the attribute selector contents different depending on context; like I said, this is an Easter Egg ;-D)
2) Add an action "Remove from iTunes" (from playlist ("Library", ....)).
Yes, it's a hack; but it's a useful hack, hopefully won't break anything, and is reasonably aligned with the overall UI metaphors.