1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Another iTunes Gotcha...

Discussion in 'iTunes & AppleScripts' started by UKenGB, Jan 10, 2017.

  1. UKenGB

    UKenGB Member

    Having found that anything placed in the Category tag, outside iTunes, was then seen perfectly by iTunes once that file was added. Or indeed if it was already in iTunes and simply 'Refreshed'. I then discover that although iTunes can display the Category tag in lists, it does not expose that tag in the Get info window. Grrr. But then even Grouping has vanished from any video file. Anyway...

    The good news is that I can address the Category tag in AppleScript, so I base a large part of my plan on being able to do this and write the appropriate script. This works worryingly fast, but viewing the list of files in iTunes shows all the categories I wanted are set correctly. It is only some hours later when I realise that although iTunes reads a file's Category tag, it does NOT write them. So setting the Category tag in iTunes (using AppleScript) does not write to the files and so it's obviously just stored in the database. This is dumb even for iTunes. It is obviously the same tag as once set elsewhere, that is what iTunes reads, in that exact same tag, but it refuses to write anything to the file itself and just stores it internally.

    This is not a write permissions problems. Any other tag I change in iTunes gets written to the file. Just not the Category tag. Aaaaarrrrggghhhhhh!!!!

    So, my first question is whether there is any AppleScript method to force iTunes to write to the file?

    Otherwise, can anyone suggest a command line tool that will allow me to set specific tag data? Then I could call this from within my AppleScript which could set the Category in iTunes and then write that same data to the file's embedded tag. I'm sure there must be something, but if anyone can help short circuit the search process, I'd be grateful.
     
  2. kirk

    kirk Administrator Staff Member

  3. UKenGB

    UKenGB Member

    Have been looking into this today and discovered:-

    The category tag is apparently 'read only' in iTunes. But this is odd when it's just a regular tag in the file and iTunes allows you to set it with AppleScript. Doesn't make any sense.

    Most programs I found that can edit the metadata tags of video files (e.g. Atomic Parsley, FFmpeg and some others) write a completely new file and then either you have to copy and rename it into place, or Atomic Parsley has an option to automatically do the renaming. However that is all much slower when it's a large media file, than just making a small edit to the existing file. Re-writing an entire multi gigabyte file just to add 4 characters of text can hardly be called efficient. In any case Atomic Parsley trashed the 2nd file I tried. The new file it created no longer worked as a video file. I tried it again, same result. Doesn't inspire confidence.

    I had high hopes for SublerCLI as the GUI app is great and I use it a lot. The CLI version I will continue to use for quick tag viewing, but I couldn't get it to do anything other than totally remove ALL tags when trying to add just one and it also wants to create a new file which I really don't want. Not only does the inefficiency appall me, but also because I may need to use hard links to these files and by creating a new file in this way, the link is lost. Not only that but data storage will then of course double for every file to which this occurs. Nope, no good at all.

    After much searching, I came across mp4Creator and this has a very neat command line utility called mp4tags which perfectly writes tags by just editing the file, so quick and accurate and er, doesn't support the [category] tag I need :-(

    But then I discovered that 'no longer supported' mp4Creator had morphed into a more modern mp4v2 and its later mp4tags can handle a lot more tags and includes [category]. :)

    Testing has so far been 100% and I can call it from the same AppleScript that now writes the tag to the file and then sets the same in iTunes. I'm hopeful, but just backing everything up first before running it for real on the files I don't want to lose.
     

Share This Page