ASP.Net Help
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
ASP.Net Help

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK
Author Message
J. Walker
Guest





Posted: Wed Sep 08, 2004 9:09 am    Post subject: ASP.Net Help Reply with quote

I'm hoping someone can help with a small problem I am encountering with an
ASP.NET app. Basically, I am trying to bind an Album's track list to a
datagrid. Things work fine, except that the first track information in the
datagrid is wrong. For example, it is listed as:

01 The Song Remains the Same

In addition, for the first track the album information, such as author,
album and duration is not displayed. It currently looks like the following
(this is for Led Zeppelin's album "Houses of the Holy" but it happens with
all albums).

Title Author Album Duration
01 The Song Remains the Same 0:00
The Rain Song Led Zeppelin Houses of the Holy 7:40
Over the Hills and Far Away Led Zeppelin Houses of the Holy 4:50
The Crunge Led Zeppelin Houses of the Holy 3:15
Dancing Days Led Zeppelin Houses of the Holy 3:45
D'Yer Mak'er Led Zeppelin Houses of the Holy 4:25
No Quarter Led Zeppelin Houses of the Holy 7:04
The Ocean Led Zeppelin Houses of the Holy 4:31


Here's the code that produces this. What's the problem? Thanks in advance.

Private Sub BindTracks()

Dim albumPath As String = Request.Item("albumpath")

Dim m As New WMPLib.WindowsMediaPlayer

Dim mi As WMPLib.IWMPMedia

Dim di As New IO.DirectoryInfo(albumPath)

For Each fi As IO.FileInfo In di.GetFiles("*.wma")

mi = m.newMedia(fi.FullName)

m.currentPlaylist.appendItem(mi)

Next

Dim table As New DataTable

table.Columns.Add("Title")

table.Columns.Add("Author")

table.Columns.Add("Album")

table.Columns.Add("Duration")

Dim row As DataRow

For i As Integer = 0 To m.currentPlaylist.count - 1

row = table.NewRow

row("Title") = m.currentPlaylist.Item(i).getItemInfo("Title")

row("Author") = m.currentPlaylist.Item(i).getItemInfo("Author")

row("Album") = m.currentPlaylist.Item(i).getItemInfo("Album")

row("Duration") = m.currentPlaylist.Item(i).durationString

table.Rows.Add(row)

Next

Me.dgTracks.DataSource = table

Me.dgTracks.DataBind()

End Sub

