public async Task Initialize() { Artists.Clear(); Albums.Clear(); Tracks.Clear(); TrackCollections.Clear(); Videos.Clear(); CameraRoll.Clear(); Shows.Clear(); if (_alreadyIndexedOnce) { return; } _alreadyIndexedOnce = true; // Doing full indexing from scratch if 0 tracks are found if (IsMusicDatabaseEmpty() && IsVideoDatabaseEmpty()) { ClearDatabase(); } else // Restore the database { LoadVideosFromDatabase(); await LoadShowsFromDatabase(); LoadCameraRollFromDatabase(); } await PerformMediaLibraryIndexing(); }
async Task ExecuteLoadVideosCommand(bool forceRefresh = true) { if (IsBusy) { return; } if (!forceRefresh && Videos.Count > 0) { return; } IsBusy = true; try { Videos.Clear(); var items = await DataSource.GetItemsAsync(); foreach (var item in items) { Videos.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
void ClearDatabase() { musicDatabase.DeleteAll(); musicDatabase.DeleteAll(); musicDatabase.DeleteAll(); trackCollectionRepository.DeleteAll(); tracklistItemRepository.DeleteAll(); musicDatabase.Initialize(); musicDatabase.Initialize(); musicDatabase.Initialize(); trackCollectionRepository.Initialize(); tracklistItemRepository.Initialize(); Artists.Clear(); Albums.Clear(); Tracks.Clear(); TrackCollections.Clear(); videoDatabase.DeleteAll(); Videos.Clear(); CameraRoll.Clear(); Shows.Clear(); }
public void Load(IEnumerable <QueryResult> videos) { SelectedVideos.Clear(); Videos.Clear(); Videos.AddRange(videos.Select(_videoFactory.MakeMatchedVideoViewModel)); }
private void LoadData(IThumbnailGenerator thumbnailGenerator) { List <string> allVideoUrls = new List <string>(); foreach (var path in _statusResourcesPaths) { if (Directory.Exists(path)) { var files = Directory.GetFiles(path).Where(x => x.EndsWith(".mp4")); allVideoUrls.AddRange(files); } } Videos.Clear(); foreach (string url in allVideoUrls) { Videos.Add(new Video { ImageCachePath = thumbnailGenerator.GenerateThumbnailAsPath(url, 1000, _appCachePath), ImageSource = null,/*thumbnailGenerator.GenerateThumbnail(url, 1000),*/ Path = url, BackgroundColor = _unselectedStateColor }); } }
public override async Task Reload() { const string url = "http://www.nicovideo.jp/api/deflist/list"; var json = await GetJsonAsync(url); Videos.Clear(); foreach (dynamic item in json["mylistitem"]) { var video = VideoStatusModel.Instance.GetVideo((string)item["item_id"]); video.VideoUrl = item["item_id"]; video.Title = item["item_data"]["title"]; video.Description = item["description"]; //video.Tags = data["tags"]; //video.CategoryTag = data["categoryTags"]; video.ViewCounter = long.Parse(item["item_data"]["view_counter"]); video.MylistCounter = long.Parse(item["item_data"]["mylist_counter"]); video.CommentCounter = long.Parse(item["item_data"]["num_res"]); video.StartTime = NicoDataConverter.FromUnixTime((long)item["item_data"]["first_retrieve"]); //video.LastCommentTime = Converter.item(data["lastCommentTime"]); video.LengthSeconds = long.Parse(item["item_data"]["length_seconds"]); video.ThumbnailUrl = item["item_data"]["thumbnail_url"]; video.LastResBody = item["item_data"]["last_res_body"]; //video.CommunityIcon = data["communityIcon"]; Videos.Add(video.VideoId); } }
public async Task <bool> FormatDeviceAsync() { EventImages.Clear(); EventVideos.Clear(); Videos.Clear(); return(await DeviceInstance.FormatAsync()); }
/// <summary> /// Vide les propriétés de navigation. /// </summary> protected virtual void ClearNavigationProperties() { Actions.Clear(); Creator = null; LastModifier = null; Videos.Clear(); CloudFile = null; DocumentationActionDrafts.Clear(); }
/// <summary> /// Searches for a YouTube /// </summary> private async void Search() { var result = await youtube.SearchYoutubeVideo(SearchText); Videos.Clear(); foreach (var video in result) { Videos.Add(video); } }
public void Clear() { CurrentVideoId = null; CurrentVideo = null; NextVideo = null; JumpVideo = null; JumpVideoId = null; Videos?.Clear(); OtherVideos?.Clear(); Mylists?.Clear(); }
internal void UpdateFeedResult(IList <NicoVideo> result, DateTime updatedAt) { Videos.Clear(); foreach (var video in result.Select(x => new VideoListItemControlViewModel(x))) { Videos.Add(video); } LastUpdatedAt = updatedAt; }
public async void PopulateVideos() { // Clear existing videos Videos.Clear(); // Add new videos var task = tvChannel9.Data.RssReader.ParseVideoRss("https://s.ch9.ms/Events/dotnetConf/2017/rss/mp4"); task.GetAwaiter().OnCompleted(ViewController.ReloadData); var videos = await task; Videos = videos.Select(s => new VideoItem(s)).ToList(); }
public override async Task Reload() { if (string.IsNullOrWhiteSpace(Word)) { ServiceFactory.MessageService.Error("検索ワードが入力されていません。"); return; } Videos.Clear(); string targets = IsTag ? "tagsExact" : "title,description,tags"; string q = NicoDataConverter.ToUrlEncode(Word); string fields = "contentId,title,description,tags,categoryTags,viewCounter,mylistCounter,commentCounter,startTime,lastCommentTime,lengthSeconds,thumbnailUrl"; string offset = Offset.ToString(); string limit = Limit.ToString(); string context = "kaz.server-on.net/NicoV4"; string sort = OrderBy; string url = String.Format("http://api.search.nicovideo.jp/api/v2/video/contents/search?q={0}&targets={1}&fields={2}&_sort={3}&_offset={4}&_limit={5}&_context={6}", q, targets, fields, sort, offset, limit, context ); // TODO 入力チェック var json = await GetJsonAsync(url); Videos.Clear(); foreach (dynamic data in json["data"]) { var video = VideoStatusModel.Instance.GetVideo(NicoDataConverter.ToId(data["contentId"])); video.Title = data["title"]; video.Description = data["description"]; video.Tags = data["tags"]; video.CategoryTag = data["categoryTags"]; video.ViewCounter = data["viewCounter"]; video.MylistCounter = data["mylistCounter"]; video.CommentCounter = data["commentCounter"]; video.StartTime = NicoDataConverter.ToDatetime(data["startTime"]); video.LastCommentTime = NicoDataConverter.ToDatetime(data["lastCommentTime"]); video.LengthSeconds = data["lengthSeconds"]; video.ThumbnailUrl = data["thumbnailUrl"]; //CommunityIcon = data["communityIcon"] // 自身に追加 Videos.Add(video.VideoId); } DataLength = json["meta"]["totalCount"]; ServiceFactory.MessageService.Debug(url); }
public override async Task Reload() { if (string.IsNullOrWhiteSpace(Target) || string.IsNullOrWhiteSpace(Period) || string.IsNullOrWhiteSpace(Category)) { ServiceFactory.MessageService.Error("検索ワードが入力されていません。"); return; } const string url = "http://www.nicovideo.jp/ranking/genre/{0}?tag={1}&term={2}&rss=2.0&lang=ja-jp"; var urltmp = string.Format(url, Target, Category, Period); var channel = (await GetXmlAsync(urltmp)) .Descendants("channel").First(); Videos.Clear(); foreach (var item in channel.Descendants("item")) { try { Videos.Add(UpdateVideoFromXml( item, "nico-info-total-view", "nico-info-total-mylist", "nico-info-total-res" )); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } //var desc = CreateDesc(item); //var lengthSecondsStr = (string)desc // .Descendants("strong") // .Where(x => (string)x.Attribute("class") == "nico-info-length") // .First(); //var video = VideoStatusModel.Instance.GetVideo(NicoDataConverter.ToId(item.Element("link").Value)); //video.Title = item.Element("title").Value; //video.ViewCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-view"); //video.MylistCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-res"); //video.CommentCounter = NicoDataConverter.ToCounter(desc, "nico-info-total-mylist"); //video.StartTime = NicoDataConverter.ToRankingDatetime(desc, "nico-info-date"); //video.ThumbnailUrl = (string)desc.Descendants("img").First().Attribute("src"); //video.LengthSeconds = NicoDataConverter.ToLengthSeconds(lengthSecondsStr); //video.Description = (string)desc.Descendants("p").FirstOrDefault(x => (string)x.Attribute("class") == "nico-description"); //// 自身に追加 //Videos.Add(video.VideoId); } }
private void LoadVideosFromDatabase() { Videos.Clear(); LogHelper.Log("Loading videos from VideoDB ..."); var videos = LoadVideos(x => x.IsCameraRoll == false && x.IsTvShow == false); LogHelper.Log($"Found {videos.Count} artists from VideoDB"); var newVideos = videos.OrderBy(x => x.Name); foreach (var v in newVideos) { Videos.Add(v); } }
private void ClearAllVideos() { if (SelectedItems.Count <= 0) { return; } foreach (var video in Videos) { _eventAggregator.GetEvent <AddToAvailableVideosEvent>().Publish(video as IntroVideo); } Videos.Clear(); }
/// <summary> /// Update the video list for this system /// </summary> /// <param name="systemName"></param> private void SystemChanged(string systemName) { try { Videos.Clear(); var systemVideoPath = _settings.HypermintSettings.HsPath + "\\Media\\" + systemName + "\\" + Root.Video; ScanVideosForSystem(systemVideoPath); } catch (Exception) { } }
public async void NavListBoxSelectionChanged() { // Load videos var result = await YoutubeApi.GetVideosByChannelAsync(SelectedChannel, 10); if (result.Exception == null) { Videos.Clear(); result.Result.ForEach(x => Videos.Add(x)); } else { ShowError(result.Exception); } }
public override async Task Reload() { var channel = (await GetXmlAsync(MylistUrl)).Descendants("channel").First(); // マイリスト情報を本インスタンスのプロパティに転記 MylistTitle = channel.Element("title").Value; MylistCreator = channel.Element(XName.Get("creator", "http://purl.org/dc/elements/1.1/")).Value; MylistDate = DateTime.Parse(channel.Element("lastBuildDate").Value); MylistDescription = channel.Element("description").Value; UserId = await GetUserId(); UserThumbnailUrl = await GetThumbnailUrl(); Videos.Clear(); foreach (var item in channel.Descendants("item")) { Videos.Add(UpdateVideoFromXml( item, "nico-numbers-view", "nico-numbers-mylist", "nico-numbers-res" )); //var desc = CreateDesc(item); ////var desc = XDocument.Load(new StringReader("<root>" + item.Element("description").Value + "</root>")).Root; //var lengthSecondsStr = (string)desc // .Descendants("strong") // .Where(x => (string)x.Attribute("class") == "nico-info-length") // .First(); //var video = VideoStatusModel.Instance.GetVideo(NicoDataConverter.ToId(item.Element("link").Value)); //video.Title = item.Element("title").Value; //video.ViewCounter = NicoDataConverter.ToCounter(desc, "nico-numbers-view"); //video.MylistCounter = NicoDataConverter.ToCounter(desc, "nico-numbers-mylist"); //video.CommentCounter = NicoDataConverter.ToCounter(desc, "nico-numbers-res"); //video.StartTime = NicoDataConverter.ToRankingDatetime(desc, "nico-info-date"); //video.ThumbnailUrl = (string)desc.Descendants("img").First().Attribute("src"); //video.LengthSeconds = NicoDataConverter.ToLengthSeconds(lengthSecondsStr); //video.Description = (string)desc.Descendants("p").FirstOrDefault(x => (string)x.Attribute("class") == "nico-description"); //// idを追加 //Videos.Add(video.VideoId); } }
public void SetVideos(string path) { if (string.IsNullOrEmpty(path)) { path = Path.Combine(Application.StartupPath, "Images"); } var dirInfo = new DirectoryInfo(path); Videos.Clear(); var info = dirInfo.GetFiles(); foreach (var f in info) { Videos.Add(new Video() { Location = f.FullName, Name = f.Name }); } NotifyPropertyChanged("SetVideos"); }
protected override async Task InitializeAsync() { await base.InitializeAsync(); try { var response = await httpClient.GetAsync("https://staffordchristadelphians.org.uk/manage/index.php"); if (response.StatusCode != HttpStatusCode.OK) { await messageService.ShowWarningAsync($"Reading videos table failed: {response.ReasonPhrase}", Application.Current.MainWindow.Title); } else { var html = await response.Content.ReadAsStringAsync(); var doc = new HtmlDocument(); doc.LoadHtml(html); var table = doc.DocumentNode.SelectSingleNode("//table[@class='videosTable']") .Descendants("tr") .Where(tr => tr.Elements("td").Count() > 1) .Select(tr => tr.Elements("td").Select(td => td.InnerText.Trim()).ToList()) .ToList(); Videos.Clear(); foreach (var row in table) { Videos.Add(new VideoModel() { Id = int.Parse(row[0]), Date = DateTime.Parse(row[1]), Title = row[2], Tag = row[3], Link = row[4], Speaker = row[5], Ecclesia = row[6], Details = row[7] }); } Gallery.ResetChanges(); } } catch (Exception ex) { await messageService.ShowErrorAsync(ex.Message); } // TODO: subscribe to events here }
public async Task ReloadTemporary() { const string url = "http://www.nicovideo.jp/api/deflist/list"; var json = await GetJsonAsync(url); Videos.Clear(); foreach (dynamic item in json["mylistitem"]) { VideoModel video; if (item["item_data"]["deleted"] == "0") { video = await VideoModel.CreateInstance(item["item_data"]["video_id"]); } else { video = new VideoModel(); video.VideoUrl = item["item_data"]["video_id"]; video.Title = item["item_data"]["title"]; video.Description = item["description"]; //video.Tags = data["tags"]; //video.CategoryTag = data["categoryTags"]; video.ViewCounter = long.Parse(item["item_data"]["view_counter"]); video.MylistCounter = long.Parse(item["item_data"]["mylist_counter"]); video.CommentCounter = long.Parse(item["item_data"]["num_res"]); video.StartTime = NicoUtil.FromUnixTime((long)item["item_data"]["first_retrieve"]); //video.LastCommentTime = Converter.item(data["lastCommentTime"]); video.LengthSeconds = long.Parse(item["item_data"]["length_seconds"]); video.ThumbnailUrl = item["item_data"]["thumbnail_url"]; //video.LastResBody = item["item_data"]["last_res_body"]; //video.CommunityIcon = data["communityIcon"]; } Videos.Add(video); } MainViewModel.Instance.TemporaryCount = Videos.Count; }
public void Clear() { CurrentVideo?.Dispose(); CurrentVideo = null; OnPropertyChanged(nameof(CurrentVideo)); NextVideo?.Dispose(); NextVideo = null; OnPropertyChanged(nameof(NextVideo)); if (Videos != null) { foreach (var item in Videos) { item.Dispose(); } Videos.Clear(); OnPropertyChanged(nameof(Videos)); } _IsInitialized = false; }
private async void RefreshVideos() { try { IsRefreshing = true; Videos.Clear(); var result = await _dataService.GetVideos(); foreach (var item in result.Select(v => new VideoViewModel(_dataService, v))) { Videos.Add(item); } } catch (Exception e) { var dialog = ServiceLocator.Current.GetInstance <IDialogService>(); dialog.ShowError(e, "Error Refreshing", "Ok", null); } finally { IsRefreshing = false; } }
async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Videos.Clear(); var videos = await PopularVideosStore.GetItemsAsync(true); foreach (var video in videos) { Videos.Add(video); } } catch (Exception ex) { Debug.WriteLine(ex); var notificator = DependencyService.Get <IToastNotificator>(); var options = new NotificationOptions() { Title = "Error loading videos", Description = "API may be down" }; var result = await notificator.Notify(options); } finally { IsBusy = false; } }
public void Clear() { Videos.Clear(); Channels.Clear(); Playlists.Clear(); }
/* * public void RemoveMatches(Predicate<Video> match) * { * foreach (Video v in this.Videos * Videos.Where(match); * }*/ public void Clear() { Videos.Clear(); }