public static VideoItem FromSerachItem(SearchItem item) { return new VideoItem(item); }
public VideoItem(SearchItem item) // from search { InitializeComponent(); id = item.id; origin = ""; tagAlbum = ""; report = false; downloadUrl = item.downloadUrl; outputFormat = Settings.GetPrefferedOutputFormat(); title = item.title; desc = item.desc; ProgressYoutubeExtraction.Visibility = Visibility.Visible; suggestions = new SuggestedTagsPackage(); CheckTrimRemovalButtons(); Task.Run(async () => { if(downloadUrl == null) PopulateVideoDownloadInfo(); await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { VideoThumb.Source = new BitmapImage(new Uri(item.thumbUrl)); VideoTitle.Text = title; VideoAuthor.Text = item.author; thumbUrl = item.thumbDownloadUrl; if (Settings.GetBoolSettingValueForKey(Settings.PossibleSettingsBool.SETTING_AUTO_COVER)) AlbumCoverPath = thumbUrl; LoadingInfo.Visibility = Visibility.Collapsed; }); }); if (_outputFormat != Settings.PossibleOutputFormats.FORMAT_MP3 || !Settings.GetBoolSettingValueForKey(Settings.PossibleSettingsBool.SETTING_PARSE_TAGS)) return; try { suggestions = TagParser.AttemptToParseTags(title, desc, "", item.author); tagArtist = suggestions.suggestedAuthor != "" ? suggestions.suggestedAuthor : item.author; if (suggestions.suggestedTitle != "") tagTitle = suggestions.suggestedTitle; } catch (Exception exce) { Debug.WriteLine(exce.Message); } }