PDA

View Full Version : tip for Extracting Track info from WMP



Haddood
February 17th, 2004, 12:45 PM
to do this i am getting the track info from DVDSpy plugin, My music is automaaticaly orginized by WMP in the following file structure ...
"C:\Documents and Settings\All Users\Documents\My Music\Artist name\Album name\trackname (which is xx name, where xx is track number)

then the follwoing script to extract the info from it:

Track = pld1 #this to get the info from DVDSpy WMP.URL event
Title=gsub (Track, "C:\92Documents and Settings\92All Users\92Documents\92My Music\92", "") # removing prefixed path
Title=strsub (Title, 1, -5) # removing extension
x1=strfind (Title, "\92" ) -1
Artist = strsub (Title, 1, x1)
Title=gsub (Title, Artist .."\92", "")
x1=strfind (Title, "\92" ) -1
Album = strsub (Title, 1, x1)
Title=gsub (Title, Album .."\92", "")
x1=strfind (Title, " " ) -1
TrackN = strsub (Title, 1, x1)
Title=gsub (Title, TrackN .." ", "")

8)

miked
February 17th, 2004, 09:16 PM
(bump) Ron or Mike C -- perhaps move this post to the Tricks & Tips forum?

Haddood
February 24th, 2004, 04:43 AM
as the title suggest ...

add the follwing line to the end of the script ..

LPImage = "C:\92Documents and Settings\92All Users\92Documents\92My Music\92"..Artist.."\92"..Album.."\92Folder.JPG"

erikt
March 2nd, 2004, 08:56 AM
Thanks very much to Haddood for this script.
May I humbly suggest a slight improvement:

Track = pld1 #this to get the info from DVDSpy WMP.URL event
Title=gsub (Track, "C:\92Documents and Settings\92All Users\92Documents\92My Music\92", "",1) # removing prefixed path
Title=strsub (Title, 1, -5) # removing extension
x1=strfind (Title, "\92" )
Artist = strsub (Title, 1, x1-1)
Title=strsub (Title, x1+1)
x1=strfind (Title, "\92" )
Album = strsub (Title, 1, x1-1)
Title=strsub (Title, x1+1)
x1=strfind (Title, " " )
TrackN = strsub (Title, 1, x1-1)
Title=strsub (Title, x1+1)

This avoids two problems I encountered:
1. when an album name is the same as the artist's name
2. when and album/artist/etc. contains a special character

calavera-o
March 8th, 2004, 09:27 AM
could anybody please help me and modify this script
to my file structure? :roll:

main folder:
F:\Eigene Musik\
Files in this folder:
artist - track.mp3
(That are the mixed files, without any album information)

sub folders: (about 170 subfolders in the main folder, each one is a different album)
F:\Eigene Musik\Artist - Album
Files in this folder:
artist - ## - track.mp3

## = Tracknumber (01, 02, usw.)


Thank you.


I forgot: In each sub folder is a folder.jpg, it would be great, if this this image could be shown in the osd.

Haddood
March 8th, 2004, 06:35 PM
to help you out here is a hint

you have to find how many "\" is there in the track variable, if you find 2 that means it is a direct song, if you find 3 it means an album, then study the scripts to do the modifications, i guess no one will have time to modify it for you, unless he has a very similar situation ... as, at lest for me, after writing a script, it takes a significant time of testing ...

Haddood
March 9th, 2004, 08:43 PM
here is an HTMLOSD suggestion for displaying the info collected by the script ...
make sure to choose is HTML and parse text..


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Track Media info</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 2px;
margin-top: 2px;
margin-right: 2px;
margin-bottom: 2px;
background-color: #0080ff;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 24px;
font-weight: bold;
color: #000066;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<th width="26%" rowspan="8" scope="row"> [LPImage]</th>
<td colspan="2">Media Info</td>
</tr>
<tr>
<td width="15%">Title: </td>
<td width="59%"> [Title]</td>
</tr>
<tr>
<td>Album: </td>
<td>[Album] </td>
</tr>
<tr>
<td>Artist:</td>
<td>[Artist]</td>
</tr>
<tr>
<td>Duration:</td>
<td>[Duration]</td>
</tr>
<tr>
<td height="19">Type:</td>
<td height="19">[Type]</td>
</tr>
<tr>
<td height="8">Status:</td>
<td height="8">[Status]</td>
</tr>
<tr>
<td height="9">Track:</td>
<td height="9">[TrackN]</td>
</tr>
</table>
</body>
</html>

calavera-o
March 11th, 2004, 09:29 AM
to help you out here is a hint

you have to find how many "\" is there in the track variable, if you find 2 that means it is a direct song, if you find 3 it means an album, then study the scripts to do the modifications, i guess no one will have time to modify it for you, unless he has a very similar situation ... as, at lest for me, after writing a script, it takes a significant time of testing ...

I can't modify the script, because I don't understand it.
I don't know LUA.
Perhaps you know any other way, to get the Now Playing informations?
How does WMP.title functions from DVDSpy work?