From: tonysathre on 21 Oct 2009 19:21 I've been looking for a way to embed the iTunes downloaded album art into the actual MP3 files so when I'm streaming my music from home computer to my iPhone using Simplify Media, it shows the artwork. I have found a script that can automate this, but apparently it only works on iTunes 7. The COM interface, or ActiveX controls must be different. Could anyone port this script to work with iTunes 9? The script is below. ' ############################################################################### ' # ' # itunes_insert_artwork.vbs ' # ' # This script will tag your files using artwork downloaded using iTunes 7 ' # ' # written by: Robert Jacobson (http://mysite.verizon.net/teridon/ itunesscripts) ' # Last Updated: 03 Jan 2007 ' # Version 1.0 ' # ' # This script is GPL v2. see http://www.gnu.org/copyleft/gpl.html ' # ' # Use option "-k" to keep the artwork files extracted ' # (in the same location as the song file) ' # (the default is to remove the files) ' ############################################################################### Option Explicit Dim iTunesApp ' iTunes.Application object used to access the iTunes application. Dim tracks ' The tracks collection object of the Library object. Dim TrackPath ' The path to the track Dim ArtPath ' The path to the artwork Dim i ' A counter variable. Dim Msg ' A string for a message. Dim f ' A file object. Dim sources Dim source Dim playlists Dim playlist Dim playlistName Dim j Dim m Dim c Dim songName Dim artist Dim result Dim listarray Dim num Dim k Dim track Dim numtracks Dim FormatArray(4) Dim ExtArray(4) Dim Artobj Dim Art Dim ArtDir Dim Format Dim BasePath Dim fso Dim NumFiles Dim KeepFiles Dim args Dim arg Set fso = CreateObject("Scripting.FileSystemObject") FormatArray(0) = "Unknown" FormatArray(1) = "JPEG" FormatArray(2) = "PNG" FormatArray(3) = "BMP" ExtArray(0) = "unk" ExtArray(1) = "jpg" ExtArray(2) = "png" ExtArray(3) = "bmp" Set iTunesApp = CreateObject("iTunes.Application.1") Set sources = iTunesApp.Sources Dim vers vers = iTunesApp.Version Dim Reg1 Set Reg1 = new RegExp Reg1.Pattern = "^7" if Reg1.Test(vers) Then ' yay Else Wscript.Echo "This script requires iTunes 7" Wscript.Quit End If KeepFiles = False Set args = WScript.Arguments ' Scan command line arguments For Each arg in args ' Is it a flag. If Instr(1, arg, "-", 1) = 1 or Instr(1, arg, "/", 1) = 1 Then ' Check for list flag If UCase(arg) = "-K" or UCase(arg) = "/K" then KeepFiles = True End If End If Next For i = 1 to sources.Count Set source = sources.Item(i) IF source.Kind = 1 Then Set playlists = source.Playlists Wscript.Echo "Select from the following playlists" & chr(13) & chr (10) For j = 1 to playlists.Count Set playlist = playlists.Item(j) playlistName = playlist.Name Wscript.Echo j & ": " & playlistName Next Wscript.Echo "" Wscript.StdOut.Write "Enter comma-separated lists to process: " result = Wscript.StdIn.ReadLine listarray = split(result, ",") For k = 0 to UBound(listarray) num = listarray(k) Set playlist = playlists.Item(num) playlistName = playlist.Name Wscript.Echo "" Wscript.Echo chr(9) & "Processing playlist " & num & ": " & playlistName Set tracks = playlist.Tracks numtracks = tracks.Count Wscript.Echo chr(9) & "tracks: " & numtracks NumFiles = 0 For m = 1 to numtracks If m > tracks.Count Then Exit For Set track = tracks.Item(m) 'Wscript.Echo "num: " & numtracks & " Count: " & tracks.Count & " m: " & m If track.Kind = 1 Then songName = track.Name artist = track.Artist TrackPath = track.Location Set Artobj = track.Artwork For c = 1 to Artobj.Count Set Art = Artobj.Item(c) if Art.IsDownloadedArtwork Then Format = Art.Format 'Wscript.Echo "Format is " & FormatArray(Format) ArtDir = fso.GetParentFolderName(TrackPath) 'Wscript.Echo "Artdir is " & ArtDir 'ArtDir = fso.GetBaseName(ArtDir) Dim RegX Set RegX = new RegExp RegX.Pattern = "[/:\\\*\?""""<>]" RegX.Global = True songName = RegX.Replace(songName, "-") 'songName = Replace(songName, "/", "-") ArtPath = fso.BuildPath(ArtDir, songName & "." & ExtArray (Format)) Wscript.Echo "artpath is " & ArtPath ' save to file Art.SaveArtworkToFile(ArtPath) ' insert from file into track tag Art.SetArtworkFromFile(ArtPath) if (KeepFiles) Then ' nothing Else fso.DeleteFile(ArtPath) End If NumFiles = NumFiles + 1 End If Next End If Next Wscript.Echo NumFiles & " files processed in playlist " & playlistName Next 'End If End If Next Thanks a lot, Tony
From: Alexander Mueller on 24 Oct 2009 08:20 tonysathre schrieb: > I've been looking for a way to embed the iTunes downloaded album art > into the actual MP3 files so when I'm streaming my music from home > computer to my iPhone using Simplify Media, it shows the artwork. I > have found a script that can automate this, but apparently it only > works on iTunes 7. The COM interface, or ActiveX controls must be > different. Could anyone port this script to work with iTunes 9? The > script is below. The COM-interface probably didn't change, simply because that's forbidden to COM-interfaces. That doesn't mean that some SW-designers don't care about, but it happens fairly rarely. Sometimes implementation changes, sometimes it gets corrupted with a new release - but most likely the problem is a different one, that has to do with data processed or the logic of the script itself or the communication between the devices or ... In order for helping you fixing it you should provide details of the lines of code that don't "work" any more or the conditions that are no longer met or simply the observations you make. Posting 200 lines of code and hope someone will tell you its line 179, Column 24 will work if the problem is simply syntactical, but not if it is functional. So plz, provide some details of what exactly doesn't work MfG, Alex
From: Tom Lavedas on 24 Oct 2009 08:44 On Oct 24, 8:20 am, Alexander Mueller <mille...(a)hotmail.com> wrote: > tonysathre schrieb: > > > I've been looking for a way to embed the iTunes downloaded album art > > into the actual MP3 files so when I'm streaming my music from home > > computer to my iPhone using Simplify Media, it shows the artwork. I > > have found a script that can automate this, but apparently it only > > works on iTunes 7. The COM interface, or ActiveX controls must be > > different. Could anyone port this script to work with iTunes 9? The > > script is below. > > The COM-interface probably didn't change, simply because > that's forbidden to COM-interfaces. That doesn't mean that > some SW-designers don't care about, but it happens fairly rarely. > Sometimes implementation changes, sometimes it gets corrupted > with a new release - but most likely the problem is a different > one, that has to do with data processed or the logic of the script > itself or the communication between the devices or ... > > In order for helping you fixing it you should provide details > of the lines of code that don't "work" any more or the > conditions that are no longer met or simply the observations > you make. > Posting 200 lines of code and hope someone will tell you its > line 179, Column 24 will work if the problem is simply > syntactical, but not if it is functional. > > So plz, provide some details of what exactly doesn't work > > MfG, > Alex You make very good points. I would add that in many cases, it is backward compatibility that is the problem and that later version are likely to work, though not guaranteed. I was wondering in this case if the problem is that the script hard codes a test for version 7 and not 'greater than 6'. However, since I don't use iTunes (horrors), I have no way to check if changing the test to allow execution for later versions would help. _____________________ Tom Lavedas
From: Steve on 25 Oct 2009 05:05 tonysathre wrote: > I've been looking for a way to embed the iTunes downloaded album art > into the actual MP3 files so when I'm streaming my music from home > computer to my iPhone using Simplify Media, it shows the artwork. I > have found a script that can automate this, but apparently it only > works on iTunes 7. The COM interface, or ActiveX controls must be > different. Could anyone port this script to work with iTunes 9? The > script is below. The script *should* work with iTunes 7 *and later* but the version test is too simple-minded: > Dim vers > vers = iTunesApp.Version > Dim Reg1 > Set Reg1 = new RegExp > Reg1.Pattern = "^7" > if Reg1.Test(vers) Then > ' yay > Else > Wscript.Echo "This script requires iTunes 7" > Wscript.Quit > End If The test only accepts version strings that start with "7"; it assumes that other versions must be earlier. (BTW, similar simple-mindedness is the same reason that Opera 10.00 identifies itself as "Opera/9.80" in its browser identification string--scripts that just tested the first digit of the version would decide that the current version is actually version 1.) This test worked fine when iTunes V7.0 was bright and shiny. If the script is for your personal use only, you can just remove the test (and cross your fingers whenever you update iTunes). If you intend to share the script, you can make the version test smarter. You can download the iTunes COM SDK from http://developer.apple.com/sdk/itunescomsdk.html (you might have to join the Apple Developers Club first). -- Steve Horse sense is the thing a horse has which keeps it from betting on people. -W. C. Fields
From: tonysathre on 27 Oct 2009 18:12 Thanks a lot for the suggestions. I have already tried removing the following, with no luck: > Dim vers > vers = iTunesApp.Version > Dim Reg1 > Set Reg1 = new RegExp > Reg1.Pattern = "^7" > if Reg1.Test(vers) Then > ' yay > Else > Wscript.Echo "This script requires iTunes 7" > Wscript.Quit > End If I have also tried changing this part: Reg1.Pattern = "^7" to 9, but it didn't work either. Below is the error I get when running it with, or without those changes. (67, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'iTunes.Application.1' Thanks, Tony
|
Next
|
Last
Pages: 1 2 Prev: 800A01AD error when creating Schedule.Service object Next: 08 KewaSa.com DDL Torrents |