public override void Play(SearchResultItem resultItem) { YouTubeEntry entry = resultItem.MetaData["entry"] as YouTubeEntry; YoutubeGUIBase.SetLabels(entry, "NowPlaying"); Youtube2MP.NowPlayingEntry = entry; VideoInfo info = new VideoInfo(); g_Player.PlayVideoStream(Youtube2MP.StreamPlaybackUrl(entry, info)); if (g_Player.Playing) { if (Youtube2MP._settings.ShowNowPlaying) { GUIWindowManager.ActivateWindow(29052); } else { g_Player.ShowFullScreenWindow(); } } if (!g_Player.Playing) { GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); if (dlgOK != null) { dlgOK.SetHeading(25660); dlgOK.SetLine(1, "Unable to playback the item ! "); dlgOK.SetLine(2, ""); dlgOK.DoModal(GUIWindowManager.ActiveWindow); } } }
public static GenericListItem YouTubeEntry2ListItem(YouTubeEntry youTubeEntry) { GenericListItem item = new GenericListItem() { Title = youTubeEntry.Title.Text, IsFolder = false, LogoUrl = YoutubeGUIBase.GetBestUrl(youTubeEntry.Media.Thumbnails), Tag = youTubeEntry }; if (youTubeEntry.Duration != null) { item.Duration = Convert.ToInt32(youTubeEntry.Duration.Seconds, 10); } item.Title2 = Utils.SecondsToHMSString(item.Duration); return(item); }