111 |
111 |
112 } |
112 } |
113 public static VideoBook ConvertToVideoBook(LDTFile ldt, IRIFile iri) |
113 public static VideoBook ConvertToVideoBook(LDTFile ldt, IRIFile iri) |
114 { |
114 { |
115 |
115 |
116 |
116 Dictionary<String,PolemicElement> polemicElement = new Dictionary<string,PolemicElement>(); |
117 // Initialisation du VideoBook |
117 // Initialisation du VideoBook |
118 VideoBook _videoBook = new VideoBook() |
118 VideoBook _videoBook = new VideoBook() |
119 { |
119 { |
120 Title = ldt.Project.Title, |
120 Title = ldt.Project.Title, |
121 Author = new User() |
121 Author = new User() |
136 { |
136 { |
137 int chapter = 0; |
137 int chapter = 0; |
138 |
138 |
139 foreach (IRIElement elem in Iens.Decoupages[0].Elements) |
139 foreach (IRIElement elem in Iens.Decoupages[0].Elements) |
140 { |
140 { |
141 _videoBook.Chapters[chapter].Index.Add(new SegmentIndex(_videoBook.Chapters[chapter]) |
141 SegmentIndex Si = new SegmentIndex(_videoBook.Chapters[chapter]) |
142 { |
142 { |
143 Id = elem.Id, |
143 Id = elem.Id, |
144 Title = elem.Title, |
144 Title = elem.Title, |
145 Description = elem.Abstract, |
145 Description = elem.Abstract, |
146 Tags = elem.Tags, |
146 Tags = elem.Tags, |
147 TimerIn = elem.Begin, |
147 TimerIn = elem.Begin, |
148 Duration = elem.Dur |
148 Duration = elem.Dur |
149 |
149 |
150 }); |
150 }; |
|
151 _videoBook.Chapters[chapter].Index.Add(Si); |
151 totalDur += elem.Dur; |
152 totalDur += elem.Dur; |
|
153 polemicElement.Add(Si.Id, Si); |
152 } |
154 } |
153 chapter++; |
155 chapter++; |
154 } |
156 } |
155 |
157 |
156 Dictionary<String, String> BasicRelation = new Dictionary<string, string>(); |
158 Dictionary<String, String> BasicRelation = new Dictionary<string, string>(); |
164 int chapterIndex = 0; |
166 int chapterIndex = 0; |
165 foreach(LDTAnnotationsDecoupage LDTAD in LDTAC.Content) |
167 foreach(LDTAnnotationsDecoupage LDTAD in LDTAC.Content) |
166 { |
168 { |
167 User author = new User() {UserName = LDTAD.Author }; |
169 User author = new User() {UserName = LDTAD.Author }; |
168 LDTElement elem = LDTAD.Elements[0]; |
170 LDTElement elem = LDTAD.Elements[0]; |
169 |
171 Annotation an = new Annotation(_videoBook.Chapters[chapterIndex]) |
170 _videoBook.Chapters[chapterIndex].Annotations.Add( |
172 { |
171 new Annotation(_videoBook.Chapters[chapterIndex]) |
173 Id = elem.Id, |
172 { |
174 Title = elem.Title, |
173 Id = elem.Id, |
175 Description = elem.Abstract, |
174 Title = elem.Title, |
176 Tags = elem.Tags, |
175 Description = elem.Abstract, |
177 TimerIn = new TimeSpan(0, 0, 0, 0, (int)elem.Begin), |
176 Tags = elem.Tags, |
178 Duration = new TimeSpan(0, 0, 0, 0, (int)elem.Dur), |
177 TimerIn = new TimeSpan(0, 0, 0, 0, (int)elem.Begin), |
179 Type = FactoryVideoLivre.DictionaryAnnotationDescriptions[BasicRelation[elem.Id]], |
178 Duration = new TimeSpan(0, 0, 0, 0, (int)elem.Dur), |
180 Contributer = author |
179 Type = FactoryVideoLivre.DictionaryAnnotationDescriptions[BasicRelation[elem.Id]], |
181 |
180 Contributer = author |
182 }; |
181 |
183 _videoBook.Chapters[chapterIndex].Annotations.Add(an |
182 }); |
184 ); |
|
185 polemicElement.Add(an.Id,an); |
183 |
186 |
184 |
187 |
185 } |
188 } |
186 chapterIndex++; |
189 chapterIndex++; |
|
190 } |
|
191 foreach (LDTRelation Rel in ldt.BasicRelations) |
|
192 { |
|
193 _videoBook.BasicLinks.Add(new PolemicLink() |
|
194 { |
|
195 FromElement = (polemicElement[Rel.IdElementFrom]), |
|
196 ToElement = polemicElement[Rel.IdElementTo], |
|
197 Title = Rel.Title, |
|
198 Type = FactoryVideoLivre.DictionaryAnnotationDescriptions[Rel.Type] |
|
199 |
|
200 }); |
187 } |
201 } |
188 _videoBook.Duration = iri.Body.Medias[0].Videos[0].Dur; |
202 _videoBook.Duration = iri.Body.Medias[0].Videos[0].Dur; |
189 _videoBook.LdtPath = ldt.Path; |
203 _videoBook.LdtPath = ldt.Path; |
190 return _videoBook; |
204 return _videoBook; |
191 } |
205 } |