private string GetPlaylistUrl(string folderPath)
        {
            if (string.IsNullOrEmpty(folderPath))
            {
                return(string.Empty);
            }

            string recursive = this.includeSubfoldersCheckBox.Checked ?
                               "Recursive." : string.Empty;

            //string shuffle = this.shuffleCheckBox.Checked ? "Shuffle" : string.Empty;
            string shuffle = string.Empty; // Shuffling now implemented by directing player to shuffle the list on its own.

            string appName = this.Request.ApplicationPath;

            if (appName == "/")
            {
                appName = string.Empty;
            }

            string url = string.Format("./{1}/{2}{3}Folder.dynplist",
                                       UtilityMethods.GetFullAppUrlPrefix(),
                                       UtilityMethods.CalcAndStoreFilePathHash(folderPath),
                                       recursive, shuffle);

            return(url);
        }
    private void RenderPlaylistTracks(List <FileInfo> mediaFiles, PlaylistType playlist, bool shuffle)
    {
        List <TrackType> trackList = new List <TrackType>();

        string songPathPrefix  = string.Format("{0}/Handlers/Song.ashx?", UtilityMethods.GetFullAppUrlPrefix());
        string imagePathPrefix = string.Format("{0}/Handlers/CoverArt.ashx?", UtilityMethods.GetFullAppUrlPrefix());
        string noImage         = string.Format("{0}/Images/NoCoverArt.jpg", UtilityMethods.GetFullAppUrlPrefix());

        foreach (FileInfo mediaFileInfo in mediaFiles)
        {
            if (!mediaFileInfo.Exists)
            {
                continue;
            }

            TrackType trackInfo = new TrackType();

            try
            {
                UltraID3 mp3Info = new UltraID3();
                mp3Info.Read(mediaFileInfo.FullName);

                if (!mp3Info.ID3v23Tag.FoundFlag && !mp3Info.ID3v23Tag.FoundFlag)
                {
                    // No tags
                    trackInfo.title = mediaFileInfo.Name.Substring(0, mediaFileInfo.Name.Length - mediaFileInfo.Extension.Length);
                }
                else
                {
                    // Image
                    if (mp3Info.ID3v23Tag.FoundFlag)
                    {
                        ID3FrameCollection pictureFrames = mp3Info.ID3v23Tag.Frames.GetFrames(MultipleInstanceFrameTypes.Picture);
                        if (pictureFrames.Count > 0) // File has picture
                        {
                            trackInfo.image = imagePathPrefix + UtilityMethods.CalcAndStoreFilePathHash(mediaFileInfo.FullName);
                        }
                    }

                    // Title
                    if (mp3Info.Title == null || mp3Info.Title.Length == 0)
                    {
                        trackInfo.title = mediaFileInfo.Name.Substring(0, mediaFileInfo.Name.Length - mediaFileInfo.Extension.Length - 1);
                    }
                    else
                    {
                        trackInfo.title = mp3Info.Title;
                    }

                    trackInfo.meta          = new MetaType[1];
                    trackInfo.meta[0]       = new MetaType();
                    trackInfo.meta[0].rel   = "length";
                    trackInfo.meta[0].Value = mediaFileInfo.Length.ToString();

                    trackInfo.album      = mp3Info.Album;
                    trackInfo.creator    = mp3Info.Artist;
                    trackInfo.annotation = mp3Info.Comments;
                    if (mp3Info.TrackNum.HasValue)
                    {
                        trackInfo.trackNum = mp3Info.TrackNum.Value.ToString();
                    }
                }
            }
            catch
            {
                trackInfo.title = mediaFileInfo.Name.Substring(0, mediaFileInfo.Name.Length - mediaFileInfo.Extension.Length);
            }

            trackInfo.location    = new string[1];
            trackInfo.location[0] = songPathPrefix + UtilityMethods.CalcAndStoreFilePathHash(mediaFileInfo.FullName);

            if (trackInfo.title != null && trackInfo.title.Length > 0)
            {
                trackList.Add(trackInfo);
            }

            if (trackInfo.image == null || trackInfo.image.Length == 0)
            {
                trackInfo.image = noImage;
            }

            //System.GC.Collect();
        }

        playlist.trackList = trackList.ToArray();

        if (shuffle)
        {
            UtilityMethods.ShuffleArray(playlist.trackList);
        }
    }