Exemple #1
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();
        }
Exemple #2
0
        private void DisplayScenesPanel_SceneSelected(object sender, SceneSelectedArgs e)
        {
            currentScene = e.scene;
            var sq = currentScene.SequenceScene;

            currentVideotape.Shots.ToList().ForEach(s => s.Selected = false);
            sceneIndexControl.SetScene(e.scene);
            #region Sélectionne les clips
            shotsToPlay.Clear();
            foreach (SequenceScene y in sq)
            {
                y.Shots.Selected = true;
                shotsToPlay.Add(y.Shots);
            }
            //if (détails.Checked)
            //    PlayShots();
            #endregion
            timeLine.SetStart(currentScene);
        }
Exemple #3
0
 public void SetStart(Scenes scene)
 {
     currentScene = scene;
     if (scene.SequenceScene.Count > 0)
     {
         Shots shot  = scene.SequenceScene.First().Shots;
         float début = 0;
         foreach (Shots s in shots)
         {
             if (s == shot)
             {
                 débutDessin = -début;
                 break;
             }
             début += (int)s.FrameCount / pixelsParSecondes;
         }
         Refresh();
     }
 }
Exemple #4
0
        public void SetScene(Scenes sc)
        {
            currentScene = sc;
            listPersons.Items.Clear();
            SceneTitle.Text = currentScene.Titre;
            comment.Text    = currentScene.Commentaire;
            if (sc.Lieux != null)
            {
                cBPays.SelectedItem  = sc.Lieux.Villes.Pays;
                cBPays.Text          = sc.Lieux.Villes.Pays.Nom_Pays;
                cBVille.Text         = sc.Lieux.Villes.Nom;
                cBLieu.Text          = sc.Lieux.Lieu;
                cBVille.SelectedItem = sc.Lieux.Villes;
                cBLieu.SelectedItem  = sc.Lieux;
            }
            else
            {
                cBPays.SelectedItem = md.Pays.Single(p => p.Nom_Pays == "France");
                cBVille.Text        = "";
                cBLieu.Text         = "";
                UpDateVilles((Pays)cBPays.SelectedItem);
            }
            ShotNumber.Text = currentScene.SequenceScene.Count.ToString();
            Duration.Text   = Videos.DuréeShot(currentScene.FrameCount);
            keywordList.Items.Clear();
            foreach (var x in currentScene.KeywordScene)
            {
                AddKeywordToListView(x.Keywords);
            }
            if (currentScene.PrésenceScène != null)
            {
                foreach (var p in currentScene.PrésenceScène)
                {
                    AddPersonToListView(p.Personnes);
                }
            }

            Valid.Enabled = true;
        }
Exemple #5
0
        private Scenes Trouve(MouseEventArgs e)
        {
            if ((scenes == null) | (scenes.Count == 0))
            {
                return(null);
            }
            int x        = 0;
            int y        = 0;
            int w        = (int)(scenes[0].Videos.Largeur * ImageZoomFactor) / Facteur;
            int h        = (int)(scenes[0].Videos.Hauteur * ImageZoomFactor) / Facteur;
            int interval = (int)(2 * size * ImageZoomFactor);

            for (int i = startImage; i < scenes.Count; i++)
            {
                Rectangle rec = new Rectangle(x, y, w, h);
                if (rec.Contains(e.Location))
                {
                    Scenes s = scenes[i];
                    s.Selected = true;
                    Refresh();
                    return(s);
                }
                x += w;
                if (x > Width - w)
                {
                    x  = 0;
                    y += h;
                    if (Détails)
                    {
                        y += nombreLignes * interval;
                    }
                }
                if (y > Height)
                {
                    return(null);
                }
            }
            return(null);
        }
