コード例 #1
0
ファイル: Compléments.cs プロジェクト: mbatest/Video
        public void AddShotToScene(Shots s)
        {
            SequenceScene sq = new SequenceScene {
                Shots = s, Scenes = this
            };

            if (SequenceScene.Where(c => c.Shots == s).Count() == 0)
            {
                SequenceScene.Add(sq);
            }
        }
コード例 #2
0
        private void CutIntoScenes(Videos currentVideoTape)
        {
            currentVideoTape.Scenes.Clear();
            List <Shots> sceneShots   = currentVideotape.Shots.OrderBy(s => s.Fichier).ThenBy(s => s.DateShot).ToList();
            DateTime     t            = sceneShots[0].DateShot.Value;
            int          numScène     = 1;
            Scenes       currentScene = new Scenes
            {
                Code_Bande = currentVideotape.Code_Bande,
                Videos     = currentVideotape,
                Titre      = currentVideoTape.Titre + " Scene " + numScène.ToString() + sceneShots[0].Lieux?.Lieu,
                Lieux      = sceneShots[0].Lieux,
                Image      = sceneShots[0].Image,
                StartFrame = sceneShots[0].StartFrame,
                DateDebut  = sceneShots[0].DateShot
            };

            currentVideotape.Scenes.Add(currentScene);
            cutDelay = 4;
            for (int i = 0; i < sceneShots.Count; i++)
            {
                try
                {
                    TimeSpan ts = sceneShots[i].DateShot.Value - t;
                    if ((ts.TotalMinutes > cutDelay) || (sceneShots[i].DateShot.Value < t))
                    {
                        numScène++;
                        currentScene.EndFrame = sceneShots[i - 1].EndFrame;
                        string com = currentVideoTape.Titre + " Scene " + numScène.ToString();
                        currentScene = new Scenes
                        {
                            Code_Bande = currentVideotape.Code_Bande,
                            Videos     = currentVideotape,
                            Titre      = com,
                            StartFrame = sceneShots[i].StartFrame,
                            Lieux      = sceneShots[i].Lieux,
                            Image      = sceneShots[i].Image,
                            DateDebut  = sceneShots[i].DateShot
                        };
                        currentVideotape.Scenes.Add(currentScene);
                    }
                    SequenceScene sqs = new SequenceScene {
                        Scenes = currentScene, Shots = sceneShots[i]
                    };
                    currentScene.SequenceScene.Add(sqs);
                    t = sceneShots[i].DateShot.Value;
                }
                catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); }
            }
            timeLine.Init(currentVideotape);
            md.SaveChanges();
        }