public PlayList GetPlaylist(PlayListType nPlayList) { switch (nPlayList) { case PlayListType.PLAYLIST_MUSIC: return(_musicPlayList); case PlayListType.PLAYLIST_MUSIC_TEMP: return(_tempMusicPlayList); case PlayListType.PLAYLIST_VIDEO: return(_videoPlayList); case PlayListType.PLAYLIST_VIDEO_TEMP: return(_tempVideoPlayList); case PlayListType.PLAYLIST_MUSIC_VIDEO: return(_musicVideoPlayList); case PlayListType.PLAYLIST_RADIO_STREAMS: return(_radioStreamPlayList); default: _emptyPlayList.Clear(); return(_emptyPlayList); } }
public bool Load(PlayList playlist, string fileName) { playlist.Clear(); XmlNodeList nodeEntries; if (!LoadXml(fileName, out nodeEntries)) return false; try { string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); foreach (XmlNode node in nodeEntries) { string file = ReadFileName(node); if (file == null) return false; string infoLine = ReadInfoLine(node, file); int duration = ReadLength(node); SetupTv.Utils.GetQualifiedFilename(basePath, ref file); PlayListItem newItem = new PlayListItem(infoLine, file, duration); playlist.Add(newItem); } return true; } catch (Exception) { return false; } }
/// <summary> /// Adds a list of Music Videos to a playlist, or a list of artists Music Videos /// </summary> /// <param name="items"></param> /// <param name="playNow"></param> /// <param name="clear"></param> private void AddToPlaylist(List <DBTrackInfo> items, bool playNow, bool clear, bool shuffle) { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); if (clear) { playlist.Clear(); } foreach (DBTrackInfo video in items) { PlayListItem p1 = new PlayListItem(video); p1.Track = video; p1.FileName = video.LocalMedia[0].File.FullName; playlist.Add(p1); } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; if (shuffle) { playlist.Shuffle(); } if (playNow) { Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { logger.Debug("Switching to Fullscreen"); GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } } }
private void PlaylistSortDesc() { View?.SetPage(TabPage.PlayList); var q = from i in PlayList.Clone() orderby i descending select i; PlayList.Clear(); PlayList.AddRange(q); }
private void PlaylistSortDisticnt() { View?.SetPage(TabPage.PlayList); var q = PlayList.Clone().Distinct(); PlayList.Clear(); PlayList.AddRange(q); }
private void SetPlayList(PlayList result) { if (result != null && result.Songs.Count > 0) { PlayList.Clear(); result.Songs.ForEach(s => PlayList.Enqueue(s)); } }
public static void RefreashSet() { File.Delete("list.db"); Stop(); Allsets.Clear(); PlayList.Clear(); Initset(); }
private void PlaylistSortRandom() { View?.SetPage(TabPage.PlayList); var q = from i in PlayList.Clone() orderby Guid.NewGuid() select i; PlayList.Clear(); PlayList.AddRange(q); }
private void PlaylistSortAsc() { View?.SetPage(TabPage.PlayList); var q = from i in PlayList.Clone() orderby i ascending select i; var sorted = q.ToList(); PlayList.Clear(); PlayList.AddRange(sorted); }
void buttonDeletePlaylist_Click(object sender, EventArgs e) { Log.Info("buttonDeletePlaylist clicked."); try { playList.Clear(); } catch (Exception ex) { Log.Error(ex.Message); } }
/// <summary> /// Play tracks by selected Genre /// </summary> private void playByGenre() { GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlgMenu != null) { dlgMenu.Reset(); dlgMenu.SetHeading(mvCentralUtils.PluginName() + " - " + Localization.SmartPlaylistOptions); List <DBGenres> genreList = DBGenres.GetAll(); genreList.Sort(delegate(DBGenres p1, DBGenres p2) { return(p1.Genre.CompareTo(p2.Genre)); }); foreach (DBGenres genre in genreList) { if (genre.Enabled) { dlgMenu.Add(genre.Genre); } } dlgMenu.DoModal(GetID); if (dlgMenu.SelectedLabel == -1) // Nothing was selected { return; } //dlgMenu.SelectedLabelText PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBArtistInfo> allArtists = DBArtistInfo.GetAll(); foreach (DBArtistInfo artist in allArtists) { if (tagMatched(dlgMenu.SelectedLabelText, artist)) { logger.Debug("Matched Artist {0} with Tag {1}", artist.Artist, dlgMenu.SelectedLabelText); List <DBTrackInfo> theTracks = DBTrackInfo.GetEntriesByArtist(artist); foreach (DBTrackInfo artistTrack in theTracks) { playlist.Add(new PlayListItem(artistTrack)); } } } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; if (mvCentralCore.Settings.GeneratedPlaylistAutoShuffle) { playlist.Shuffle(); } Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } } }
public double Volume; // 0.0 - 1.0, def: 0.5 public void Dispose() // Codevil の UnloadSE() { PlayList.Clear(); for (int index = 0; index < SE_HANDLE_MAX; index++) { GameSound.UnloadSound(this.HandleList[index]); } }
public bool Load(PlayList playlist, string fileName) { playlist.Clear(); try { var basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); var doc = new XmlDocument(); doc.Load(fileName); if (doc.DocumentElement == null) { return(false); } var nodeRoot = doc.DocumentElement.SelectSingleNode("/asx"); if (nodeRoot == null) { return(false); } var nodeEntries = nodeRoot.SelectNodes("entry"); foreach (XmlNode node in nodeEntries) { var srcNode = node.SelectSingleNode("ref"); if (srcNode != null) { var url = srcNode.Attributes.GetNamedItem("href"); if (url != null) { if (url.InnerText != null) { if (url.InnerText.Length > 0) { fileName = url.InnerText; if ( !(fileName.ToLowerInvariant().StartsWith("http") || fileName.ToLowerInvariant().StartsWith("mms") || fileName.ToLowerInvariant().StartsWith("rtp"))) { continue; } var newItem = new PlayListItem(fileName, fileName, 0); newItem.Type = PlayListItem.PlayListItemType.Audio; playlist.Add(newItem); } } } } } return(true); } catch (Exception ex) { Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace); } return(false); }
public void ChangePlayList() { if (IsSongListChanged) { IsSongListChanged = false; PlayList.Clear(); PlayList = new List <Song>(SongList); } }
async Task <int> onLoadList(int[] genres, string[] users, string filter, int rndDay) { try { var sw = Stopwatch.StartNew(); int ttlRows = await Task.Run(() => { _db.MediaUnits.Where(r => !r.DeletedAt.HasValue).Load(); return(_db.MediaUnits.Local.Count()); }); var sql = $@" SELECT TOP (@take) MediaUnit.ID, MediaUnit.GenreID, MediaUnit.PathFileExtOrg, MediaUnit.PathName, MediaUnit.FileName, MediaUnit.FileHashMD5, MediaUnit.FileHashQck, MediaUnit.FileLength, MediaUnit.DurationSec, MediaUnit.CurPositionSec, MediaUnit.Notes, MediaUnit.AddedAt, MediaUnit.DeletedAt FROM MuAudition INNER JOIN MediaUnit ON MuAudition.MediaUnitID = MediaUnit.ID GROUP BY MuAudition.MediaUnitID, MediaUnit.ID, MediaUnit.GenreID, MediaUnit.PathFileExtOrg, MediaUnit.PathName, MediaUnit.FileName, MediaUnit.FileHashMD5, MediaUnit.FileHashQck, MediaUnit.FileLength, MediaUnit.DurationSec, MediaUnit.CurPositionSec, MediaUnit.Notes, MediaUnit.AddedAt, MediaUnit.DeletedAt HAVING MediaUnit.DeletedAt IS NULL AND MediaUnit.PathFileExtOrg LIKE '%'+@filter+'%' {(genres.Length > 0 ? " AND (MediaUnit.GenreID IN (" + string.Join(",", genres) + ")) " : " ")} ORDER BY DATEDIFF(day, MAX(MuAudition.DoneAt), GETDATE()) / (1+COUNT(*)) + ABS(CHECKSUM(NEWID())) % @rndDay DESC"; //var oldNOtUsed = await _db.Database.SqlQuery<MediaUnit>(sql, new SqlParameter("take", PlaylilstLen), new SqlParameter("rndDay", rndDay), new SqlParameter("filter", filter)).ToListAsync(); var take = PlaylilstLen; var qa = $@" SELECT TOP ({take}) MuAudition.MediaUnitID FROM MuAudition INNER JOIN MediaUnit ON MuAudition.MediaUnitID = MediaUnit.ID GROUP BY MuAudition.MediaUnitID, MediaUnit.GenreID, MediaUnit.PathFileExtOrg, MediaUnit.DeletedAt HAVING MediaUnit.DeletedAt IS NULL AND MediaUnit.PathFileExtOrg LIKE '%{filter}%' {(genres.Length > 0 ? " AND (MediaUnit.GenreID IN (" + string.Join(",", genres) + ")) " : " ")} ORDER BY DATEDIFF(day, MAX(MuAudition.DoneAt), GETDATE()) / (1+COUNT(*)) + ABS(CHECKSUM(NEWID())) % {rndDay} DESC"; var auds = await _db.Database.SqlQuery <int>(qa, new SqlParameter("take", PlaylilstLen), new SqlParameter("rndDay", rndDay)).ToListAsync(); var pl1 = _db.MediaUnits.Where(r => auds.Contains(r.ID)).OrderBy(r => r.MuAuditions.Where(a => a.MediaUnitID == r.ID).Max(a => a.DoneAt)); //Jun2017 var pl2 = _db.MediaUnits.Where(r => r.DeletedAt == null && auds.Contains(r.ID)).OrderBy(r => r.MuAuditions.Where(a => a.MediaUnitID == r.ID).Max(a => a.DoneAt)); //Jun2017 var aud = _db.MuAuditions.Select(r => r.MediaUnitID); PlayList.Clear(); _db.MediaUnits.Where(r => r.DeletedAt == null && !aud.Contains(r.ID)).ToList().ForEach(PlayList.Add); // 2017-07: start from never listened to. _db.MediaUnits.Where(r => r.DeletedAt == null && auds.Contains(r.ID)).OrderBy(r => r.MuAuditions.Where(a => a.MediaUnitID == r.ID).Max(a => a.DoneAt)).ToList().ForEach(PlayList.Add); // 2017-06 if (PlayList.Count() > 0) { CurMediaUnit = PlayList[0]; } TopLefttInfo = $"Top {PlayList.Count()} songs of {"oldNOtUsed.Count()"} matches of {_db.MediaUnits.Local.Count()} total loaded in {.001 * sw.ElapsedMilliseconds:N1}s. Last pos: {TimeSpan.FromSeconds(CurMediaUnit.CurPositionSec):m\\:ss}"; if (_AudioRprtg) { synth.SpeakAsync($"Loaded in {sw.Elapsed.TotalSeconds:N0} seconds."); } ExceptionMsg = ""; return(ttlRows); } catch (Exception ex) { ex.Log(); } return(-1); }
/// <summary> /// Clears the playlist (removes all entries) /// </summary> /// <param name="type">Type of the playlist</param> public static void ClearPlaylist(String type, bool refresh) { PlayListType plType = GetTypeFromString(type); PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer; PlayList playList = playListPlayer.GetPlaylist(plType); playList.Clear(); if (refresh) { RefreshPlaylistIfVisible(); } }
public void DoPlay(YouTubeEntry vid, bool fullscr, GUIListControl facade) { if (vid != null) { VideoInfo qa = SelectQuality(vid); if (qa.Quality == VideoQuality.Unknow) { return; } Youtube2MP.temp_player.Reset(); Youtube2MP.temp_player.RepeatPlaylist = true; Youtube2MP.temp_player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC_VIDEO; PlayList playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO); playlist.Clear(); g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); AddItemToPlayList(vid, ref playlist, qa); if (facade != null) { qa.Items = new Dictionary <string, string>(); int selected = facade.SelectedListItemIndex; for (int i = selected + 1; i < facade.ListItems.Count; i++) { AddItemToPlayList(facade.ListItems[i], ref playlist, new VideoInfo(qa)); } } PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.temp_player.Play(0); if (g_Player.Playing && fullscr) { if (_setting.ShowNowPlaying) { GUIWindowManager.ActivateWindow(29052); } else { g_Player.ShowFullScreenWindow(); } } if (!g_Player.Playing) { Err_message("Unable to playback the item ! "); } } }
public bool Load(PlayList playlist, string fileName) { playlist.Clear(); try { string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); XmlDocument doc = new XmlDocument(); doc.Load(fileName); if (doc.DocumentElement == null) { return false; } XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/asx"); if (nodeRoot == null) { return false; } XmlNodeList nodeEntries = nodeRoot.SelectNodes("entry"); foreach (XmlNode node in nodeEntries) { XmlNode srcNode = node.SelectSingleNode("ref"); if (srcNode != null) { XmlNode url = srcNode.Attributes.GetNamedItem("href"); if (url != null) { if (url.InnerText != null) { if (url.InnerText.Length > 0) { fileName = url.InnerText; if (!(fileName.ToLowerInvariant().StartsWith("http") || fileName.ToLowerInvariant().StartsWith("mms") || fileName.ToLowerInvariant().StartsWith("rtp"))) continue; PlayListItem newItem = new PlayListItem(fileName, fileName, 0); newItem.Type = PlayListItem.PlayListItemType.Audio; playlist.Add(newItem); } } } } } return true; } catch (Exception ex) { Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace); } return false; }
public bool Load(PlayList playlist, string fileName) { playlist.Clear(); try { string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); XmlDocument doc = new XmlDocument(); doc.Load(fileName); if (doc.DocumentElement == null) { return false; } XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/smil/body/seq"); if (nodeRoot == null) { return false; } XmlNodeList nodeEntries = nodeRoot.SelectNodes("media"); foreach (XmlNode node in nodeEntries) { XmlNode srcNode = node.Attributes.GetNamedItem("src"); if (srcNode != null) { if (srcNode.InnerText != null) { if (srcNode.InnerText.Length > 0) { fileName = srcNode.InnerText; Util.Utils.GetQualifiedFilename(basePath, ref fileName); PlayListItem newItem = new PlayListItem(fileName, fileName, 0); newItem.Type = PlayListItem.PlayListItemType.Audio; string description; description = Path.GetFileName(fileName); newItem.Description = description; playlist.Add(newItem); } } } } return true; } catch (Exception ex) { Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace); } return false; }
private void Clear() { if (CurrentPlaylist != null) { if (HasChanges) { if (MessageBox.Show("Do you wish to save changes in " + CurrentPlaylist.PlaylistName + " ?", CurrentPlaylist.PlaylistName, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { this.UpdateList(); } } } CurrentPlaylist = null; PlayList.Clear(); }
public bool Load(PlayList playlist, string playlistFileName) { playlist.Clear(); try { var doc = new XmlDocument(); doc.Load(playlistFileName); if (doc.DocumentElement == null) return false; XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/smil/body/seq"); if (nodeRoot == null) return false; XmlNodeList nodeEntries = nodeRoot.SelectNodes("media"); if (nodeEntries != null) foreach (XmlNode node in nodeEntries) { XmlNode srcNode = node.Attributes.GetNamedItem("src"); if (srcNode != null) { if (srcNode.InnerText != null) { if (srcNode.InnerText.Length > 0) { var playlistUrl = srcNode.InnerText; var newItem = new PlayListItem(playlistUrl, playlistUrl, 0) { Type = PlayListItem.PlayListItemType.Audio }; string description = Path.GetFileName(playlistUrl); newItem.Description = description; playlist.Add(newItem); } } } } return true; } catch (Exception e) { Log.Error(e.StackTrace); } return false; }
/// <summary> /// Play by Selected Tag /// </summary> private void playByTag() { GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlgMenu != null) { dlgMenu.Reset(); dlgMenu.SetHeading(mvCentralUtils.PluginName() + " - " + Localization.SmartPlaylistOptions); foreach (string artistTag in artistTags) { dlgMenu.Add(artistTag); } dlgMenu.DoModal(GetID); if (dlgMenu.SelectedLabel == -1) // Nothing was selected { return; } //dlgMenu.SelectedLabelText PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBArtistInfo> allArtists = DBArtistInfo.GetAll(); foreach (DBArtistInfo artist in allArtists) { if (artist.Tag.Contains(dlgMenu.SelectedLabelText)) { List <DBTrackInfo> theTracks = DBTrackInfo.GetEntriesByArtist(artist); foreach (DBTrackInfo artistTrack in theTracks) { playlist.Add(new PlayListItem(artistTrack)); } } } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; playlist.Shuffle(); Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } } }
/// <summary> /// Create a Random Playlist of All Videos /// </summary> private void playRandomAll() { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBTrackInfo> videos = DBTrackInfo.GetAll(); foreach (DBTrackInfo video in videos) { playlist.Add(new PlayListItem(video)); } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; playlist.Shuffle(); Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } }
public bool Load(PlayList incomingPlaylist, string playlistFileName) { if (playlistFileName == null) return false; playlist = incomingPlaylist; playlist.Clear(); XmlDocument doc = new XmlDocument(); try { doc.Load(playlistFileName); } catch (XmlException e) { MPTVSeriesLog.Write(string.Format("Cannot Load Playlist file: {0}",playlistFileName)); MPTVSeriesLog.Write(e.Message); return false; } try { playlist.Name = Path.GetFileName(playlistFileName); basePath = Path.GetDirectoryName(Path.GetFullPath(playlistFileName)); XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/Playlist/Episode"); if (nodeList == null) return false; foreach (XmlNode node in nodeList) { if (!AddItem(node.SelectSingleNode("ID").InnerText)) return false; } } catch (Exception ex) { MPTVSeriesLog.Write(string.Format("exception loading playlist {0} err:{1} stack:{2}", playlistFileName, ex.Message, ex.StackTrace)); return false; } return true; }
/// <summary> /// 获取数据 /// </summary> public void GetDate() { try { List <SeatManage.ClassModel.AMS_Advertisement> modelList = SeatManage.Bll.AdvertisementOperation.GetAdList(null, SeatManage.EnumType.AdType.PlaylistAd); PlayList.Clear(); foreach (SeatManage.ClassModel.AMS_Advertisement model in modelList) { SeatManage.ClassModel.PlaylistInfo view = SeatManage.ClassModel.PlaylistInfo.ToModel(model.AdContent); view.AdContent = model.AdContent; view.ID = model.ID; PlayList.Add(view); } } catch (Exception ex) { ErrorMessage = ex.Message; SeatManage.SeatManageComm.WriteLog.Write("获取学校通知失败" + ex.Message); } }
/// <summary> /// Play Tracks that have been added in the past X Days /// </summary> private void playFreshTracks() { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBTrackInfo> videos = DBTrackInfo.GetAll(); videos.RemoveAll(video => video.DateAdded < DateTime.Now.Subtract(new TimeSpan(mvCentralCore.Settings.OldAFterDays, 0, 0, 0, 0))); foreach (DBTrackInfo video in videos) { playlist.Add(new PlayListItem(video)); } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; playlist.Shuffle(); Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } }
/// <summary> /// Playlist startingh with the least played videos /// </summary> private void playLeastPlayed() { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBTrackInfo> videos = DBTrackInfo.GetAll(); // Sort Most played first videos.Sort(delegate(DBTrackInfo p1, DBTrackInfo p2) { return(p1.UserSettings[0].WatchedCount.CompareTo(p2.UserSettings[0].WatchedCount)); }); // Now add to the list foreach (DBTrackInfo video in videos) { playlist.Add(new PlayListItem(video)); } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } }
/// <summary> /// Create a Random Playlist of All HD Videos /// </summary> private void playRandomHDAll() { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); List <DBTrackInfo> videos = DBTrackInfo.GetAll(); foreach (DBTrackInfo video in videos) { DBLocalMedia mediaInfo = (DBLocalMedia)video.LocalMedia[0]; if (mediaInfo.VideoResolution.StartsWith("1080") || mediaInfo.VideoResolution.StartsWith("720") || mediaInfo.VideoResolution.Equals("HD", StringComparison.OrdinalIgnoreCase)) { playlist.Add(new PlayListItem(video)); } } Player.playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MVCENTRAL; playlist.Shuffle(); Player.playlistPlayer.Play(0); if (mvCentralCore.Settings.AutoFullscreen) { GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } }
private async Task GetPlayList(string feedUrl) { try { await App.PopupService.StartLoading(); var stream = await ApiService.GetRrsStreamAsync(feedUrl); var result = DataService.ParsePodcastPlayList(stream); await App.PopupService.StopLoading(); PlayList.Clear(); foreach (var r in result) { PlayList.Add(r); } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } }
public bool Load(PlayList playlist, string fileName) { playlist.Clear(); XmlNodeList nodeEntries; if (!LoadXml(fileName, out nodeEntries)) { return false; } try { string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); foreach (XmlNode node in nodeEntries) { string file = ReadFileName(node); if (file == null) { return false; } string infoLine = ReadInfoLine(node, file); int duration = ReadLength(node); file = PathUtil.GetAbsolutePath(basePath, file); PlayListItem newItem = new PlayListItem(infoLine, file, duration); playlist.Add(newItem); } return true; } catch (Exception ex) { Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace); return false; } }
public static void Search(string k) { var searchedMaps = new List <string>(); var keyword = k.Trim().ToLower(); if (keyword.Length == 0) { PlayList.Clear(); Initplaylist(); } else { searchedMaps.AddRange(from beatmapSet in Allsets where beatmapSet.Value.tags.ToLower().Contains(keyword) select beatmapSet.Key); if (searchedMaps.Count == 0) { PlayList.Clear(); } else { PlayList.Clear(); PlayList.AddRange(searchedMaps.Distinct()); } } }
public bool Load(PlayList playlist, string fileName) { string extension = Path.GetExtension(fileName); extension.ToLowerInvariant(); playlist.Clear(); playlist.Name = Path.GetFileName(fileName); string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); Encoding fileEncoding = Encoding.Default; FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); StreamReader file = new StreamReader(stream, fileEncoding, true); string line = file.ReadLine(); if (line == null) { file.Close(); return false; } string strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); if (strLine != START_PLAYLIST_MARKER) { if (strLine.StartsWith("http") || strLine.StartsWith("HTTP") || strLine.StartsWith("mms") || strLine.StartsWith("MMS") || strLine.StartsWith("rtp") || strLine.StartsWith("RTP")) { PlayListItem newItem = new PlayListItem(strLine, strLine, 0); newItem.Type = PlayListItem.PlayListItemType.AudioStream; playlist.Add(newItem); file.Close(); return true; } fileEncoding = Encoding.Default; // No unicode??? rtv stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); file = new StreamReader(stream, fileEncoding, true); //file.Close(); //return false; } string infoLine = ""; string durationLine = ""; fileName = ""; line = file.ReadLine(); while (line != null) { strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); int equalPos = strLine.IndexOf("="); if (equalPos > 0) { string leftPart = strLine.Substring(0, equalPos); equalPos++; string valuePart = strLine.Substring(equalPos); leftPart = leftPart.ToLowerInvariant(); if (leftPart.StartsWith("file")) { if (valuePart.Length > 0 && valuePart[0] == '#') { line = file.ReadLine(); continue; } if (fileName.Length != 0) { PlayListItem newItem = new PlayListItem(infoLine, fileName, 0); playlist.Add(newItem); infoLine = ""; durationLine = ""; } fileName = valuePart; } if (leftPart.StartsWith("title")) { infoLine = valuePart; } else { if (infoLine == "") infoLine = Path.GetFileName(fileName); } if (leftPart.StartsWith("length")) { durationLine = valuePart; } if (leftPart == "playlistname") { playlist.Name = valuePart; } if (durationLine.Length > 0 && infoLine.Length > 0 && fileName.Length > 0) { int duration = System.Int32.Parse(durationLine); duration *= 1000; string tmp = fileName.ToLowerInvariant(); PlayListItem newItem = new PlayListItem(infoLine, fileName, duration); if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0) { SetupTv.Utils.GetQualifiedFilename(basePath, ref fileName); newItem.Type = PlayListItem.PlayListItemType.AudioStream; } playlist.Add(newItem); fileName = ""; infoLine = ""; durationLine = ""; } } line = file.ReadLine(); } file.Close(); if (fileName.Length > 0) { new PlayListItem(infoLine, fileName, 0); } return true; }
public bool Load(PlayList incomingPlaylist, string playlistFileName) { if (playlistFileName == null) { return false; } playlist = incomingPlaylist; playlist.Clear(); try { playlist.Name = Path.GetFileName(playlistFileName); basePath = Path.GetDirectoryName(Path.GetFullPath(playlistFileName)); using (file = new StreamReader(playlistFileName, Encoding.Default, true)) { if (file == null) { return false; } string line = file.ReadLine(); if (line == null || line.Length == 0) { return false; } string trimmedLine = line.Trim(); if (trimmedLine != M3U_START_MARKER) { string fileName = trimmedLine; if (!AddItem("", 0, fileName)) { return false; } } line = file.ReadLine(); while (line != null) { trimmedLine = line.Trim(); if (trimmedLine != "") { if (trimmedLine.StartsWith(M3U_INFO_MARKER)) { string songName = null; int lDuration = 0; if (ExtractM3uInfo(trimmedLine, ref songName, ref lDuration)) { line = file.ReadLine(); if (!AddItem(songName, lDuration, line)) { break; } } } else { if (!AddItem("", 0, trimmedLine)) { break; } } } line = file.ReadLine(); } } } catch (Exception ex) { Log.Info("exception loading playlist {0} err:{1} stack:{2}", playlistFileName, ex.Message, ex.StackTrace); return false; } return true; }
public bool Load(PlayList playlist, string fileName, string label) { string basePath = String.Empty; Stream stream; if (fileName.ToLowerInvariant().StartsWith("http")) { // We've got a URL pointing to a pls WebClient client = new WebClient(); client.Proxy.Credentials = CredentialCache.DefaultCredentials; byte[] buffer = client.DownloadData(fileName); stream = new MemoryStream(buffer); } else { // We've got a plain pls file basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); } playlist.Clear(); playlist.Name = Path.GetFileName(fileName); Encoding fileEncoding = Encoding.Default; StreamReader file = new StreamReader(stream, fileEncoding, true); try { if (file == null) { return false; } string line; line = file.ReadLine(); if (line == null) { file.Close(); return false; } string strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); if (strLine != START_PLAYLIST_MARKER) { if (strLine.StartsWith("http") || strLine.StartsWith("HTTP") || strLine.StartsWith("mms") || strLine.StartsWith("MMS") || strLine.StartsWith("rtp") || strLine.StartsWith("RTP")) { PlayListItem newItem = new PlayListItem(strLine, strLine, 0); newItem.Type = PlayListItem.PlayListItemType.AudioStream; playlist.Add(newItem); file.Close(); return true; } fileEncoding = Encoding.Default; stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); file = new StreamReader(stream, fileEncoding, true); //file.Close(); //return false; } string infoLine = ""; string durationLine = ""; fileName = ""; line = file.ReadLine(); while (line != null) { strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); int equalPos = strLine.IndexOf("="); if (equalPos > 0) { string leftPart = strLine.Substring(0, equalPos); equalPos++; string valuePart = strLine.Substring(equalPos); leftPart = leftPart.ToLowerInvariant(); if (leftPart.StartsWith("file")) { if (valuePart.Length > 0 && valuePart[0] == '#') { line = file.ReadLine(); continue; } if (fileName.Length != 0) { PlayListItem newItem = new PlayListItem(infoLine, fileName, 0); playlist.Add(newItem); fileName = ""; infoLine = ""; durationLine = ""; } fileName = valuePart; } if (leftPart.StartsWith("title")) { infoLine = valuePart; } else { if (infoLine == "") { // For a URL we need to set the label in for the Playlist name, in order to be played. if (label != null && fileName.ToLowerInvariant().StartsWith("http")) { infoLine = label; } else { infoLine = Path.GetFileName(fileName); } } } if (leftPart.StartsWith("length")) { durationLine = valuePart; } if (leftPart == "playlistname") { playlist.Name = valuePart; } if (durationLine.Length > 0 && infoLine.Length > 0 && fileName.Length > 0) { int duration = Int32.Parse(durationLine); // Remove trailing slashes. Might cause playback issues if (fileName.EndsWith("/")) { fileName = fileName.Substring(0, fileName.Length - 1); } PlayListItem newItem = new PlayListItem(infoLine, fileName, duration); if (fileName.ToLowerInvariant().StartsWith("http:") || fileName.ToLowerInvariant().StartsWith("https:") || fileName.ToLowerInvariant().StartsWith("mms:") || fileName.ToLowerInvariant().StartsWith("rtp:")) { newItem.Type = PlayListItem.PlayListItemType.AudioStream; } else { Util.Utils.GetQualifiedFilename(basePath, ref fileName); newItem.FileName = fileName; newItem.Type = PlayListItem.PlayListItemType.Audio; } playlist.Add(newItem); fileName = ""; infoLine = ""; durationLine = ""; } } line = file.ReadLine(); } file.Close(); if (fileName.Length > 0) { PlayListItem newItem = new PlayListItem(infoLine, fileName, 0); } } finally { if (file != null) { file.Close(); } } return true; }
public bool Load(PlayList incomingPlaylist, string playlistFileName) { if (playlistFileName == null) return false; playlist = incomingPlaylist; playlist.Clear(); XmlDocument doc = new XmlDocument(); try { doc.Load(playlistFileName); } catch (XmlException e) { logger.Info(string.Format("Cannot Load Playlist file: {0}", playlistFileName)); logger.Info(e.Message); return false; } string id = ""; string title = ""; string chapterid = ""; string filename = ""; try { playlist.Name = Path.GetFileName(playlistFileName); basePath = Path.GetDirectoryName(Path.GetFullPath(playlistFileName)); XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/Playlist"); if (nodeList == null) return false; foreach (XmlNode node in nodeList) { foreach (XmlNode itemNode in node.ChildNodes) { if (itemNode.Name == "Track") { foreach (XmlNode propertyNode in itemNode.ChildNodes) { string Value = propertyNode.InnerText; switch(propertyNode.Name) { case "ID" : id = Value; break; case "Title": title = Value; break; case "ChapterID": chapterid = Value; break; case "File": filename = Value; break; } } if (!AddItem(id, title, chapterid, filename)) return false; } } } } catch (Exception ex) { logger.Info(string.Format("exception loading playlist {0} err:{1} stack:{2}", playlistFileName, ex.Message, ex.StackTrace)); return false; } return true; }
public bool Load(PlayList playlist, string fileName, string label) { string basePath = String.Empty; Stream stream; if (fileName.ToLower().StartsWith("http")) { // We've got a URL pointing to a pls WebClient client = new WebClient(); client.Proxy.Credentials = CredentialCache.DefaultCredentials; byte[] buffer = client.DownloadData(fileName); stream = new MemoryStream(buffer); } else { // We've got a plain pls file basePath = Path.GetDirectoryName(Path.GetFullPath(fileName)); stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); } playlist.Clear(); playlist.Name = Path.GetFileName(fileName); Encoding fileEncoding = Encoding.Default; StreamReader file = new StreamReader(stream, fileEncoding, true); if (file == null) { stream.Close(); return(false); } string line; line = file.ReadLine(); if (line == null) { stream.Close(); file.Close(); return(false); } string strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); if (strLine != START_PLAYLIST_MARKER) { if (strLine.StartsWith("http") || strLine.StartsWith("HTTP") || strLine.StartsWith("mms") || strLine.StartsWith("MMS") || strLine.StartsWith("rtp") || strLine.StartsWith("RTP")) { PlayListItem newItem = new PlayListItem(strLine, strLine, 0); newItem.Type = PlayListItem.PlayListItemType.AudioStream; playlist.Add(newItem); stream.Close(); file.Close(); return(true); } fileEncoding = Encoding.Default; stream.Close(); file.Close(); stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); file = new StreamReader(stream, fileEncoding, true); //file.Close(); //return false; } string infoLine = ""; string durationLine = "-1"; fileName = ""; line = file.ReadLine(); while (line != null) { strLine = line.Trim(); //CUtil::RemoveCRLF(strLine); int equalPos = strLine.IndexOf("="); if (equalPos > 0) { string leftPart = strLine.Substring(0, equalPos); equalPos++; string valuePart = strLine.Substring(equalPos); leftPart = leftPart.ToLower(); if (leftPart.StartsWith("file")) { if (valuePart.Length > 0 && valuePart[0] == '#') { line = file.ReadLine(); continue; } if (fileName.Length != 0) { PlayListItem newItem = new PlayListItem(infoLine, fileName, 0); playlist.Add(newItem); fileName = ""; infoLine = ""; durationLine = "-1"; } fileName = valuePart; } if (leftPart.StartsWith("title")) { infoLine = valuePart; } else { if (infoLine == "") { // For a URL we need to set the label in for the Playlist name, in order to be played. if (label != null && fileName.ToLower().StartsWith("http")) { infoLine = label; } else { infoLine = fileName; } } } if (leftPart.StartsWith("length")) { durationLine = valuePart; } if (leftPart == "playlistname") { playlist.Name = valuePart; } if (infoLine.Length > 0 && fileName.Length > 0) { int duration = Int32.Parse(durationLine); // Remove trailing slashes. Might cause playback issues if (fileName.EndsWith("/")) { fileName = fileName.Substring(0, fileName.Length - 1); } PlayListItem newItem = new PlayListItem(infoLine, fileName, duration); if (fileName.ToLower().StartsWith("http:") || fileName.ToLower().StartsWith("https:") || fileName.ToLower().StartsWith("mms:") || fileName.ToLower().StartsWith("rtp:")) { newItem.Type = PlayListItem.PlayListItemType.AudioStream; } else { Utils.GetQualifiedFilename(basePath, ref fileName); newItem.FileName = fileName; newItem.Type = PlayListItem.PlayListItemType.Audio; } playlist.Add(newItem); fileName = ""; infoLine = ""; durationLine = "0"; } } line = file.ReadLine(); } stream.Close(); file.Close(); if (fileName.Length > 0) { PlayListItem newItem = new PlayListItem(infoLine, fileName, 0); } return(true); }
public bool Load(PlayList incomingPlaylist, string playlistFileName) { if (playlistFileName == null) return false; playlist = incomingPlaylist; playlist.Clear(); try { playlist.Name = Path.GetFileName(playlistFileName); basePath = Path.GetDirectoryName(Path.GetFullPath(playlistFileName)); using (file = new StreamReader(playlistFileName)) { if (file == null) return false; string line = file.ReadLine(); if (string.IsNullOrEmpty(line)) return false; string trimmedLine = line.Trim(); if (trimmedLine != M3U_START_MARKER) { string fileName = trimmedLine; if (!AddItem("", 0, fileName)) return false; } line = file.ReadLine(); while (line != null) { trimmedLine = line.Trim(); if (trimmedLine != "") { if (trimmedLine.StartsWith(M3U_INFO_MARKER)) { string songName = null; int lDuration = 0; if (ExtractM3uInfo(trimmedLine, ref songName, ref lDuration)) { line = file.ReadLine(); if (!AddItem(songName, lDuration, line)) break; } } else { if (!AddItem("", 0, trimmedLine)) break; } } line = file.ReadLine(); } } } catch (Exception) { return false; } return true; }
/// <summary> /// clear the current playlist /// </summary> private void ClearPlaylist() { PlayList playlist = Player.playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MVCENTRAL); playlist.Clear(); }
public void BackGroundDoPlay(object param_) { PlayParams param = (PlayParams)param_; YouTubeEntry vid = param.vid; bool fullscr = param.fullscr; GUIFacadeControl facade = param.facade; if (vid != null) { GUIWaitCursor.Hide(); VideoInfo qa = SelectQuality(vid); if (qa.Quality == VideoQuality.Unknow) { Youtube2MP.PlayBegin = false; return; } GUIWaitCursor.Show(); Youtube2MP.temp_player.Reset(); Youtube2MP.temp_player.RepeatPlaylist = true; Youtube2MP.temp_player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC_VIDEO; PlayList playlist = Youtube2MP.temp_player.GetPlaylist(PlayListType.PLAYLIST_MUSIC_VIDEO); playlist.Clear(); g_Player.PlayBackStopped -= g_Player_PlayBackStopped; g_Player.PlayBackEnded -= g_Player_PlayBackEnded; g_Player.PlayBackStopped += g_Player_PlayBackStopped; g_Player.PlayBackEnded += g_Player_PlayBackEnded; int selected = 0; if (facade != null) { int dif = 0; qa.Items = new Dictionary <string, string>(); if (facade[0].IsFolder) { dif++; } selected = facade.SelectedListItemIndex - dif; for (int i = 0; i < facade.Count; i++) { try { AddItemToPlayList(facade[i], ref playlist, new VideoInfo(qa), false); } catch (Exception ex) { Log.Error(ex); } } } else { AddItemToPlayList(vid, ref playlist, qa, -1); Youtube2MP.temp_player.RepeatPlaylist = false; } PlayListPlayer.SingletonPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; Youtube2MP.player.CurrentPlaylistType = PlayListType.PLAYLIST_NONE; g_Player.Stop(); Youtube2MP.temp_player.Play(selected); GUIWaitCursor.Hide(); if (g_Player.Playing && fullscr) { if (_setting.ShowNowPlaying) { if (GUIWindowManager.ActiveWindow != 29052) { GUIWindowManager.ActivateWindow(29052); } } else { g_Player.ShowFullScreenWindow(); } } if (!g_Player.Playing) { Err_message("Unable to playback the item ! "); } } GUIWaitCursor.Hide(); Youtube2MP.PlayBegin = false; }
private void PlaylistClear() { View?.SetPage(TabPage.PlayList); PlayList.Clear(); PlayListIndex = -1; }