public static ImageSource GetArtistArt() { if (CoreMain.CurrentTrack.Artist == "Unknown Artist") { return(null); } ImageSource ims = Bitmap.GetImage(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Safire\ArtistData\" + CoreMain.CurrentTrack.Artist + ".jpg");; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Safire\ArtistData\" + CoreMain.CurrentTrack.Artist + ".jpg")) { return(ims); } else { if (Properties.Settings.Default.GetArtistImages) { var t = ImageDownloader.RequestLastfm(CoreMain.CurrentTrack.Album, CoreMain.CurrentTrack.Artist, "artist.getinfo"); if (t != null) { return(t); } } TaglibCore tgl = new TaglibCore(); tgl.loadfile(CoreMain.CurrentTrack.Path); return(tgl.getArtFrame()); } }
public static ImageSource GetAlbumArt(TrackViewModel tracky) { if (tracky.Artist == "Unknown Artist" | tracky.Album == "Unknown Album") { Bitmap.GetImage("resources\\unknown.png"); } ImageSource ims = Bitmap.GetImage(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Safire\AlbumData\" + tracky.Album + " - " + tracky.Artist + ".jpg");; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Safire\AlbumData\" + tracky.Album + " - " + tracky.Artist + ".jpg")) { return(ims); } else { TaglibCore tgl = new TaglibCore(); tgl.loadfile(tracky.Path); var p = tgl.getArtFrame(); if (p != null) { return(p); } else { if (Properties.Settings.Default.GetAlbumArt) { var t = ImageDownloader.RequestLastfm(tracky.Album, tracky.Artist, "album.getinfo"); if (t != null) { return(t); } } return(Bitmap.GetImage(Main.MyPath() + "\\resources\\unknown.png")); } } }
public override void Draw(DrawingContext dc) { if (Player.Instance.Wave == null) { return; } var imb = new ImageBrush(Bitmap.GetImage(Main.MyPath() + "\\dbak.ee")); imb.Stretch = Stretch.UniformToFill; dc.DrawRectangle(imb, new Pen(null, 0), new Rect(0, 0, BlinkG.ActualWidth, BlinkG.ActualHeight)); double w = (BlinkG.ActualWidth / 2) - 50 - (200); double h = (BlinkG.ActualHeight / 2) - 100; //transparent rect dc.DrawRectangle(new SolidColorBrush(Color.FromArgb(90, 0, 0, 0)), new Pen(new SolidColorBrush(Color.FromArgb(10, 0, 0, 0)), 0), new Rect(0, h, BlinkG.ActualWidth, 200)); //Image ImageSource img1 = mw.AlbArt.Source; if (img1 == null) { img1 = mw.ArtistArt.Source; } var imr = new Rect(new Point(w, h), new Size(200, 200)); dc.DrawImage(img1, imr); var tpfs = mw.FontFamily; var tpfu = tpfs.GetTypefaces().First(); var tpf = new Typeface("Segoe UI Light"); //title if (Core.CoreMain.CurrentTrack != null && Core.CoreMain.CurrentTrack.Title != null && !Player.Instance.NetStreamingConfigsLoaded) { var ft = new FormattedText(Core.CoreMain.CurrentTrack.Title, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 45, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 65; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2, (base.BlinkG.ActualHeight) / 2 - 80)); //artist ft = new FormattedText(Core.CoreMain.CurrentTrack.Artist, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 25, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 - 30)); //album ft = new FormattedText(Core.CoreMain.CurrentTrack.Album, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 16, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 4)); //user if (!string.IsNullOrEmpty(LastFm.GetRealName()) && Properties.Settings.Default.Scrobble) { ft = new FormattedText("\uef55 ", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, tpfu, 14, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 82)); ft = new FormattedText(LastFm.GetRealName(), CultureInfo.InvariantCulture, FlowDirection.LeftToRight, tpf, 12, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 25, (base.BlinkG.ActualHeight) / 2 + 80)); } } if (Player.Instance.NetStreamingConfigsLoaded && CoreMain.CurrentNetStreamTrack != null) { var ft = new FormattedText(Core.CoreMain.CurrentNetStreamTrack.Title, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 45, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 65; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2, (base.BlinkG.ActualHeight) / 2 - 80)); //artist ft = new FormattedText(((!String.IsNullOrEmpty(CoreMain.CurrentNetStreamTrack.Artist) ? CoreMain.CurrentNetStreamTrack.Artist : CoreMain.CurrentNetStreamTrack.Bitrate.ToString())), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 25, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 - 30)); //album ft = new FormattedText("Radio", CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tpf, 16, Brushes.White); ft.Trimming = TextTrimming.CharacterEllipsis; ft.MaxTextWidth = (base.BlinkG.ActualWidth / 2) - 50; ft.MaxTextHeight = 50; dc.DrawText(ft, new Point((base.BlinkG.ActualWidth) / 2 + 5, (base.BlinkG.ActualHeight) / 2 + 4)); } }