public string GetHeader(Playlist playlist)
        {
            if(playlist == null)
                throw new ArgumentNullException("playlist");

            return string.Format(CultureInfo.CurrentCulture, HeaderData, playlist.Title, playlist.Videos.Count);
        }
        public void Render(Playlist playlist, PlaylistFileType playlistFileType, PlaylistOutput playlistOutput)
        {
            var playlistFormatter = _playlistFormatRetriever.GetPlaylistFormatter(playlistFileType);

            playlistOutput(playlistFormatter.GetHeader(playlist));

            for (var playlistIndex = 0; playlistIndex < playlist.Videos.Count; playlistIndex++)
            {
                var location = playlist.Videos[playlistIndex].Location;
                playlistOutput(playlistFormatter.GetPlaylistVideo(location, playlistIndex));
            }

            playlistOutput(playlistFormatter.GetFooter(playlist));
        }
        public Playlist Build(PlaylistConfiguration playlistConfiguration)
        {
            var videoScannerOptions = new VideoScannerOptions
            {
                Blacklist = _blacklistStore.Load(GetBlacklistPath(playlistConfiguration)),
                EligibleFileTypes = playlistConfiguration.PlaylistGeneratorSettings.EligibleFileTypes
            };

            var videoScanner = _videoScannerProvider.GetVideoScanner(videoScannerOptions);

            var videoPoolsByName = playlistConfiguration
                .PoolConfigurations
                .ToDictionary(configuration => configuration.Name, configuration => new Pool(configuration, videoScanner, _randomProvider));

            var playlist = new Playlist();

            while (playlist.Videos.Count < playlistConfiguration.MaxVideos && videoPoolsByName.Any(x => x.Value.HasVideosRemaining))
            {
                foreach (var poolName in playlistConfiguration.Sequence)
                {
                    if (playlist.Videos.Count >= playlistConfiguration.MaxVideos)
                        break;

                    var pool = videoPoolsByName[poolName.Name];
                    if (!pool.HasVideosRemaining)
                    {
                        if(pool.ShouldReload)
                            pool.ReinitializePool();
                        else
                            continue;
                    }

                    playlist.Videos.Add(pool.GetNextVideoDirectory().GetNextVideo());
                }
            }

            return playlist;
        }
 public string GetHeader(Playlist playlist)
 {
     return string.Format("[playlist]{0}", Environment.NewLine);
 }
 public string GetFooter(Playlist playlist)
 {
     return string.Format("NumberOfEntries={0}{1}Version=2{1}", playlist.Videos.Count, Environment.NewLine);
 }
 public PlaylistBuilder()
 {
     _playlist = new Playlist();
 }
 public string GetHeader(Playlist playlist)
 {
     return "MPCPLAYLIST" + Environment.NewLine;
 }
 public string GetFooter(Playlist playlist)
 {
     return string.Empty;
 }
 protected void WhenBuildingPlaylist()
 {
     ThenPlaylist = new PlaylistCreator(_blacklistStore, _videoScannerProvider, _randomProvider)
         .Build(GivenPlaylistConfiguration.Build());
 }
 public string GetFooter(Playlist playlist)
 {
     return FooterData;
 }