Ejemplo n.º 1
0
        public override void InvokeProgress(MovselexClient client)
        {
            client.LibraryUpdater.RegistFiles(_files, client.ProgressInfo);

            // フィルタをAll Movieに戻す。
            client.Filterings.SingleSelection(0);
        }
Ejemplo n.º 2
0
        public override void InvokeCore(MovselexClient client)
        {
            var playing = client.MovselexPlaying;
            var thrower = new MediaPlayerClassicThrower(client.AppConfig);

            if (_id != -1)
            {
                // id指定の場合
                _libraryItems = new[] {client.MovselexLibrary.GetLibraryItem(_id)};
            }

            if (_mode == Mode.Interrupt)
            {
                var resumeItems = playing.GetResumePlayingItems();

                // 再生位置が終盤であれば現在の再生中のものは除外する。
                var nowplaying = client.NowPlayingInfo;
                if (nowplaying.TotalPlayTime.Subtract(nowplaying.NowPlayTime).Duration().TotalMinutes < 5)
                {
                    resumeItems = resumeItems.Skip(1);
                }

                _libraryItems = _libraryItems.Concat(resumeItems);
                
            }

            var libraryItems = _libraryItems as LibraryItem[] ?? _libraryItems.ToArray();
            thrower.Throw(libraryItems.Select(x => x.FilePath));
            playing.Reset(libraryItems);

        }
Ejemplo n.º 3
0
        public override void InvokeCore(MovselexClient client)
        {
            // データベースロード
            LoadDatabase(client);

            // フィルタリングロード
            client.MovselexFiltering.Load(client.AppConfig.Language);
        }
        public override void InvokeCore(MovselexClient client)
        {
            var google = new GoogleCustomSearchService("AIzaSyAvvp88pkckq6x1m-DSrECZZJQSeNijlF8", "014354446303595193098:vzav9hoglna");

            var response = google.Query(_groupName);

            CandidateGroupNames = response.items != null ? response.items.Select(x => x.title) : Enumerable.Empty<string>();
        }