Exemple #6
0
        private void DisplayScenesPanel_MultiSceneSelected(object sender, MultiSceneSelectedArgs e)
        {
            Scenes sceneModèle = e.scenes[0];

            if (sceneModèle == null)
            {
                return;
            }
            switch (e.type)
            {
            case "Fuse scenes":
                #region Fusion
                for (int i = 1; i < e.scenes.Count; i++)
                {
                    Scenes scene = e.scenes[i];
                    foreach (var x in scene.SequenceScene)
                    {
                        sceneModèle.AddShotToScene(x.Shots);
                    }
                    try
                    {
                        md.Scenes.Remove(scene);
                    }
                    catch { }
                }
                currentVideotape.NombreScènes = currentVideotape.Scenes.Count;
                md.SaveChanges();
                #endregion
                break;

            case "Lieu":
                for (int i = 1; i < e.scenes.Count; i++)
                {
                    e.scenes[i].Lieux = sceneModèle.Lieux;
                }
                for (int i = 1; i < e.scenes[0].SequenceScene.Count; i++)
                {
                    e.scenes[0].SequenceScene.First().Shots.Lieux = sceneModèle.Lieux;
                }
                md.SaveChanges();
                break;

            case "Commentaire":
                for (int i = 1; i < e.scenes.Count; i++)
                {
                    e.scenes[i].Commentaire = sceneModèle.Commentaire;
                }
                md.SaveChanges();
                break;

            case "Titre":
                for (int i = 1; i < e.scenes.Count; i++)
                {
                    e.scenes[i].Titre = sceneModèle.Titre;
                }
                md.SaveChanges();
                break;

            case "Play":
                #region Liste à jouer
                shotsToPlay.Clear();
                foreach (Scenes scene in e.scenes)
                {
                    foreach (SequenceScene y in scene.SequenceScene)
                    {
                        shotsToPlay.Add(y.Shots);
                        y.Shots.Selected = true;
                    }
                }
                PlayShots();
                #endregion
                break;

            case "Mots Clés":
                #region Mise à jour mots clés
                if (sceneModèle.KeywordScene != null)
                {
                    for (int i = 1; i < e.scenes.Count; i++)
                    {
                        foreach (KeywordScene y in sceneModèle.KeywordScene)
                        {
                            e.scenes[i].AddKeywordToScene(y.Keywords);
                        }
                    }
                }
                md.SaveChanges();
                #endregion
                break;

            case "Personne":
                #region Mise à jour personnes
                if (sceneModèle.PrésenceScène != null)
                {
                    for (int i = 1; i < e.scenes.Count; i++)
                    {
                        foreach (PrésenceScène y in sceneModèle.PrésenceScène)
                        {
                            e.scenes[i].AddPersonToScene(y.Personnes);
                        }
                    }
                }
                md.SaveChanges();
                #endregion
                break;

            case "Split scene":
                Scenes sc = sceneModèle;
                //            if (sc.Videos.NombreScènes == 1)
                //{
                //    if (sc.SequenceScene.Count == 0)
                //    {
                //        foreach(Shots sh in sc.Videos.Shots)
                //        {
                //            sc.SequenceScene.Add(new SequenceScene { Shots = sh, Scenes = sc });
                //        }
                //    }
                //}

                //foreach (var x in sc.SequenceScene)
                //{
                //    Scenes scene = new Scenes();
                //    scene.SequenceScene.Add(x);
                //    currentVideotape.Scenes.Add(scene);
                //}
                //try
                //{
                //    md.Scenes.Remove(sc);
                //}
                //catch { }
                //currentVideotape.NombreScènes = currentVideotape.Scenes.Count;
                //md.SaveChanges();
                break;
            }
            displayScenesPanel.Refresh();
            bdNumberOfScenes.Text = currentVideotape.Scenes.Count.ToString(); /*md.Scenes.Where(s => s.Videos.Code_Bande == currentVideotape.Code_Bande).Count().ToString()*/;
        }
