Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: iTunes Encode - New version (Read 75985 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

iTunes Encode - New version

Reply #25
I figured out another way to do it  In EAC use the file naming scheme "%D\%C\%N %T" and point EAC to the same directory that iTunes is using such as "C:\iTunes Music\" In iTunes turn on "Keep iTunes Music folder organized" Then use the suggested EAC command line option but just leave out the -d. I am not sure why this works  but this will result in EAC deleting the original WAV file and only one file from iTunes on the drive. Check it out and let me know what you think. BTW I'm doing all of this in Virtual PC on a Mac and it works great, albeit a little slow, but worth it 

iTunes Encode - New version

Reply #26
Quote
I am not sure why this works
[a href="index.php?act=findpost&pid=279537"][{POST_SNAPBACK}][/a]

It works because you're telling iTunesEncode to not move the file to any destination and EAC is finding the file in the location it expects to move/rename it to eventually (EAC specifies this using the %o parameter, I think). So EAC looks for a file in the %d location, and failing that, it looks in the %o location. Since your naming scheme is the same as what iTunes is using by default, EAC is satisfied and deletes the WAV file.

This will work as long as you don't feed iTunesEncode a disc number parameter (which is not in those recommended settings anyway).

iTunes Encode - New version

Reply #27
Hey

I was wondering if it was possible to transfer the track rating (0-5) to iTunes on encoding. I can't see it in iTunesEncode's command-line options.. If it's possible, could you please update your tool to allow for that?

Thanks

iTunes Encode - New version

Reply #28
Is iTunes 4.7.1 not fully compatible with iTunesEncode? I can transcode to AAC just fine but when I try to do lossless (ALAC) I get an error message in foobar that encoding failed. This didn't used to happen to me and all I did was upgrade my version of iTunes.

Update: Never mind, I'm a dork and forgot that I changed the location of iTunesEncode.exe. It works fine with 4.7.1!!

iTunes Encode - New version

Reply #29
Quote
New version is available here:
http://otto.homedns.org:8888/iTunes/iTunesEncode46.zip

Basically the only change is to fix some problems encountered when the encode is happening. See, the iTunes interface comes up and if you click around in it a bit while the encode is going on, it could send a false signal to iTunesEncode that the encode was finished. iTunes 4.6 added some functionality to the COM interface that would allow me to avoid this. What with one thing and another, I never got around to noticing until iTunes 4.7 came out.

Hi Otto, I've integrated your iTunesEncode in my MediaCoder. What I would like to do now is to do a source level integration. Could you provide me with the source code of iTunesEncode?

iTunes Encode - New version

Reply #30
The source code was lost in a hard drive incident many moons ago. This is why I've not updated it with new features, because I don't feel like rewriting the thing. Anyway, it includes support for most everything that can be included.

It was not particularly complex code though, anybody could duplicate it with only a small amount of effort. Take a look through the "iTunes COM SDK" (google for it) and all the info you need is right there.

The vast majority of the source code was doing the command line parsing. The iTunes code only comprised maybe 20% of the thing.

However, I can tell you what you need to do to duplicate it. First, convert the file to WAV or some other filetype iTunes can read. And yes, it needs to be a file, not a datastream. Next, set the iTunes encoder in the iTunes COM object. This means reading the encoder list, choosing one, and setting it. Then you call the ConvertFile2 function in the iTunes COM object to convert the file. The ConvertFile2 function gives you an object that you can poll occassionally for progress information. When it's done, you can get link to a the converted Track object. Then you can tag that track object by simply setting each of the Track's fields. Finally, you get the Track's location and then do a normal file copy to wherever you want the track to be. If you want to remove the track from iTunes, you can delete the track from the Main Library object. This doesn't delete the file itself for some reason, so you'll need to do that manually.

Pretty straightforward, really. The only caveat is that you may want to watch if iTunes disables the COM interface while it's converting. This means the user did something like opening a modal dialog in iTunes or something, and this might break your conversion status object temporarily. If you want to be tricky, find the iTunes window and hide it entirely, so they can't do that.

iTunes Encode - New version

Reply #31
Quote
ezra: iTunes.exe or iTunesEncode.exe?

And I mean error checking, not error correction. iTunes can stop for all sorts of reasons, so iTunesEncode is checking error responses from the calls to iTunes and will spit out more useful error messages now. Also it'll return an error code and if EAC checks that error code, it'll not delete the temporary WAV, because iTunesEncode won't have been able to finish encoding it.

To set it up in EAC, go to the Compression Options:
-Use External Program for Compression is on
-User Defined Encoder
-Extension is .M4A
-Program is c:\full\path\to\iTunesEncode.exe
-Additional command line options are similar to this:
Code: [Select]
-e "AAC Encoder" -a "%a" -l "%g" -t "%t" -g "%m" -y %y -n %n -i %s -o %d -d

-Delete WAV after Compression is ON
-Add ID3 tag is OFF
-Check for external programs return code is ON

Current News:
-Yes, the percentage indicator doesn't work. Not sure why yet. (Edit: this is now fixed, redownload it)
-I'm also working on adding Artwork capabilities at the moment.
(Edit2: Artwork is now an option as well. Add -r "c:\full\path\to\artwork.jpg" to the command line to add artwork to the file. JPG or PNG are allowed by iTunes.)
[a href="index.php?act=findpost&pid=257899"][{POST_SNAPBACK}][/a]


How would i set up my command line in foobar to add artwork?  My jpeg's are called folder.jpg in each albums folder of ape files.

iTunes Encode - New version

Reply #32
+1 on Marino13's request.  I have a .jpg in each folder that's named what the full album name is (single flac + cue setup).  It's also the same name as the folder it resides in (Artist ~ Date ~ Album).

iTunes Encode - New version

Reply #33
Quote
Take a look through the "iTunes COM SDK" (google for it) and all the info you need is right there. [snip]

When it's done, you can get link to a the converted Track object. Then you can tag that track object by simply setting each of the Track's fields.
[a href="index.php?act=findpost&pid=339557"][{POST_SNAPBACK}][/a]
Looking at the SDK, I can see how to set every tag field other than the title of the track.  Album, artist, genre, date are all easy.  How do you set title?

iTunes Encode - New version

Reply #34
Quote
Quote
Take a look through the "iTunes COM SDK" (google for it) and all the info you need is right there. [snip]

When it's done, you can get link to a the converted Track object. Then you can tag that track object by simply setting each of the Track's fields.
[a href="index.php?act=findpost&pid=339557"][{POST_SNAPBACK}][/a]
Looking at the SDK, I can see how to set every tag field other than the title of the track.  Album, artist, genre, date are all easy.  How do you set title?
[a href="index.php?act=findpost&pid=360072"][{POST_SNAPBACK}][/a]

The title property is called Name in the SDK.

iTunes Encode - New version

Reply #35
Quote
The title property is called Name in the SDK.
[a href="index.php?act=findpost&pid=360085"][{POST_SNAPBACK}][/a]
Aha!  I was looking under IITrack (which has every other tag property), while Name is listed under IITObject

thanks

iTunes Encode - New version

Reply #36
Hi, I had to register just to say what an excellent program you've made. I struggled to find the itunesEncode46.zip file because all the links were down. So if anyone finds this post and can't download it, get it here

This is exactly what I've been looking for, thank you so much Otto. I've just tested a few tracks and it works wonderfully.

Great readme as well