Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi All,

 

I found this link: http://blogs.msdn.com/coding4fun/archive/2006/10/31/913360.aspx this is a great article that shows hows to use windows media player in a browser.

 

I put into a site that I am playing around with and ran locally on my machine it looks pretty good. It list all the artists, songs and artwork etc. The problem is when I put it on my server. I have a machine in my loft which I am now using as a server which has windows server 2003 on it.

 

I published this site onto this server. The site runs ok with one main difference to how it ran on my local machine. That is the page that shows the list of music is empty. I have manged to track down the part of the code where the problem is:

Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer
Dim playlist As IWMPPlaylist = wmp.mediaCollection.getAll()
Dim artistDictionary As Dictionary(Of String, Artist) = New Dictionary(Of String, Artist)
For i As Integer = 0 To playlist.count - 1
'Do all the processing in here...
Next

When this code is ran locally the variable playlist has a count greater than zero, however when ran remotely on the server this variable has a count of zero, even though there a thousands of songs on this server which are in the windows media player's library.

 

No exceptions are being thrown, just this variable is not getting populated with anything.

 

Any ideas please share, Dave.

Posted

Each user on the computer has their own "library", so I'm guessing that the ASPNET user's WMP library is empty.

 

Try running your site as the user on the computer that has all the tracks in 'their' library - if this fixes the problem that you can either leave the site running as that user, or import all the music into the ASPNET user's music library (log on as the ASPNET user and 'scan computer' in WMP)

 

B.

Posted

Hi,

 

Just logged in as ASPNET and the library seems to have all of the songs that my account has!

 

The other thing I was wondering was could it be copyright on the files stopping me from doing this?

 

Any ideas?

Posted

Hi,

 

I am at the stage where I am trying anything and everything to get this thing working.

 

I think I may have been wrong when I said that I had logged into my server as the user ASPNET to see if this user has these files in their library. In fact when I try to login is that user I get the message "The local policy of this system does not permit you to logon interactively". I have tried various things to fix this but none seem to work.

 

Whilst doing numerous things I have noticed that I do get some information in the application event viewer: Plug-in 'WMS Anonymous User Authentication' on publishing point 'PublishingPoint1' failed with the following information: Error code = 0x8007052e, Error text = 'Logon failure: unknown user name or bad password. ' This message has only appeared a few times.

 

I am really struggling here, if there is anything you can think of please share.

 

Cheers, Dave.

Posted

It's me again!

 

Ok I did some more investigating yesterday to try and find out why this is not working.

 

As I am not too sure about debugging ASP sites remotely I used some extra code in the sub that I knew was the area where I needed to examine. I simply sent a few emails to myself via the code to get a clearer understanding of what was happening:

 