Ejemplo n.º 5
0
 public override void InvokeCore(MovselexClient client)
 {
     // TODO: 削除後、グループも更新する
     foreach (var libraryItem in _selectLibraryItems)
     {
         client.MovselexLibrary.Delete(libraryItem, _isDeleteFile);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// データベースをロードします。
        /// </summary>
        protected void LoadDatabase(MovselexClient client)
        {
            // データベース一覧
            var dbnames = Directory.GetFiles(
                ApplicationDefinitions.DatabaseDirectory, "*.db", SearchOption.TopDirectoryOnly).Select(Path.GetFileNameWithoutExtension);

            client.Databases.DiffUpdate(dbnames.ToArray());

        }
Ejemplo n.º 7
0
 public override void InvokeCore(MovselexClient client)
 {
     client.Filterings.ClearSelection();
     client.MovselexLibrary.Load(new LibraryCondition(
         FilteringMode.SQL, 
         FilteringCondition.Empty, 
         client.AppConfig.MaxLimitNum,
         _filteringText), client.NowPlayingInfo);
     client.MovselexGroup.Load();
 }
Ejemplo n.º 8
0
        public override void InvokeCore(MovselexClient client)
        {
            var libCondition = CreateLibraryCondition(client);

            client.MovselexLibrary.DiffLoad(libCondition);

            client.MovselexGroup.DiffLoad();

            client.MovselexPlaying.Load();
        }
Ejemplo n.º 9
0
        public async override void InvokeCore(MovselexClient client)
        {
            client.IsProgressing = true;

            // TODO: MoveDirectoryActionと共通化する。

            //TODO: メッセージを国際化する。
            var appConfig = client.AppConfig;

            var movedDic = new Dictionary<long, string>();


            await Task.Run(() =>
            {
                // ファイル移動は時間がかかるので別スレッドで。

                var i = 1;
                foreach (var library in _selectLibraries)
                {
                    var oldFilePath = library.FilePath;
                    var newfilepath = Path.Combine(_moveDestDirectory, Path.GetFileName(oldFilePath));

                    client.ProgressInfo.UpdateProgressMessage("Moving Library Files",oldFilePath, i++,
                        _selectLibraries.Length);

                    var isMoved = File.Exists(oldFilePath) && FileUtils.Move(oldFilePath, newfilepath);

                    if (isMoved)
                    {
                        _log.Info("Moved File. {0} to {1}.", library.FilePath, newfilepath);

                        movedDic.Add(library.Id, newfilepath);

                        DirecotryUtils.DeleteEmptyDirecotry(Path.GetDirectoryName(library.FilePath));
                    }
                    else
                    {
                        _log.Warn(" Fail Move File. {0} to {1}.", oldFilePath, newfilepath);
                    }
                    
                }

            });

            client.PostCallback(new CallbackAction(() =>
            {
                client.MovselexLibrary.UpdateFilePaths(movedDic);
                client.IsProgressing = false;
            }));
            
            
        }
Ejemplo n.º 10
0
 public override void InvokeCore(MovselexClient client)
 {
     client.MovselexGroup.ModifyGroup(_group, _groupName, _keyword);
     
     // ライブラリに更新対象のグループがあったら更新する。
     foreach (var libraryItem in client.MovselexLibrary.LibraryItems)
     {
         if (libraryItem.Gid == _group.Gid)
         {
             var oldGroupName = libraryItem.GroupName;
             libraryItem.ModifyGroupName(_groupName);
             libraryItem.ModifyTitle(libraryItem.Title.Replace(oldGroupName, _groupName));
         }
     }
 }
Ejemplo n.º 11
0
 public override void InvokeCore(MovselexClient client)
 {
     // TODO: 同じキーワードの登録はエラーとする。
     //var movGroup = client.MovselexGroup;
     //var sameKeywordGroups = movGroup.GetMatchKeywordGroups(_keyword);
     //if (ownGroup != null) sameKeywordGroups = sameKeywordGroups.Where(x => x.GID != ownGroup.Gid);  // グループ更新のときは自分を除く。
     //if (sameKeywordGroups.Any())
     //{
     //    // 同じキーワードのグループがすでに存在したらエラー
     //    throw new MovselexException(string.Format("すでに同じキーワードのグループが登録されています。\nキーワード:{0}", keyword.ToLower()));
     //}
     var movGroup = client.MovselexGroup;
     movGroup.JoinGroup(_title, _keyword, _libraries);
     movGroup.Load();
 }
Ejemplo n.º 12
0
        public override void InvokeCore(MovselexClient client)
        {
            //LoadDatabase(client);

            // フィルタリングロード
            //client.MovselexFiltering.Load(client.AppConfig.Language);

            var libCondition = CreateLibraryCondition(client);
            
            client.MovselexLibrary.Load(libCondition, client.NowPlayingInfo);
            

            if(_filteringMode == FilteringMode.SQL) client.MovselexGroup.Load();

            client.MovselexPlaying.Load();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// アクションを実行します。
        /// </summary>
        /// <param name="client"></param>
        public override void InvokeCore(MovselexClient client)
        {
            var appConfig = client.AppConfig;

            if (_isShuffle)
            {
                client.MovselexLibrary.Shuffle(appConfig.MaxGenerateNum,
                    client.AppConfig.LibraryMode,
                    client.MovselexFiltering.IsSelectAllMovie());
            }
            else
            {
                client.MovselexLibrary.Trimming(_librarySelectIndex, appConfig.MaxGenerateNum);
            }

            client.MovselexGroup.Load(client.MovselexLibrary.LibraryItems.Select(x=>x.Gid).Distinct());
        }
Ejemplo n.º 14
0
        public override void InvokeCore(MovselexClient client)
        {
            var id = client.MovselexLibrary.FindIdByFileName(_fileName);
            client.NowPlayingInfo.SetId(id);
            LibraryItem library = LibraryItem.Empty;
            if (id != -1)
            {
                library = client.MovselexLibrary.GetLibraryItem(id);
            }
            var prevnext = client.MovselexLibrary.GetPreviousAndNextId(library.Gid, library.No);

            client.MovselexLibrary.ResetIsPlaying(library);

            client.NowPlayingInfo.SetLibrary(library);
            client.NowPlayingInfo.SetPreviousAndNextId(prevnext);
            client.MovselexPlaying.Refresh(library);
        }
Ejemplo n.º 15
0
 protected LibraryCondition CreateLibraryCondition(MovselexClient client)
 {
     switch (_filteringMode)
     {
         case FilteringMode.SQL:
             // 選択状態のフィルタのSQLを取得してロード
             return new LibraryCondition(_filteringMode,
                 client.MovselexFiltering.FilteringItems.Where(x => x.IsSelected).Select(x => x.Value).FirstOrDefault(),
                 string.IsNullOrEmpty(client.FilteringText) ? client.AppConfig.MaxLimitNum : 0,
                 client.FilteringText);
         case FilteringMode.Group:
             // 選択状態のグループのSQLを取得してロード
             return new LibraryCondition(_filteringMode,
                 client.MovselexGroup.GroupItems.Where(x => x.IsSelected).Select(x => new FilteringCondition(x.GroupName, false)).FirstOrDefault());
         default:
             return null;
     }
 }
Ejemplo n.º 16
0
 public override void InvokeCore(MovselexClient client)
 {
     // TODO: インタフェース化して共通化する。
     if (_libraryItem != null)
     {
         var newRating = _libraryItem.IsFavorite ? RatingType.Normal : RatingType.Favorite; // 逆にする
         client.MovselexLibrary.ModifyRating(_libraryItem, newRating);
     }
     if (_groupItem != null)
     {
         var newRating = _groupItem.IsFavorite ? RatingType.Normal : RatingType.Favorite; // 逆にする
         client.MovselexGroup.ModifyRating(_groupItem, newRating);
         foreach (var library in client.MovselexLibrary.LibraryItems.Where(x => x.Gid == _groupItem.Gid))
         {
             // ライブラリも更新する
             library.ModifyRating(newRating);
         }
     }
 }
Ejemplo n.º 17
0
 public AutoUpdateLibraryAction(MovselexClient client)
 {
     _client = client;
 }
Ejemplo n.º 18
0
 public override void InvokeCore(MovselexClient client)
 {
     client.MovselexGroup.ModifyIsComplete(_group);
 }
Ejemplo n.º 19
0
 public override void InvokeProgress(MovselexClient client)
 {
     client.LibraryUpdater.Update(client.ProgressInfo);
 }
        public async override void InvokeCore(MovselexClient client)
        {
            client.IsProgressing = true;

            //TODO: メッセージを国際化する。
            var appConfig = client.AppConfig;
           
            appConfig.MoveBaseDirectory = _baseDirectory;

            // 移動先フォルダ作成
            var moveDirectory = _baseDirectory + "\\" + _group.GroupName;

            Directory.CreateDirectory(moveDirectory);

            var movedDic = new Dictionary<long, string>();


            var moveLibraries = client.Libraries.ToArray();

            await Task.Run(() =>
            {
                // ファイル移動は時間がかかるので別スレッドで。

                var i = 1;
                foreach (var library in moveLibraries)
                {
                    var oldFilePath = library.FilePath;
                    var newfilepath = Path.Combine(moveDirectory, Path.GetFileName(oldFilePath));

                    client.ProgressInfo.UpdateProgressMessage("Moving Group Files", _group.GroupName, i++,
                        moveLibraries.Length);

                    var isMoved = File.Exists(oldFilePath) && FileUtils.Move(oldFilePath, newfilepath);

                    if (isMoved)
                    {
                        _log.Info("Moved File. {0} to {1}.", oldFilePath, newfilepath);
                        movedDic.Add(library.Id, newfilepath);
                        DirecotryUtils.DeleteEmptyDirecotry(Path.GetDirectoryName(oldFilePath));
                    }
                    else
                    {
                        _log.Warn(" Fail Move File. {0} to {1}.", oldFilePath, newfilepath);
                    }
                    
                }

            });

            client.PostCallback(new CallbackAction(() =>
            {
                client.MovselexLibrary.UpdateFilePaths(movedDic);

                if (_group != null) _group.ModifyDriveLetter(FileUtils.GetDriveLetter(moveDirectory));

                _log.Info("Moved Group Direcotry. Group:{0} NewPath:{1}", _group.GroupName, moveDirectory);

                client.IsProgressing = false;
            }));
            
            

        }
Ejemplo n.º 21
0
 public override void InvokeCore(MovselexClient client)
 {
     client.MovselexLibrary.ModifyIsPlayed(_libraryItem);
 }
Ejemplo n.º 22
0
 public override void InvokeCore(MovselexClient client)
 {
     client.MovselexLibrary.UnGroup(_libraries);
 }
Ejemplo n.º 23
0
 public override void InvokeCore(MovselexClient client)
 {
     client.IsProgressing = true;
     this.InvokeProgress(client);
     client.IsProgressing = false;
 }
Ejemplo n.º 24
0
 public override void InvokeCore(MovselexClient client)
 {
     ;
 }
        /// <summary>
        /// アクションを実行します。
        /// </summary>
        /// <param name="client"></param>
        public override void InvokeCore(MovselexClient client)
        {

            if (_id != -1) client.MovselexLibrary.IncrementPlayCount(_id);
        }
Ejemplo n.º 26
0
 public override void InvokeCore(MovselexClient client)
 {
     _action.Invoke();
 }
Ejemplo n.º 27
0
 public abstract void InvokeProgress(MovselexClient client);