Exemple #7
0
 private void Videos_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (videos.SelectedItem == null)
     {
         return;
     }
     currentVideotape = (Videos)videos.SelectedItem;
     axWindowsMediaPlayer.Ctlcontrols.stop();
     timeLine.CurrentPosition = 0;
     #region Show tape data
     foreach (Control c in splitContainer6.Panel1.Controls)
     {
         if (c is TextBox)
         {
             c.Text = "";
         }
     }
     Cursor              = Cursors.WaitCursor;
     bdComment.Text      = currentVideotape.Commentaire;
     bdPeriode.Text      = currentVideotape.Periode;
     bdTitreFichier.Text = currentVideotape.Directory;
     bdTitreBande.Text   = currentVideotape.Titre;
     if ((currentVideotape.NombreFrames == null) | (currentVideotape.NombreFrames == 0))
     {
         //Cursor = Cursors.Default;
         //return;
         currentVideotape.NombreFrames = currentVideotape.Frames;
         md.SaveChanges();
         if (currentVideotape.NombreShots == null)
         {
             currentVideotape.NombreShots = currentVideotape.Shots.Count;
             if (currentVideotape.NombreScènes == null)
             {
                 currentVideotape.NombreScènes = currentVideotape.Scenes.Count;
             }
             md.SaveChanges();
         }
     }
     bdNumberOfShots.Text  = currentVideotape.NombreShots?.ToString();
     bdNumberOfScenes.Text = currentVideotape.NombreScènes.ToString();
     bdDuration.Text       = currentVideotape.Durée;
     bdFrames.Text         = currentVideotape.NombreFrames?.ToString();
     local.Text            = currentVideotape.Shots.Count + " clips, " + currentVideotape.Durée;
     #endregion
     #region Paramètres
     if (currentVideotape.Mode == "dvsd")
     {
         BasePath = Disque + @"\Vidéos\DVRender SD\";
     }
     else
     {
         BasePath = Disque + @"\Vidéos\HDWRITER\";
     }
     #endregion
     Cursor = Cursors.WaitCursor;
     displayScenesPanel.Init(currentVideotape);
     timeLine.Init(currentVideotape);
     currentScene = currentVideotape.Scenes.First();
     sceneIndexControl.SetScene(currentScene);
     timeLine.SetStart(currentScene);
     Cursor = Cursors.Default;
     return;
 }
Exemple #8
0
        private void DisplayPanel_Paint(object sender, PaintEventArgs e)
        {
            if ((scenes == null) || (scenes.Count == 0))
            {
                return;
            }
            int x       = 0;
            int y       = 0;
            int largeur = (int)(scenes[0].Videos.Largeur * ImageZoomFactor) / Facteur;
            int hauteur = (int)(scenes[0].Videos.Hauteur * ImageZoomFactor) / Facteur;

            size = 6;
            int  fontSize = (int)(size * ImageZoomFactor);
            int  interval = (int)(2 * size * ImageZoomFactor);
            Font f        = new Font("Times New Roman", fontSize);

            imagesPerRow           = Math.Max(1, Width / largeur);
            scrollPictures.Maximum = scenes.Count;
            scrollPictures.Value   = startImage / imagesPerRow;
            x = 0; y = 0;
            //Scenes s = scenes.FirstOrDefault(m => m.Selected);
            //if (s != null)
            //    startImage = scenes.IndexOf(s);
            for (int i = startImage; i < scenes.Count; i++)
            {
                try
                {
                    #region Show image Data
                    scrollPictures.Value = startImage;
                    Scenes scene = scenes[i];
                    if (scene.Selected)
                    {
                        Pen p = new Pen(new SolidBrush(Color.Red), 3);
                        e.Graphics.DrawRectangle(p, new Rectangle(x, y, largeur, hauteur));
                    }
                    if (scene.Image != null)
                    {
                        MemoryStream mi  = new MemoryStream(scene.Image);
                        Image        imi = Image.FromStream(mi);
                        e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur));
                        imi.Dispose();
                        GC.Collect();
                    }
                    else
                    {
                        if (scene.SequenceScene.Count > 0)
                        {
                            MemoryStream mi  = new MemoryStream(scene.SequenceScene.First().Shots.Image);
                            Image        imi = Image.FromStream(mi);
                            e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur));
                            imi.Dispose();
                            GC.Collect();
                        }
                    }
                    Détails = true;
                    List <string> textes = new List <string>
                    {
                        scene.FrameCount.ToString() + " Frames soit " + Videos.DuréeShot((int)scene.FrameCount),
                        scene.Titre + " ",
                        scene.Lieux?.Villes.Nom + " " + scene.Lieux?.Lieu
                    };
                    string deb = scene.SequenceScene.FirstOrDefault().Shots.DateShot.Value.ToShortDateString();
                    if (scene.SequenceScene.First().Shots.Fichier.Contains("Clip"))
                    {
                        string s   = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier);
                        int    ind = s.IndexOf("Clip ") + 4;
                        s = s.Substring(ind, s.Length - ind);
                        string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier);
                        ind = ll.IndexOf("Clip ") + 4;
                        ll  = ll.Substring(ind, ll.Length - ind);
                        textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll);
                    }
                    else
                    {
                        string s  = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier);
                        string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier);
                        textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll);
                    }
                    nombreLignes = 0;;
                    if (Détails)
                    {
                        foreach (string s in textes)
                        {
                            e.Graphics.DrawString(s, f, Brushes.Black, new Point(x, y + hauteur + nombreLignes * interval));
                            nombreLignes++;
                        }
                    }
                    x += largeur;
                    if (x > Width - largeur)
                    {
                        x  = 0;
                        y += hauteur;
                        if (Détails)
                        {
                            y += nombreLignes * interval;
                        }
                    }
                    #endregion
                    if (y > Height)
                    {
                        return;
                    }
                }
                catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); }
            }
        }
Exemple #9
0
        private void DisplayPanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (((ModifierKeys & Keys.Control) == Keys.Control))
            {
                if (e.Button == MouseButtons.Left)
                {
                    selectedScenes.Add(Trouve(e));
                }
                else if (e.Button == MouseButtons.Right)
                {
                    #region Menu contextuel
                    if (selectedScenes.Count > 0)
                    {
                        ContextMenuStrip  mnu         = new ContextMenuStrip();
                        ToolStripMenuItem contextMenu = null; //new ToolStripMenuItem("Split scene");
                        switch (selectedScenes.Count)
                        {
                        case 0:
                            return;

                        case 1:
                            contextMenu = new ToolStripMenuItem("Split scene");
                            break;

                        default:
                            contextMenu = new ToolStripMenuItem("Fuse scenes");
                            break;
                        }
                        contextMenu.Click += new EventHandler(ContextMenu_Click);
                        mnu.Items.Add(contextMenu);
                        string[] Menus = new string[] { "Liste", "Liste détaillée", "Liste scène sélectionnée", "Liste détaillée scène sélectionnée", "Lieu", "Titre", "Commentaire", "Mots Clés", "Personne", "Play" };

                        foreach (string s in Menus)
                        {
                            contextMenu        = new ToolStripMenuItem(s);
                            contextMenu.Click += new EventHandler(ContextMenu_Click);
                            mnu.Items.Add(contextMenu);
                        }
                        mnu.Show((Control)sender, e.Location, ToolStripDropDownDirection.BelowRight);
                    }
                    #endregion
                }
            }
            else
            {
                if ((scenes != null) | (scenes.Count == 0))
                {
                    scenes.ForEach(s => s.Selected = false);
                    Refresh();
                    if (selectedScenes != null)
                    {
                        selectedScenes.Clear();
                    }
                    Scenes sc = Trouve(e);
                    if (sc != null)
                    {
                        SceneSelected?.Invoke(this, new SceneSelectedArgs {
                            scene = sc
                        });
                    }
                }
            }
        }
Exemple #10
0
 public SceneCreatedArgs(Scenes s)
 {
     scene = s;
 }