示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            HTBFanArt fanart = new HTBFanArt();

            fanart.Search(textBox3.Text);
        }
示例#2
0
        void updateStationLogoTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            backgroundWorker.RunWorkerAsync();
            WebClient fanartclient = new WebClient();

            try
            {
                infoTimer.Enabled = false;
                lock (locker)
                {
                    string file = GetFanArtImage(GUIPropertyManager.GetProperty("#Youtube.fm.NowPlaying.Artist.Name").Trim());

                    if (File.Exists(file))
                    {
                        GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                    }
                    else
                    {
                        if (Youtube2MP._settings.LoadOnlineFanart)
                        {
                            HTBFanArt fanart = new HTBFanArt();
                            if (!File.Exists(file))
                            {
                                fanart.Search(GUIPropertyManager.GetProperty("#Youtube.fm.NowPlaying.Artist.Name").Trim());
                                if (fanart.ImageUrls.Count > 0)
                                {
                                    Log.Debug("Youtube.Fm fanart download {0} to {1}  ", fanart.ImageUrls[0].Url, file);
                                    fanartclient.DownloadFile(fanart.ImageUrls[0].Url, file);
                                    GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                                }
                            }
                            else
                            {
                                GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                            }
                        }
                    }

                    if (Youtube2MP.NowPlayingEntry != null)
                    {
                        Uri videoEntryUrl =
                            new Uri("http://gdata.youtube.com/feeds/api/videos/" + Youtube2MP.GetVideoId(Youtube2MP.NowPlayingEntry));
                        Video video = Youtube2MP.request.Retrieve <Video>(videoEntryUrl);
                        GUIPropertyManager.SetProperty("#Play.Current.PlotOutline", video.Description);
                        try
                        {
                            Feed <Comment> comments = Youtube2MP.request.GetComments(video);
                            string         cm       = "\n------------------------------------------\n";
                            foreach (Comment c in comments.Entries)
                            {
                                cm += c.Author + " : " + c.Content + "\n------------------------------------------\n";
                            }
                            GUIPropertyManager.SetProperty("#Play.Current.Plot", video.Description + cm);
                            GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.Comments", video.Description + cm);
                        }
                        catch (Exception ex)
                        {
                            //Log.Error(ex);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }
示例#3
0
        void updateStationLogoTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (imgFanArt != null)
            {
                imgFanArt.Visible = false;
            }
            infoTimer.Enabled = false;
            if (Youtube2MP.NowPlayingSong != null)
            {
                Log.Debug("Youtube.Fm load fanart");
                GUIPropertyManager.SetProperty("#Play.Current.Title", Youtube2MP.NowPlayingSong.Title);
                GUIPropertyManager.SetProperty("#Play.Current.Artist", Youtube2MP.NowPlayingSong.Artist);
                GUIPropertyManager.SetProperty("#Play.Current.Thumb", GetBestUrl(Youtube2MP.NowPlayingEntry.Media.Thumbnails));

                LoadRelatated();
                HTBFanArt fanart = new HTBFanArt();
                string    file   = Youtube2MP._settings.FanartDir.Replace("%artist%", Youtube2MP.NowPlayingSong.Artist);

                if (File.Exists(file) && imgFanArt != null)
                {
                    Log.Debug("Youtube.Fm local fanart {0} loaded ", file);
                    imgFanArt.Visible  = true;
                    imgFanArt.FileName = file;
                    imgFanArt.DoUpdate();
                    return;
                }

                if (!Youtube2MP._settings.LoadOnlineFanart)
                {
                    return;
                }

                file = GetFanArtImage(Youtube2MP.NowPlayingSong.Artist);
                if (!File.Exists(file))
                {
                    fanart.Search(Youtube2MP.NowPlayingSong.Artist);
                    Log.Debug("Youtube.Fm found {0} online fanarts for {1}", fanart.ImageUrls.Count, Youtube2MP.NowPlayingSong.Artist);
                    if (fanart.ImageUrls.Count > 0)
                    {
                        Log.Debug("Youtube.Fm fanart download {0} to {1}  ", fanart.ImageUrls[0].Url, file);
                        Client.DownloadFile(fanart.ImageUrls[0].Url, file);
                        GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                        Log.Debug("Youtube.Fm fanart {0} loaded ", file);
                        imgFanArt.Visible  = true;
                        imgFanArt.FileName = file;
                        imgFanArt.DoUpdate();
                    }
                    else
                    {
                        imgFanArt.Visible = false;
                    }
                }
                else
                {
                    GUIPropertyManager.SetProperty("#Youtube.fm.NowPlaying.Video.FanArt", file);
                    imgFanArt.Visible  = true;
                    imgFanArt.FileName = file;
                    imgFanArt.DoUpdate();
                }
                GUIControl.FocusControl(GetID, listControl.GetID);
            }
            else
            {
                Log.Error("Youtube.Fm fanart NowPlaying not defined");
                imgFanArt.Visible = false;
            }
        }
示例#4
0
        void Worker_FanArt_DoWork(object sender, DoWorkEventArgs e)
        {
            if (string.IsNullOrEmpty(GUIPropertyManager.GetProperty("#Youtube.fm.Info.Artist.Name").Trim()))
            {
                return;
            }
            try
            {
                string file = GetFanArtImage(GUIPropertyManager.GetProperty("#Youtube.fm.Info.Artist.Name"));

                if (File.Exists(file) && imgFanArt != null)
                {
                    Log.Debug("Youtube.Fm local fanart {0} loaded ", file);
                    imgFanArt.Visible  = true;
                    imgFanArt.FileName = file;
                    imgFanArt.DoUpdate();
                    return;
                }

                if (Youtube2MP._settings.LoadOnlineFanart && !Client.IsBusy)
                {
                    HTBFanArt fanart = new HTBFanArt();
                    //file = GetFanArtImage(GUIPropertyManager.GetProperty("#Youtube.fm.Info.Artist.Name"));
                    if (!File.Exists(file))
                    {
                        fanart.Search(GUIPropertyManager.GetProperty("#Youtube.fm.Info.Artist.Name"));
                        Log.Debug("Youtube.Fm found {0} online fanarts for {1}", fanart.ImageUrls.Count,
                                  GUIPropertyManager.GetProperty("#Youtube.fm.Info.Artist.Name"));
                        if (fanart.ImageUrls.Count > 0)
                        {
                            Log.Debug("Youtube.Fm fanart download {0} to {1}  ", fanart.ImageUrls[0].Url, file);
                            Youtube2MP.DownloadFile(fanart.ImageUrls[0].Url, file);
                            GUIPropertyManager.SetProperty("#Youtube.fm.Info.Video.FanArt", file);
                            Log.Debug("Youtube.Fm fanart {0} loaded ", file);
                            if (imgFanArt != null)
                            {
                                imgFanArt.Visible  = true;
                                imgFanArt.FileName = file;
                                imgFanArt.DoUpdate();
                            }
                        }
                        else
                        {
                            if (imgFanArt != null)
                            {
                                imgFanArt.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        GUIPropertyManager.SetProperty("#Youtube.fm.Info.Video.FanArt", file);
                        if (imgFanArt != null)
                        {
                            imgFanArt.Visible  = true;
                            imgFanArt.FileName = file;
                            imgFanArt.DoUpdate();
                        }
                    }
                }
                else
                {
                    if (imgFanArt != null)
                    {
                        imgFanArt.Visible = false;
                    }
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }