示例#1
0
        private void ShowMediaInfoFlyout(FrameworkElement elem)
        {
            PlayListFile plf = null;

            if (elem != null && (plf = elem.DataContext as PlayListFile) != null)
            {
                MessengerInstance.Send <Message <DecoderTypes> >(
                    new Message <DecoderTypes>(async(decoderType) =>
                {
                    int newIndex          = PlayListFileSource.IndexOf(PlayListFileSource.FirstOrDefault(x => x == plf));
                    _RequestedDecoderType = decoderType;
                    if (SelectedIndex != newIndex)
                    {
                        SelectedIndex = newIndex;
                    }
                    //로딩 패널 표시
                    MessengerInstance.Send(new Message("IsOpen", true), "ShowLoadingPanel");
                    await ThreadPool.RunAsync(async handler =>
                    {
                        await DispatcherHelper.RunAsync(() =>
                        {
                            //재생요청
                            RequestPlayback(false);
                        });
                    }, WorkItemPriority.Normal);
                })
                    .Add("StorageItemInfo", plf)
                    .Add("ButtonName", "CodecInformation"),
                    "ShowMediaFileInformation");
            }
        }
示例#2
0
        private async void FileTapped(object sender, TappedRoutedEventArgs args)
        {
            if (SelectionMode == ListViewSelectionMode.Multiple)
            {
                return;
            }

            if (IsReorderMode == true)
            {
                IsReorderMode = false;
                return;
            }

            PlayListFile     plf  = null;
            FrameworkElement elem = args.OriginalSource as FrameworkElement;

            if (elem != null && (plf = elem.DataContext as PlayListFile) != null)
            {
                if (PlayListFileSource[SelectedIndex] == plf)
                {
                    //로딩 패널 표시
                    MessengerInstance.Send(new Message("IsOpen", true), "ShowLoadingPanel");
                    await ThreadPool.RunAsync(async handler =>
                    {
                        await DispatcherHelper.RunAsync(() =>
                        {
                            //재생요청
                            RequestPlayback(true);
                        });
                    }, WorkItemPriority.Normal);
                }
            }
        }
示例#3
0
        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);
                    }
                }
            }
        }
示例#4
0
 private void SetPlayListFile(PlayListFile playListFile)
 {
     //이벤트 할당
     playListFile.Tapped      = FileTapped;
     playListFile.RightTapped = FileRightTapped;
     playListFile.Holding     = FileHolding;
     //저장된 이름으로 먼저 이름을 설정
     playListFile.Name = Path.GetFileName(playListFile.Path);
     //표시 이름 설정
     playListFile.SetDisplayName();
 }
示例#5
0
        public void LoadPlayListFiles(PlayList playList, List <PlayListFile> playListFileList)
        {
            using (var pstmt = conn.Prepare(DML_SELECT_PLAYLIST_FILE.Replace("@CONDITION", string.Empty)))
            {
                pstmt.Bind("@OWNER_SEQ", playList.Seq);

                List <string> subtitlePathList = new List <string>();
                while (pstmt.Step() == SQLiteResult.ROW)
                {
                    string path = pstmt.GetText("PATH");
                    if (Xaml.Controls.MediaFileSuffixes.CLOSED_CAPTION_SUFFIX.Contains(Path.GetExtension(path).ToUpper()))
                    {
                        subtitlePathList.Add(path);
                    }
                    else
                    {
                        PlayListFile pl = new PlayListFile
                        {
                            Seq        = pstmt.GetInteger("OWNER_SEQ"),
                            Path       = path,
                            FalToken   = pstmt.GetText2("FAL_TOKEN"),
                            PausedTime = TimeSpan.FromSeconds(pstmt.GetFloat2("PAUSED_TIME")),
                            OrderNo    = pstmt.GetInteger2("ORDER_NO"),
                        };

                        //재생목록에 추가된 시간 파싱
                        DateTime AddedDateTime;
                        if (DateTime.TryParse(pstmt.GetText2("ADDED_DATETIME"), out AddedDateTime))
                        {
                            pl.AddedDateTime = AddedDateTime;
                        }

                        playListFileList.Add(pl);
                    }
                }

                foreach (var plf in playListFileList)
                {
                    var subPathList = subtitlePathList.Where(x => x.ToUpper().Contains(PathHelper.GetFullPathWithoutExtension(plf.Path).ToUpper())).ToList();

                    foreach (var subPath in subPathList)
                    {
                        if (plf.SubtitleList == null)
                        {
                            plf.SubtitleList = new List <string>();
                        }

                        plf.SubtitleList.Add(subPath);
                        subtitlePathList.Remove(subPath);
                    }
                }
            }
        }
