private async Task SetSubtitleList(PlayListFile playListFile) { if (_SubtitlesList.ContainsKey(playListFile.ParentFolderPath)) { List <string> subtitles = _SubtitlesList[playListFile.ParentFolderPath]; if (subtitles == null) { try { var file = await playListFile.GetStorageFileAsync(); var currFolder = await file.GetParentAsync(); //var currFolder = await StorageFolder.GetFolderFromPathAsync(playListFile.ParentFolderPath); if (currFolder != null) { var queryResult = currFolder.CreateFileQueryWithOptions(_SubtitleFileQueryOptions); var list = await queryResult.GetFilesAsync(); subtitles = list.Select(x => x.Path).OrderBy(x => x).ToList(); _SubtitlesList[playListFile.ParentFolderPath] = subtitles; System.Diagnostics.Debug.WriteLine($"Play list : {playListFile.ParentFolderPath} 폴더내 자막파일 {subtitles.Count}개 검색 됨..."); } } catch (UnauthorizedAccessException) { System.Diagnostics.Debug.WriteLine($"{playListFile.ParentFolderPath} 폴더에 대한 접근 권한없음..."); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } } }
private async void LoadExtraInfoAsync(PlayListFile playListFile) { //썸네일 및 사이즈 등 추가 데이터 로드 await Task.Factory.StartNew(async() => { var storageItem = await playListFile.GetStorageFileAsync(); if (storageItem != null) { if (playListFile.Name != storageItem.Name) { //이름 변경 playListFile.Name = storageItem.Name; //표시 이름 갱신 playListFile.SetDisplayName(); } playListFile.DateCreated = storageItem.DateCreated; System.Diagnostics.Debug.WriteLine(storageItem.Path); var basicProperties = await storageItem.GetBasicPropertiesAsync(); playListFile.Size = basicProperties.Size; List <Thumbnail> thumbnailList = new List <Thumbnail>(); //기간 지난 썸네일 캐시 삭제 ThumbnailDAO.DeletePastPeriodThumbnail(Settings.Thumbnail.RetentionPeriod); //썸네일 데이터 로드 Thumbnail thumbnail = ThumbnailDAO.GetThumnail(playListFile.ParentFolderPath, playListFile.Name); if (thumbnail != null) { thumbnailList.Add(thumbnail); } //썸네일 로드 LoadThumbnailAsync(playListFile as StorageItemInfo, thumbnailList, Settings.Thumbnail.UseUnsupportedLocalFile); //자막 여부 표시 try { List <string> tmp = new List <string>(); //DB에서 로드된 자막리스트를 다시 추가 if (playListFile.SubtitleList != null) { tmp.AddRange(playListFile.SubtitleList); } if (_SubtitlesList.ContainsKey(playListFile.ParentFolderPath)) { List <string> subtitles = _SubtitlesList[playListFile.ParentFolderPath]; //현재 폴더내에서 검색가능한 경우, 발견된 자막리스트를 추가 if (subtitles != null && subtitles.Count > 0) { tmp.AddRange(subtitles.Where(x => x.ToUpper().Contains(PathHelper.GetFullPathWithoutExtension(playListFile.Path).ToUpper())).ToList()); } } //모든 추가된 자막리스트로 교체 playListFile.SubtitleList = tmp.Distinct().ToList(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } }); //System.Diagnostics.Debug.WriteLine("재생목록 ExtraInfo 로드완료"); }