iTunes

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

iTunes Sun Feb 03, 2008 5:04 pm • by bryanb1
Hi,

I tried to build 2 rules that would look for music and import it into iTunes. Bottom line is that I have a Torrent Folder that I download torrents into. I would like Hazel to look at folders that end up here, examine their contents and action on them based on the contents.

The first rule looks for .m3u files and deletes them. (these end up duplicating the import into iTunes).

The second rule looks into any folder, figure out if it has .mp3 files in it, and then import those .mp3 files into iTunes.

Here is what I wrote, but the rule preview shows no files found, the issue with both rules seems to be with CONTENTS CONTAIN qualifier (when I remove that it see m3u and mp3s files in all sorts of folders...I am stumped, as I don't want to import sound effects from games or other items....

Rule1-Delete M3Us:
IF KIND IS FOLDER
CONTENTS CONTAIN M3U
RUN RULES ON FOLDER CONTENTS
MOVE FILE TO TRASH

Rule 2- Import iTunes
IF KIND IS FOLDER
CONTENTS CONTAIN MP3
IMPORT INTO ITUNES PLAYLIST LIBRARY
MOVE FILE TO TRASH
bryanb1
 
Posts: 2
Joined: Sun Feb 03, 2008 4:47 pm

Mon Feb 04, 2008 12:12 pm • by Mr_Noodle
There are a couple problems with your rules. Setting up a rule to descend into folders can be tricky but hopefully this will clarify things.

First off, the "Contents" field only works on files and pertains to its text contents. Interesting that you thought of using it this way though. I'm going to mark this down in the feature database as a possible way to interpret it for folders.

Secondly, since the first rule is matching a folder (not the m3u files), you are throwing away the folder, and not the m3u files themsevles. Unless the folder only contains m3u files, I don't think this is what you intended.

I suggest rules like this (you may need to tweak them for your own situation):

#1) If Kind is Folder and Size is 0, Move to Trash
- This will grab any empty folders and throw them away. The rules below will move the files so this is just a clean up after that.

#2) If Kind is Folder, Run rules on folder contents
- Non-empty folders will have the rules run on them (i.e. Hazel will descend into that folder)

#3) If extension is m3u, Move to Trash
- Throw away m3u files

#4) If extension is mp3, Import into iTunes, Move file to Trash
- Import mp3s into iTunes then throw it away (it is assumed you have iTunes set to copy imported files)

I think that should do what you want. I suggest trying it on a test folder or stopping Hazel while you preview and tweak the rules. Rulesets involving descending into folders tend to surprise people since they don't realize that the it ends up going through more files than they thought.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

ahhhh Mon Feb 04, 2008 9:34 pm • by bryanb1
I see the errors of my ways.

What I was trying to do was build all of these actions into one rule.

What you have shown me is that this works in sequence, one rule at a time, for each monitored folder. So if you want a complex action to occur, you build a folder to watch then add each simple rule, in the order you want it executed.

got it, thanks!

Bryan
bryanb1
 
Posts: 2
Joined: Sun Feb 03, 2008 4:47 pm

Tue Feb 05, 2008 1:08 pm • by Mr_Noodle
Just to clarify, the rules aren't so much executed in order as they are evaluated in order. What Hazel does is for each file, it goes through each rule until one matches. If one does match, Hazel stops going through the rule list and executes that one rule.

As a result, the order of the rules is important. If you look at my example, I set up the rule to remove empty folders before the rule to descend into folders. That's because the criteria for #2 is a superset of that for #1. If #1 came after #2, #1 would never match because #2 would match all the folders first.

Hope this clears things up.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: iTunes Sun Mar 16, 2008 2:52 am • by Illegit
I'm trying to do the same thing and am having some difficulty. I have created the 4 separate rules suggested in descending order. Here are the 4 rules:


Image


The rules show up as being matched, as seen in the picture below:


Image


What am I doing wrong?
Illegit
 
Posts: 4
Joined: Sat Oct 06, 2007 9:39 pm

Re: iTunes Mon Mar 17, 2008 6:01 pm • by Mr_Noodle
Um, you tell me what is wrong. From the looks of the preview, it does what I think is what you want. You want it to go into folders and then import mp3s into iTunes? If it's not working, then you need to look in the logs for any errors.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: iTunes Wed Mar 19, 2008 3:59 am • by Illegit
It's been working for the most part thus far. However, sometimes it totally skips certain folders or only imports a few of the songs. I'm not sure what the problem is. This is an example from the log on when it doesn't import. The error is always the same when it doesn't import.

}
2008-03-19 03:58:57.415 hazelfolderwatch[5570] 10 - From Here We Go Sublime.mp3: Rule Import MP3s matched.
2008-03-19 03:58:57.470 hazelfolderwatch[5570] [Error] iTunes import failed: Could not add file /Users/John/Junk Drawer/Completed/The Field - From Here We Go Sublime [2007]/10 - From Here We Go Sublime.mp3 to iTunes.
2008-03-19 03:58:57.470 hazelfolderwatch[5570] iTunes import error: {
NSAppleScriptErrorBriefMessage = "The variable result is not defined.";
NSAppleScriptErrorMessage = "The variable result is not defined.";
NSAppleScriptErrorNumber = -2753;
NSAppleScriptErrorRange = NSRange: {0, 0};
Illegit
 
Posts: 4
Joined: Sat Oct 06, 2007 9:39 pm

Re: iTunes Thu Mar 20, 2008 5:54 pm • by Mr_Noodle
Wow, that's a new one to me. It's odd that it only happens part of the time. Could you tell me what version of iTunes and OS X you are running? Also, do you see a pattern in the files it fails on?

Thanks.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support