View Single Post
Old 9th March 2006, 21:54   #351
gerd.gabriel
Junior Member
 
Join Date: Feb 2005
Posts: 5
Informations disappear after updating Media Library with "MediaLibrary.Insert"

Hi scripters,

I'm using a slightly modified version of the script to call Mp3Tag.

All functions well but informations YEAR and BITRATE disappear and PLAYCOUNT is set to the maximum possible unsigned integer value 4294967295 :-) :-(

Gerd

Script follows:

On Error Resume Next

Const ForReading = 1, ForWriting = 2

Dim fso, WshShell, TmpPlaylist, SendTo_Items
Dim TmpPlaylistPath, Mp3TagPath


Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")

'===== Get path where Mp3Tag is installed

Mp3TagPath = RegistryRead( _
"HKCU\Software\Moebius\Install\Mp3tag", "InstDir") & _
"\Mp3tag.exe"

'===== Get filename of temporary playlist

TmpPlaylistPath = GetEnvString("%TEMP%") & _
"\temp_mp3tag_playlist.m3u"

'===== Create tmp. playlist

Set TmpPlaylist = fso.OpenTextFile(TmpPlaylistPath, _
ForWriting, True)

'===== Get selected "Send To" items (either from
'===== MediaLibrary or from playlist)

SendTo_Items = GetSendToItems

'===== Write selection to tmp. playlist

TmpPlaylist.WriteLine ("#EXTM3U")

For Each track In SendTo_Items
TmpPlaylist.WriteLine (track.Filename)
Next

TmpPlaylist.Close

'===== Run Mp3tag and wait until it is finished

WshShell.Run """" & Mp3TagPath & """ ""/m3u:" & _
TmpPlaylistPath & """", 1, True

'===== Update entries in Media Library --> Errors in ML

For Each track In SendTo_Items
set theItem = LoadItem(track.filename)
MediaLibrary.Delete(theItem)
MediaLibrary.Insert(theItem)
next

'=== Have also tried MediaLibrary.RefreshMeta here.
'=== No difference.

Quit
gerd.gabriel is offline   Reply With Quote