示例#6
0
        private async void RequestPlayback(DecoderTypes decoderType, StorageItemInfo storageItemInfo, bool isPrevOrNext)
        {
            if (!VersionHelper.IsUnlockNetworkPlay)
            {
                MessengerInstance.Send(new Message(), "CheckInterstitialAd");
                return;
            }

            if (!isPrevOrNext)
            {
                MessengerInstance.Send(new Message("IsOpen", true)
                                       .Add("LoadingTitle", ResourceLoader.GetForCurrentView().GetString("Loading/Playback/Text")), "ShowLoadingPanel");
            }

            //현재 파일 이후의 파일들을 모두 지금 재생중에 추가
            var files = StorageItemGroupSource.Where(x => x.Type == StorageItemTypes.File).SelectMany(x => x.Items).ToList();

            PlayListFile currPlayListFile = null;
            PlayListFile prevPlayListFile = null;
            PlayListFile nextPlayListFile = null;

            for (int i = 0; i < files.Count; i++)
            {
                var file    = await files[i].GetStorageFileAsync();
                var orgFile = await storageItemInfo.GetStorageFileAsync();

                if (file.FolderRelativeId == orgFile.FolderRelativeId)
                {
                    currPlayListFile = new PlayListFile(file);

                    if (i > 0)
                    {
                        prevPlayListFile = new PlayListFile(await files[i - 1].GetStorageFileAsync());
                    }

                    if (i + 1 < files.Count)
                    {
                        nextPlayListFile = new PlayListFile(await files[i + 1].GetStorageFileAsync());
                    }
                    break;
                }
            }

            MessengerInstance.Send(
                new Message()
                .Add("PrevPlayListFile", prevPlayListFile)
                .Add("CurrPlayListFile", currPlayListFile)
                .Add("NextPlayListFile", nextPlayListFile)
                .Add("DecoderType", decoderType),
                "RequestPlayback");
        }
示例#7
0
        /// <summary>
        /// 재생목록 재생 정지 시간을 업데이트 한다.
        /// </summary>
        /// <param name="playListFile">재생목록 파일</param>
        /// <returns></returns>
        public SQLiteResult UpdatePausedTime(PlayListFile playListFile)
        {
            SQLiteResult result = SQLiteResult.EMPTY;

            using (var pstmt = this.conn.Prepare(DML_UPDATE_PAUSED_TIME_PLAYLIST_FILE))
            {
                pstmt.Bind("@PAUSED_TIME", playListFile.PausedTime.TotalSeconds);
                pstmt.Bind("@OWNER_SEQ", playListFile.Seq);
                pstmt.Bind("@PATH", playListFile.Path);

                result = pstmt.Step();
            }
            return(result);
        }
示例#8
0
        protected override void RegisterMessage()
        {
            MessengerInstance.Register <bool>(this, "DLNABackRequested", (val) =>
            {
                ToUpperTapped(null, null);
            });

            MessengerInstance.Register <Message>(this, "DLNANextPlayListFile", (val) =>
            {
                DecoderTypes decoderType  = val.GetValue <DecoderTypes>("DecoderType");
                PlayListFile playListFile = val.GetValue <PlayListFile>("NextPlayListFile");

                RequestPlayback(decoderType, playListFile, true);
            });
        }
示例#9
0
        private void RequestPlayback(bool resetDecoder)
        {
            var mv = SimpleIoc.Default.GetInstance <MainViewModel>();

            if (!mv.AppProtection.IsHideAppLockPanel)
            {
                return;
            }

            if (SelectedIndex > -1 && SelectedIndex < PlayListFileSource.Count)
            {
                PlayListFile prevPlayListFile = null;
                PlayListFile nextPlayListFile = null;

                if (SelectedIndex - 1 > -1)
                {
                    prevPlayListFile = PlayListFileSource[SelectedIndex - 1];
                }

                if (SelectedIndex + 1 < PlayListFileSource.Count)
                {
                    nextPlayListFile = PlayListFileSource[SelectedIndex + 1];
                }

                //디코더 타입 오버라이드
                if (resetDecoder)
                {
                    _RequestedDecoderType = Settings.Playback.DefaultDecoderType;
                }

                var frame = Window.Current.Content as Frame;
                if (frame != null)
                {
                    //재생 요청
                    MessengerInstance.Send(
                        new Message()
                        .Add("CurrPlayListFile", PlayListFileSource[SelectedIndex])
                        .Add("PrevPlayListFile", prevPlayListFile)
                        .Add("NextPlayListFile", nextPlayListFile)
                        .Add("DecoderType", _RequestedDecoderType)
                        , "RequestPlayback");
                }
            }
        }
示例#10
0
        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 로드완료");
        }