Problem with loop reading wma metadata

R

Renster

Folks,

Im not sure if this would have been better going to this group, or a
windows media one! Oh well...

Im using fitnesse (for those that know it) to test an app that among
other things can rip WMA from CD. I have a class library that calls
the app's public methods to set track, destination, format etc, and do
the rip. Im then using the media player SDK in the following code.

What I dont get is, why *some* tracks return "builtlist" as 8 of the
metadata fields, whilst others return something like 23 - yet the
looping and code is exactly the same for each track iteration - the
only thing Im changing is the track no to rip, and the bitrate to rip
to/with - further research has shown that it seems to be the track no
that is the significant change.

Can anyone offer any suggestions / explanations?

(Im afraid this is just the first of a few current questions - I'll
not post the others yet in case the solution to this has a knock-on
fix for the others!)

Cheers

Steve

Code:


public string FileFormatInfo()
{
string strPath = UriOfTrack.AbsolutePath;
StringBuilder myBuiltString = new StringBuilder(strPath);
myBuiltString.Replace("/", "\\", 0, strPath.Length);
myBuiltString.Replace("%20", " ", 0, strPath.Length);
strPath = (Convert.ToString(myBuiltString));
Microsoft.MediaPlayer.Interop.WindowsMediaPlayerClass
myplayerclass = new
Microsoft.MediaPlayer.Interop.WindowsMediaPlayerClass();
Microsoft.MediaPlayer.Interop.IWMPMedia mymedia =
myplayerclass.newMedia(strPath);
string builtlist = "";
string[] attrs = new string[] { "AcquisitionTime", "AlbumID",
"AlbumIDAlbumArtist", "Author", "AverageLevel", "Bitrate", "BuyNow",
"BuyTickets", "Channels", "Copyright", "CurrentBitrate", "Duration",
"FileSize", "FileType", "Is_Protected", "IsVBR", "MediaType",
"MoreInfo", "PartOfSet", "PeakValue", "PlaylistIndex",
"ProviderLogoURL", "ProviderU,L", "RecordingTime", "RecordingTimeDay",
"RecordingTimeMonth", "RecordingTimeYear", "RecordingTime,earMonth",
"RecordingTimeYearMonthDay", "ReleaseDate", "ReleaseDateDay",
"ReleaseDateMonth", "Rel,aseDateYear", "ReleaseDateYearMonth",
"ReleaseDateYearMonthDay", "RequestState", "ShadowFilePath",
"SourceURL", "SyncState", "Title", "TrackingID", "UserCustom1",
"UserCustom2", "UserEffectiveRating", "UserLastPlayedTime",
"UserPlayCount", "UserPlaycountAfternoon", "UserPlaycountEvening",
"UserPlaycountM,rning", "UserPlaycountNight", "UserPlaycountWeekday",
"UserPlaycountWeekend", "UserRating", "UserSer,iceRating", "WM/
AlbumArtist", "WM/AlbumTitle", "WM/Category", "WM/Composer", "WM/
Conductor", "WM/ContentDistributor", "WM/ContentGroupDescription", "WM/
EncodingTime", "WM/Genre", "WM/GenreID", "WM/InitialKey", "WM/
Language", "WM/Lyrics", "WM/MCDI", "WM/MediaClassPrimaryID", "WM/
MediaClassSecondaryID", "WM/Mood", "WM/ParentalRating", "WM/Period",
"WM/ProtectionType", "WM/Provider", "WM/ProviderRating", "WM/
ProviderStyle", "WM/Publisher", "WM/SubscriptionContentID", "WM/
SubTitle", "WM/TrackNumber", "WM/UniqueFileIdentifier", "WM/
WMCollectionGroupID", "WM/WMCollectionID", "WM/WMContentID", "WM/
Writer", "WM/Year" };

foreach (string attrname in attrs)
{
if (mymedia.getItemInfo(attrname) != "")
{
builtlist = builtlist + attrname + ":" +
(mymedia.getItemInfo(attrname) + "<BR>");
}
}
return builtlist;
}
 
J

Jon Skeet [C# MVP]

Im not sure if this would have been better going to this group, or a
windows media one! Oh well...

Im using fitnesse (for those that know it) to test an app that among
other things can rip WMA from CD. I have a class library that calls
the app's public methods to set track, destination, format etc, and do
the rip. Im then using the media player SDK in the following code.

What I dont get is, why *some* tracks return "builtlist" as 8 of the
metadata fields, whilst others return something like 23 - yet the
looping and code is exactly the same for each track iteration - the
only thing Im changing is the track no to rip, and the bitrate to rip
to/with - further research has shown that it seems to be the track no
that is the significant change.

If you view the file attributes in explorer, do you see all of them
even in the ones that only return 8 of them in your code?

Jon
 
Top