public bool SavePlaylist(string playlistId, IEnumerable <WebPlaylistItem> playlistItems) { String path = GetPlaylistPath(playlistId); PlayList mpPlaylist = new PlayList(); IPlayListIO factory = PlayListFactory.CreateIO(path); foreach (WebPlaylistItem i in playlistItems) { PlayListItem mpItem = new PlayListItem(i.Title, i.Path[0], i.Duration); mpItem.Type = PlayListItem.PlayListItemType.Audio; mpPlaylist.Add(mpItem); } return(factory.Save(mpPlaylist, path)); }
private void btPlayListSave_Click(object sender, EventArgs e) { if (_player.PlayList.Count == 0) { return; } SaveFileDialog sFD = new SaveFileDialog(); sFD.Filter = "M3U Format (*.m3u)|*.m3u|Winamp Playlist (*.pls)|*.pls"; if (sFD.ShowDialog() == DialogResult.OK) { IPlayListIO saver = PlayListFactory.CreateIO(sFD.FileName); saver.Save(_player.PlayList, sFD.FileName, ckUseRelativePath.Checked); } }
public string CreatePlaylist(string playlistName) { try { string fileName = playlistName + ".m3u"; string path = Path.Combine(configuration["playlist"], fileName); PlayList mpPlaylist = new PlayList(); IPlayListIO factory = PlayListFactory.CreateIO(path); factory.Save(mpPlaylist, path); return(EncodeTo64(fileName)); } catch (Exception ex) { Log.Error("Unable to create playlist " + playlistName, ex); } return(null); }