ID3 Comment

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

Moderator: Mr_Noodle

ID3 Comment Tue Jul 28, 2015 10:05 am • by robodean
I can't seem to figure out how to get Hazel to act on a file's ID3 Comment metadata.
The comment does not appear in spotlight, but does appear in iTunes.

I am trying to build a workflow for sorting files after they have been compressed with iFFmpeg.
I can add a ID3 metadata comment to a file after it has been compressed and then I want Hazel to sort based on the that comment. (iFFmpeg cannot set spotlight comments, only ID3 metadata)

So the question is, can Hazel read a media file's ID3 comment metadata?
robodean
 
Posts: 20
Joined: Tue Aug 14, 2007 12:20 pm

Re: ID3 Comment Tue Jul 28, 2015 3:07 pm • by Mr_Noodle
Hazel uses Spotlight so you need to either (a) fix Spotlight so that this info appears there correctly or (b) use a script which will parse that info directly. What kind of files are these?
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Tue Jul 28, 2015 3:26 pm • by robodean
Video files.
I use iFFmpeg to batch convert/compress them. It (iFFmpeg) can add metadata, but only ID3 tags for iTunes.
I want to sort the videos *after* they are compressed by using the comment tag as a filter.

Not sure exactly what you mean by fixing Spotlight. Don't think spotlight indexes ID3 iTunes metadata.
So i don't think it's broken.

And yes, no doubt some kind of script could be written. But I don't have those skills sadly, and had hoped that Hazel could read the metadata of a video meant for iTunes.
robodean
 
Posts: 20
Joined: Tue Aug 14, 2007 12:20 pm

Re: ID3 Comment Wed Jul 29, 2015 1:34 pm • by Mr_Noodle
id3 data is indexed by Spotlight. If you do "Get Info" on the file in Finder, you should see it all under "More Info". The fields in Spotlight might be mapped oddly (like Authors instead of Artist), but the info should be there an accessible.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Wed Jul 29, 2015 1:45 pm • by robodean
hmm. then something odd is afoot.
when i inspect the video under Finder, there is no such tag.
when i inspect the video in Subler, an app for adding metadata to videos before sending them to iTunes, the tag is there. So...this spotlight fixing you spoke of - would that involve turning privacy on and off for the drive in question to force spotlight to re-index or is there some deep, more profound black magic i could employ? Note, I am not above sacrificing small animals or one of my children. I have two.
robodean
 
Posts: 20
Joined: Tue Aug 14, 2007 12:20 pm

Re: ID3 Comment Wed Jul 29, 2015 2:40 pm • by Mr_Noodle
Toggling the privacy setting is one way (and probably the easiest) to do it. If you want to be more fine-grained about it, you can try using the mdimport commandline program for indexing specific folders but that requires a bit more to figure out (so yes, one of your children might be needed for that).
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Thu Jul 30, 2015 8:35 am • by robodean
So...this is interesting.
I have since searched the interwebs and according to everything i have read, spotlight does NOT index ID3 tags.
But you say it is. Is there some reference somewhere that can confirm one way or another?
I have used mdls to inspect numerous music and video files, which have ID3 metadata embedded in them, and lo and behold, this data is NOT being indexed by spotlight. I run mdls on a video from iTunes bursting with ID3 tag info, all of which is visible in iTunes, and it shows none of that data.

So...unless I am missing something, Hazel can never act on ID3 tags as they are not indexed by Spotlight.
This is not Hazel's fault. I'm just wondering what the next step is, if there is indeed, one to take.
robodean
 
Posts: 20
Joined: Tue Aug 14, 2007 12:20 pm

Re: ID3 Comment Thu Jul 30, 2015 2:45 pm • by Mr_Noodle
Can you post links where you are reading this? Also, what specific types of files are you using? I'm going through mp3 and m4a files I have here, and mdls dumps info for them all. Did you remove iTunes from your system or something along those lines?
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Sun Aug 30, 2015 2:12 pm • by sirkako
Hi. Has anyone figured out how to use the ID3 tag info?

I'm trying to get the "song name" tag to rename the file. Easy rule set, just can't get the ID3 tag data.

TIA
sirkako
 
Posts: 4
Joined: Sun Aug 30, 2015 2:10 pm

Re: ID3 Comment Sun Aug 30, 2015 2:19 pm • by robodean
I gave up trying to find a solution unfortunately.
robodean
 
Posts: 20
Joined: Tue Aug 14, 2007 12:20 pm

Re: ID3 Comment Mon Aug 31, 2015 11:41 am • by Mr_Noodle
That info is indexed. If not, then you need to look into an issue with Spotlight on your system. Again, I've seen no sources to indicate otherwise so please point those out if you have any as I'd be very interested to see what they say about the situation.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Mon Aug 31, 2015 10:35 pm • by sirkako
Hmm...

Here's what I'm trying to do:

1- I record a Voice Memo on my iPhone, label it "Test 4"
2- I sync my iPhone with iTunes and the file shows "Test 4" as the "song name" (ID3 tag).
3- iTunes places the file in ~home/Music/iTunes/iTunesMedia/VoiceMemos/originalfilename.m4a
ENTER HAZEL
4-Copy the file to "location b"
5- Rename the file to "Test 4.m4a"

----------------------------------------

This is what I get from iTunes "Get Info" window...
You can clearly see "Test 4" corresponds to the "song name" label

Image


This is from the Finder "Get Info" window...
No "Test 4" metadata whatsoever

Image


This is from Hazel "Preview Rule" window...
Nope...

Image

---------------------------------

How can I find out if the info is really indexed by Spotlight?

What would be the proper rule setup be to do this?

Thank you in advance.

Rick.
sirkako
 
Posts: 4
Joined: Sun Aug 30, 2015 2:10 pm

Re: ID3 Comment Tue Sep 01, 2015 5:28 pm • by Mr_Noodle
It's not in this case but that doesn't mean it can't be. Do you have any folders in your Spotlight privacy settings? If so, make sure they don't include the folder in question. You may want to try rebuilding your Spotlight index (google around for it) to make it re-index everything.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: ID3 Comment Wed Sep 30, 2015 11:50 pm • by gwagener
I have the same use case as sirkako. I tested with a music file and the tag info showed up in mdls. I tested with a voice memo and the relevant info, Title, Authors, Album, Musical Genre, was missing. I ran mdimport on my Voice Memos folder, but no change.

I think the info for voice memos may not actually be stored as tags on the files. Someone with an app to view MP4 tags on a file could verify this. However, it does exist in iTunes Music Library.xml. So I wrote a little script using JXA, the ObjC bridge, and XPath to parse it out of there.

Code: Select all
var libraryPath = theFile.toString().match(/(.*\/iTunes\/)/)[1] + 'iTunes Music Library.xml';
var libraryURL = $.NSURL.fileURLWithPath(libraryPath);
var library = $.NSXMLDocument.alloc.initWithContentsOfURLOptionsError(libraryURL, 0, null);

var fileURI = encodeURI('file://' + theFile);
var path = "dict/dict/dict/string[contains(text(),'" + fileURI + "')]/../key/text()[.='Name']/following::string"

var name = ObjC.unwrap(library.rootElement.nodesForXPathError(path, null).firstObject.stringValue);

return {'hazelOutputAttributes': [name]};

I don't really know JXA or the ObjC bridge so any suggestions for improvements are most welcome!
gwagener
 
Posts: 5
Joined: Wed Jun 03, 2015 12:02 am


Return to Support