private async void PlayVideo_Click(object sender, RoutedEventArgs e) { VideoArea.Visibility = Visibility.Visible; await VideoArea.Fade(value : 1.0f, duration : 500, delay : 0, easingType : EasingType.Default).StartAsync(); if (VideoPlayer.Source == null) { // find first song mv string url = Creeper.GetFromiTunes(Songlist[0].name); if (url != "novideo") { VideoPlayer.Source = MediaSource.CreateFromUri(new Uri(url)); App.OnePlayerArea.WantPause(true); } // else search singer else if (HolderSinger != "NullSinger") { url = Creeper.GetFromiTunes(HolderSinger); if (url != "novideo") { VideoPlayer.Source = MediaSource.CreateFromUri(new Uri(url)); App.OnePlayerArea.WantPause(true); } } // no video } }
void initsingers() { if (App.SingerPageSingers == null) //first navigated to this page { App.SingerPageSingers = Creeper.GetSingers(); } singerList = App.SingerPageSingers; }
private async void StartSearch(string searchkey) { pr_ProgressRing1.IsActive = true; App.SearchDataToShow = Creeper.GetSearchResult(searchkey); await Task.Delay(1); NavigationViewItem newitem = new NavigationViewItem(); LeftPole.MenuItems.Add(newitem); newitem.Tag = "App1.SearchPage"; LeftPole.SelectedItem = newitem; LeftPole.MenuItems.Remove(newitem); pr_ProgressRing1.IsActive = false; }
public void SetInfoByRef(Song song, bool autoplay = false) { SongOwned = song; if (PlayArea.Height < DefaultHeight && First) { expandplayarea(); First = false; } AlbumCoverImage.Source = new BitmapImage(new Uri(song.album_url, UriKind.Absolute)); BackImage.Source = AlbumCoverImage.Source; SongPLayingName.Text = song.name; SongPLayingSingerName.Text = song.singers; PlayProcess.Maximum = song.timeint; PlayProcess.Value = 0; _mediaTimelineController.Pause(); WholeTime.Text = "/" + song.interval; NowTime.Text = "0:00"; PlayAndPause.Icon = new SymbolIcon(Symbol.Play); MusicRes = "shit"; //symbol string Songmid = song.songmid; LyricArea.GetLyrics(Songmid); var t = new Thread(() => MusicRes = Creeper.GetSongResourseURL(Songmid)); t.Start(); // switch song if (App.Musicplayer.Source != null) { App.Musicplayer.Source = null; if (App.Musicplayer.PlaybackSession.PlaybackState == MediaPlaybackState.Playing) //is playing { App.Musicplayer.TimelineControllerPositionOffset = TimeSpan.FromSeconds(0); } PrepareSourse(); } else if (autoplay) { PrepareSourse(); } }
private void InitHotSongs(string id) { int index = Convert.ToInt32(id); songlistindex = index; Invoke(() => { if (App.SongPageHotSongLists[index] == null) { //update UI code App.SongPageHotSongLists[index] = Creeper.GetTopSongs(types[index], topids[index]); HotSongsArea.ItemsSource = App.SongPageHotSongLists[index]; } else { HotSongsArea.ItemsSource = App.SongPageHotSongLists[index]; } }); }
void Initdata() { Songlist = App.SearchDataToShow.SearchResult; Dictionary <string, string> infoToShow = App.SearchDataToShow.infomation; switch (infoToShow["infotype"]) { case "1": //singer if (!infoToShow.ContainsKey("introduce")) { infoToShow.Add("introduce", Creeper.GetShortIntro(infoToShow["singerMID"])); } HolderSinger = infoToShow["singerName"].ToString(); InfoDisplay.setinfo(infoToShow["singerName"], infoToShow["singerPic"], infoToShow["introduce"]); InfoDisplay.setsinger(infoToShow["songNum"], infoToShow["albumNum"], infoToShow["mvNum"]); break; case "2": //album InfoDisplay.setinfo(infoToShow["albumName"], infoToShow["albumPic"], "发行时间:" + infoToShow["publicTime"]); InfoDisplay.setfooter(infoToShow["singerName"]); break; case "4": //tv InfoDisplay.setinfo(infoToShow["singerName"], infoToShow["singerPic"]); break; case "8": //song InfoDisplay.setinfo(infoToShow["title"], infoToShow["pic"], "发行时间:" + infoToShow["publish_date"]); InfoDisplay.setfooter(infoToShow["desc"]); break; default: InfoDisplay.Visibility = Visibility.Collapsed; break; } if (InfoDisplay.Visibility == Visibility.Visible) { Thread th = new Thread(StoreHistoryData); th.Start(); } }
public MainPage() { this.InitializeComponent(); UpdateStatusBarMessage.OnNewStatusMessage += UpdateStatusBarMessage_OnNewStatusMessage; loadconfigdata(); App.OnePlayerArea = playarea; Window.Current.SetTitleBar(RealTitleBar); // get jiading weather Invoke(() => { try { WeatherText.Text = Creeper.GetWeather(); } catch (Exception) { } try { GetPermission = Creeper.Get("http://111.231.107.125:9000/permission") == "ok"; } catch (Exception) { } }); }
public void GetLyrics(string songmid) { lyricsIndex = 0; mylove = 0; if (keyframes.Count > 0)// 切歌了,清空容器 { keyframes.Clear(); Lyrics.Children.Clear(); ScrollContainer.ChangeView(1, 0, 1); } Lyrics.Children.Add(HeadText = new TextBlock()); HeadText.Height = ScrollContainer.ActualHeight / 2; Invoke(() => { List <string> Result = Creeper.GetLyrics(songmid); //Result[0]是原版,Result[1]是翻译版 var lyrics = Result[0].Split(Environment.NewLine.ToCharArray()); string Title, Artist, Album, LrcBy, Offset; foreach (var line in lyrics) { if (line.StartsWith("[ti:")) { Title = line.Substring(line.IndexOf(":") + 1).TrimEnd(']'); } else if (line.StartsWith("[ar:")) { Artist = line.Substring(line.IndexOf(":") + 1).TrimEnd(']'); } else if (line.StartsWith("[al:")) { Album = line.Substring(line.IndexOf(":") + 1).TrimEnd(']'); } else if (line.StartsWith("[by:")) { LrcBy = line.Substring(line.IndexOf(":") + 1).TrimEnd(']'); } else if (line.StartsWith("[offset:")) { Offset = line.Substring(line.IndexOf(":") + 1).TrimEnd(']'); } else { try { Regex regexword = new Regex(@".*\](.*)"); Match mcw = regexword.Match(line); string word = mcw.Groups[1].Value; if (word.Length != 0) { Regex regextime = new Regex(@"\[([0-9.:]*)\]", RegexOptions.Compiled); MatchCollection mct = regextime.Matches(line); foreach (Match item in mct) { // day double time = TimeSpan.Parse("00:" + item.Groups[1].Value).TotalSeconds; // item.Groups[1].Value 00:40.44 keyframes.Add(time); // 更新 UI,填入歌词 Lyrics.Children.Add(new TextBlock { Text = word, HorizontalAlignment = HorizontalAlignment.Center }); } } } catch { continue; } } } keyframes.Add(99999.9); Lyrics.Children.Add(FootText = new TextBlock()); }); }