void Worker_Youtube_DoWork(object sender, DoWorkEventArgs e) { try { Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + Youtube2MP.GetVideoId(YouTubeEntry)); Video video = Youtube2MP.request.Retrieve <Video>(videoEntryUrl); Feed <Comment> comments = Youtube2MP.request.GetComments(video); string cm = "\n------------------------------------------\n"; foreach (Comment c in comments.Entries) { cm += c.Author + " : " + c.Content + "------------------------------------------\n"; } GUIPropertyManager.SetProperty("#Youtube.fm.Info.Video.Comments", cm); string vidimg = GetBestUrl(YouTubeEntry.Media.Thumbnails); string vidfile = Youtube2MP.GetLocalImageFileName(vidimg); if (!string.IsNullOrEmpty(vidimg)) { if (!File.Exists(vidfile)) { GUIPropertyManager.SetProperty("#Youtube.fm.Info.Video.Image", " "); Youtube2MP.DownloadFile(vidimg, vidfile); } } GUIPropertyManager.SetProperty("#Youtube.fm.Info.Video.Image", vidfile); } catch (Exception exception) { Log.Error(exception); } }
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); } }