Back to top
Neil Smith [MVP Digital M
Guest





Posted: Wed Sep 08, 2004 12:11 pm    Post subject: Re: ASP.Net Help Reply with quote

I can't see anything obvious - the code seems logical enough. What
happens if you move the 'row = table.NewRow' outside the loop (so that
you're just setting the attributes of the row on each iteration) ?

That's still valid ASP.Net, right ?

It looks to me like the fields in the first row of the datagrid are
misaligned, as I've not experienced any problem with WMP in this
regard (and you are using zero-indexed items, which is correct)

HTH
Cheers - Neil

On Wed, 8 Sep 2004 01:09:34 -0400, "J. Walker"
<junior882@NOSPAMhotmail.com> wrote:

Quote:
I'm hoping someone can help with a small problem I am encountering with an
ASP.NET app. Basically, I am trying to bind an Album's track list to a
datagrid. Things work fine, except that the first track information in the
datagrid is wrong. For example, it is listed as:

01 The Song Remains the Same

In addition, for the first track the album information, such as author,
album and duration is not displayed. It currently looks like the following
(this is for Led Zeppelin's album "Houses of the Holy" but it happens with
all albums).

Title Author Album Duration
01 The Song Remains the Same 0:00
The Rain Song Led Zeppelin Houses of the Holy 7:40
Over the Hills and Far Away Led Zeppelin Houses of the Holy 4:50
The Crunge Led Zeppelin Houses of the Holy 3:15
Dancing Days Led Zeppelin Houses of the Holy 3:45
D'Yer Mak'er Led Zeppelin Houses of the Holy 4:25
No Quarter Led Zeppelin Houses of the Holy 7:04
The Ocean Led Zeppelin Houses of the Holy 4:31


Here's the code that produces this. What's the problem? Thanks in advance.

Private Sub BindTracks()

Dim albumPath As String = Request.Item("albumpath")

Dim m As New WMPLib.WindowsMediaPlayer

Dim mi As WMPLib.IWMPMedia

Dim di As New IO.DirectoryInfo(albumPath)

For Each fi As IO.FileInfo In di.GetFiles("*.wma")

mi = m.newMedia(fi.FullName)

m.currentPlaylist.appendItem(mi)

Next

Dim table As New DataTable

table.Columns.Add("Title")

table.Columns.Add("Author")

table.Columns.Add("Album")

table.Columns.Add("Duration")

Dim row As DataRow

For i As Integer = 0 To m.currentPlaylist.count - 1

row = table.NewRow

row("Title") = m.currentPlaylist.Item(i).getItemInfo("Title")

row("Author") = m.currentPlaylist.Item(i).getItemInfo("Author")

row("Album") = m.currentPlaylist.Item(i).getItemInfo("Album")

row("Duration") = m.currentPlaylist.Item(i).durationString

table.Rows.Add(row)

Next

Me.dgTracks.DataSource = table

Me.dgTracks.DataBind()

End Sub
Back to top
J. Walker
Guest





Posted: Thu Sep 09, 2004 12:08 am    Post subject: Re: ASP.Net Help Reply with quote

Thanks Neil.

I can move the row = table.NewRow outside the loop, but that's going to
cause a problem because there may be several tracks for an album and each
track should be stored in it's own row. Hmm. I'm beginning to wonder if this
may be a bug with the ActiveX control method. Who knows? Thanks again for
your help.

JW


"Neil Smith [MVP Digital Media]" <neil@nospam.com> wrote in message
news:t5gtj0d9namie6hpvop3tom736mlan83lu@4ax.com...
Quote:
I can't see anything obvious - the code seems logical enough. What
happens if you move the 'row = table.NewRow' outside the loop (so that
you're just setting the attributes of the row on each iteration) ?

That's still valid ASP.Net, right ?

It looks to me like the fields in the first row of the datagrid are
misaligned, as I've not experienced any problem with WMP in this
regard (and you are using zero-indexed items, which is correct)

HTH
Cheers - Neil

On Wed, 8 Sep 2004 01:09:34 -0400, "J. Walker"
junior882@NOSPAMhotmail.com> wrote:

I'm hoping someone can help with a small problem I am encountering with an
ASP.NET app. Basically, I am trying to bind an Album's track list to a
datagrid. Things work fine, except that the first track information in the
datagrid is wrong. For example, it is listed as:

01 The Song Remains the Same

In addition, for the first track the album information, such as author,
album and duration is not displayed. It currently looks like the following
(this is for Led Zeppelin's album "Houses of the Holy" but it happens with
all albums).

Title Author Album Duration
01 The Song Remains the Same 0:00
The Rain Song Led Zeppelin Houses of the Holy 7:40
Over the Hills and Far Away Led Zeppelin Houses of the Holy 4:50
The Crunge Led Zeppelin Houses of the Holy 3:15
Dancing Days Led Zeppelin Houses of the Holy 3:45
D'Yer Mak'er Led Zeppelin Houses of the Holy 4:25
No Quarter Led Zeppelin Houses of the Holy 7:04
The Ocean Led Zeppelin Houses of the Holy 4:31


Here's the code that produces this. What's the problem? Thanks in advance.

Private Sub BindTracks()

Dim albumPath As String = Request.Item("albumpath")

Dim m As New WMPLib.WindowsMediaPlayer

Dim mi As WMPLib.IWMPMedia

Dim di As New IO.DirectoryInfo(albumPath)

For Each fi As IO.FileInfo In di.GetFiles("*.wma")

mi = m.newMedia(fi.FullName)

m.currentPlaylist.appendItem(mi)

Next

Dim table As New DataTable

table.Columns.Add("Title")

table.Columns.Add("Author")

table.Columns.Add("Album")

table.Columns.Add("Duration")

Dim row As DataRow

For i As Integer = 0 To m.currentPlaylist.count - 1

row = table.NewRow

row("Title") = m.currentPlaylist.Item(i).getItemInfo("Title")

row("Author") = m.currentPlaylist.Item(i).getItemInfo("Author")

row("Album") = m.currentPlaylist.Item(i).getItemInfo("Album")

row("Duration") = m.currentPlaylist.Item(i).durationString

table.Rows.Add(row)

Next

Me.dgTracks.DataSource = table

Me.dgTracks.DataBind()

End Sub



Back to top
Neil Smith [MVP Digital M
Guest





Posted: Thu Sep 09, 2004 3:20 am    Post subject: Re: ASP.Net Help Reply with quote

Well, therre's nothing wrong with the documented ActiveX controls,
cause I've been using them to extract similar data, but using
javascript ;-)

(My problem is currently processing huge XML files derived from the
media library, in an acceptable way - my server is barfing on them !)

Cheers - Neil

On Wed, 8 Sep 2004 16:08:22 -0400, "J. Walker"
<junior882@NOSPAMhotmail.com> wrote:

Quote:
Thanks Neil.

I can move the row = table.NewRow outside the loop, but that's going to
cause a problem because there may be several tracks for an album and each
track should be stored in it's own row. Hmm. I'm beginning to wonder if this
may be a bug with the ActiveX control method. Who knows? Thanks again for
your help.

JW


"Neil Smith [MVP Digital Media]" <neil@nospam.com> wrote in message
news:t5gtj0d9namie6hpvop3tom736mlan83lu@4ax.com...
I can't see anything obvious - the code seems logical enough. What
happens if you move the 'row = table.NewRow' outside the loop (so that
you're just setting the attributes of the row on each iteration) ?

That's still valid ASP.Net, right ?

It looks to me like the fields in the first row of the datagrid are
misaligned, as I've not experienced any problem with WMP in this
regard (and you are using zero-indexed items, which is correct)

HTH
Cheers - Neil

On Wed, 8 Sep 2004 01:09:34 -0400, "J. Walker"
junior882@NOSPAMhotmail.com> wrote:

I'm hoping someone can help with a small problem I am encountering with an
ASP.NET app. Basically, I am trying to bind an Album's track list to a
datagrid. Things work fine, except that the first track information in the
datagrid is wrong. For example, it is listed as:

01 The Song Remains the Same

In addition, for the first track the album information, such as author,
album and duration is not displayed. It currently looks like the following
(this is for Led Zeppelin's album "Houses of the Holy" but it happens with
all albums).

Title Author Album Duration
01 The Song Remains the Same 0:00
The Rain Song Led Zeppelin Houses of the Holy 7:40
Over the Hills and Far Away Led Zeppelin Houses of the Holy 4:50
The Crunge Led Zeppelin Houses of the Holy 3:15
Dancing Days Led Zeppelin Houses of the Holy 3:45
D'Yer Mak'er Led Zeppelin Houses of the Holy 4:25
No Quarter Led Zeppelin Houses of the Holy 7:04
The Ocean Led Zeppelin Houses of the Holy 4:31


Here's the code that produces this. What's the problem? Thanks in advance.

Private Sub BindTracks()

Dim albumPath As String = Request.Item("albumpath")

Dim m As New WMPLib.WindowsMediaPlayer

Dim mi As WMPLib.IWMPMedia

Dim di As New IO.DirectoryInfo(albumPath)

For Each fi As IO.FileInfo In di.GetFiles("*.wma")

mi = m.newMedia(fi.FullName)

m.currentPlaylist.appendItem(mi)

Next

Dim table As New DataTable

table.Columns.Add("Title")

table.Columns.Add("Author")

table.Columns.Add("Album")

table.Columns.Add("Duration")

Dim row As DataRow

For i As Integer = 0 To m.currentPlaylist.count - 1

row = table.NewRow

row("Title") = m.currentPlaylist.Item(i).getItemInfo("Title")

row("Author") = m.currentPlaylist.Item(i).getItemInfo("Author")

row("Album") = m.currentPlaylist.Item(i).getItemInfo("Album")

row("Duration") = m.currentPlaylist.Item(i).durationString

table.Rows.Add(row)

Next

Me.dgTracks.DataSource = table

Me.dgTracks.DataBind()

End Sub


Back to top
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB