--- a/client/src/Iri.Modernisation.Data/Ldt/Readers.cs Tue Jan 19 09:49:56 2010 +0100
+++ b/client/src/Iri.Modernisation.Data/Ldt/Readers.cs Mon Jan 25 09:30:22 2010 +0100
@@ -18,7 +18,9 @@
{
LDTFile _ldtFile = new LDTFile();
_ldtFile.Load(Path);
+
VideoBook _videoBook = new VideoBook();
+
if (_ldtFile != null)
{
// Initialisation du VideoBook
@@ -32,7 +34,7 @@
},
Duration = new TimeSpan(),
IriPath = _ldtFile.Medias[0].Src,
- LdtPath = Path.BaseUri,
+ LdtPath = _ldtFile.Path,
};
@@ -107,5 +109,114 @@
}
}
+ public static VideoBook ConvertToVideoBook(LDTFile ldt, IRIFile iri)
+ {
+ VideoBook _videoBook = new VideoBook();
+ // Initialisation du VideoBook
+ _videoBook = new VideoBook()
+ {
+ Title = ldt.Project.Title,
+ Author = new User()
+ {
+ UserName = ldt.Project.User,
+
+ },
+ Duration = new TimeSpan(),
+ IriPath = ldt.Medias[0].Src,
+ LdtPath = ldt.Path,
+
+ };
+
+ // Initialisation des index
+
+ foreach (LDTAnnotationsContent LDTAC in ldt.Annotations)
+ {
+ //int count = 0;
+ int decoupage = LDTAC.Content[2].Elements.Count / 4;
+ //int selectedChapter = 0;
+
+ for (int eloop = 0; eloop < iri.Body.Ensembles.Count; eloop++)
+ {
+ if (iri.Body.Ensembles[eloop].Id == "VideoBookIndex")
+ {
+ for (int dloop = 0; dloop < iri.Body.Ensembles[eloop].Decoupages.Count; dloop++)
+ {
+ if(iri.Body.Ensembles[eloop].Decoupages[dloop].Id=="Index")
+ {
+ foreach (IRIElement elem in iri.Body.Ensembles[eloop].Decoupages[dloop].Elements)
+ {
+ _videoBook.Chapters[elem.Chapter].Index.Add(new SegmentIndex(_videoBook.Chapters[elem.Chapter])
+ {
+ Id = elem.Id,
+ Title = elem.Title,
+ Description = elem.Abstract,
+ Tags = elem.Tags,
+ TimerIn = elem.Begin,
+ Duration = elem.Dur
+
+ });
+ }
+ }
+ }
+ break;
+
+ }
+ }
+ /*
+ foreach (LDTElement LDTE in LDTAC.Content[2].Elements)
+ {
+ _videoBook.Chapters[selectedChapter].Index.Add(new SegmentIndex(_videoBook.Chapters[selectedChapter])
+ {
+ Id = LDTE.Id,
+ Title = LDTE.Title,
+ Description = LDTE.Abstract,
+ Tags = LDTE.Tags,
+ TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin),
+ Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur),
+
+ });
+ count++;
+ if (count % decoupage == 0)
+ {
+ selectedChapter++;
+ if (selectedChapter >= 4)
+ {
+ selectedChapter = 3;
+ }
+ }
+
+ _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur));
+ }*/
+ foreach (LDTElement LDTE in LDTAC.Content[3].Elements)
+ {
+ _videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0])
+ {
+ Id = LDTE.Id,
+ Title = LDTE.Title,
+ Description = LDTE.Abstract,
+ Tags = LDTE.Tags,
+ TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin),
+ Duration = new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur + 5000)),
+ Type = FactoryVideoLivre.AnnotationDescriptions[0]
+ });
+ // _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur)));
+ }
+ foreach (LDTElement LDTE in LDTAC.Content[1].Elements)
+ {
+ _videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0])
+ {
+ Title = LDTE.Title,
+ Description = LDTE.Abstract,
+ Tags = LDTE.Tags,
+ TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin),
+ Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur),
+ Type = FactoryVideoLivre.AnnotationDescriptions[1]
+ });
+ // _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur));
+ }
+
+ }
+ return _videoBook;
+ }
}
}