Private Shared Sub Refresh()
       Dim smtpServer As New System.Net.Mail.SmtpClient
       Dim EmailServer As String = "SMTP.them.co.uk"
       Dim ErrorEmailFrom As String = "me@me.co.uk"
       Dim ErrorEmailTo As String = "me@me.co.uk"
       Dim msgError As System.Net.Mail.MailMessage
       Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer
       Dim playlist As IWMPPlaylist = wmp.mediaCollection.getAll()
       Dim artistDictionary As Dictionary(Of String, Artist) = New Dictionary(Of String, Artist)
       If playlist.count > 0 Then
           msgError = New System.Net.Mail.MailMessage(ErrorEmailFrom, ErrorEmailTo)
           msgError.Subject = "Got records, user: " & My.User.Name
           smtpServer.Host = EmailServer
           smtpServer.Send(msgError)
       Else
           msgError = New System.Net.Mail.MailMessage(ErrorEmailFrom, ErrorEmailTo)
           msgError.Subject = "No records, user: " & My.User.Name
           smtpServer.Host = EmailServer
           smtpServer.Send(msgError)
       End If

       For i As Integer = 0 To playlist.count - 1
           Dim media As IWMPMedia = playlist.Item(i)
           Dim albumArtistName As String = media.getItemInfo("AlbumArtist")
           Dim albumName As String = media.getItemInfo("Album")
           Dim trackName As String = media.getItemInfo("Title")
           Dim trackLocation As String = media.getItemInfo("SourceUrl")
           Dim trackNumberString As String = media.getItemInfo("OriginalIndex")
           Dim theArtist As Artist = Nothing
           Dim artistSortName As String = Artist.GetSortName(albumArtistName)
           If Not artistDictionary.TryGetValue(artistSortName, theArtist) Then
               theArtist = New Artist(albumArtistName)
               artistDictionary.Add(artistSortName, theArtist)
           End If
           Dim theAlbum As Album = Nothing
           If Not theArtist.Albums.TryGetValue(albumName, theAlbum) Then
               theAlbum = New Album(albumName, theArtist)
               theArtist.Albums.Add(albumName, theAlbum)
           End If
           Dim theTrack As Track = Nothing
           If Not theAlbum.Tracks.TryGetValue(trackName, theTrack) Then
               Dim trackNumber As Integer
               If Integer.TryParse(trackNumberString, trackNumber) Then
                   theTrack = New Track(trackNumber, trackName, trackLocation)
               Else
                   theTrack = New Track(trackName, trackLocation)
               End If
               theTrack.Album = theAlbum
               theAlbum.Tracks.Add(trackName, theTrack)
           End If
           msgError.Body = msgError.Body + "playlist count:" & playlist.count.ToString & "albumArtistName: " & albumArtistName & " Album: " & albumName & " trackName: " & trackName & System.Environment.NewLine & "trackLocation: " & trackLocation & System.Environment.NewLine
       Next
       ArtistList.AddRange(artistDictionary.Values)
       ArtistList.Sort()
   End Sub

 

Here is an example of the body of an email the code sent me yesterday:

 

playlist count:15albumArtistName: Album: trackName: Favorites -- 4 and 5 star rated

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- 4 and 5 star rated.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- Have not heard recently

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- Have not heard recently.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- Listen to at night

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- Listen to late at night.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- Listen to on Weekdays

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- Listen to on Weekdays.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- Listen to on Weekends

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- Listen to on Weekends.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- One Audio CD worth

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- One Audio CD worth.wpl

 

playlist count:15albumArtistName: Album: trackName: Favorites -- One Data CD-R worth

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Favorites -- One Data CD-R worth.wpl

 

playlist count:15albumArtistName: Album: trackName: Fresh tracks -- yet to be played

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Fresh tracks -- yet to be played.wpl

 

playlist count:15albumArtistName: Album: trackName: Fresh tracks -- yet to be rated

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Fresh tracks -- yet to be rated.wpl

 

playlist count:15albumArtistName: Album: trackName: Fresh tracks

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Fresh tracks.wpl

 

playlist count:15albumArtistName: Album: trackName: High bitrate media in my library

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\High bitrate media in my library.wpl

 

playlist count:15albumArtistName: Album: trackName: Low bitrate media in my library

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Low bitrate media in my library.wpl

 

playlist count:15albumArtistName: Album: trackName: Music tracks I dislike

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Music tracks I dislike.wpl

 

playlist count:15albumArtistName: Album: trackName: Music tracks I have not rated

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Music tracks I have not rated.wpl

 

playlist count:15albumArtistName: Album: trackName: Music tracks with content protection

trackLocation: C:\Documents and Settings\All Users\Documents\My Music\Sample Playlists\00139619\Music tracks with content protection.wpl

 

What you can see is that ASPNET has no songs at all just 15 playlists. So when the site (http://www.showcaseit.co.uk/, click webmasters login as Admin/Password click hyperlink etc) tries to load the list of songs it just shows one artist as unknown if you click to play this track the code cannot find this one song, as it is not a song but a playlist.

 

Thanks to some help I manged to log into the server as ASPNET. I opened Windows Media Player and populated its library with all of the songs. This has made absolutely no difference what so ever. I just got shown the same 15 playlist and nothing else.

 

Thanks for your help so far but please keep it coming if you can.

 

Cheers, Dave.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...