@@ -722,50 +722,50 @@ def create_manifest3(identifier, domain=None, page=None):
722
722
duration = float (file ['length' ])
723
723
filedata = file
724
724
725
- # create the canvases for each original
726
- for file in [f for f in originals if f ['format' ] in ['MPEG4' , 'h.264 HD' , 'h.264 MPEG4' , '512Kb MPEG4' , 'HiRes MPEG4' , 'MPEG2' , 'h.264' , 'Matroska' , 'Ogg Video' , 'Ogg Theora' , 'WebM' , 'Windows Media' , 'Cinepack' ,'QuickTime' ]]:
727
- normalised_id = file ['name' ].rsplit ("." , 1 )[0 ]
728
- slugged_id = normalised_id .replace (" " , "-" )
729
- c_id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /canvas"
730
- c = Canvas (id = c_id , label = normalised_id , duration = duration , height = int (filedata ['height' ]), width = int (filedata ['width' ]))
731
-
732
- ap = AnnotationPage (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /page" )
733
-
734
- vttAPId = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /vtt"
735
- vtAnno = c .make_annotation (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /annotation/vtt/streamed" ,
736
- motivation = "supplementing" ,
737
- target = c .id ,
738
- anno_page_id = vttAPId ,
739
- body = {"id" : f"{ domain } vtt/streaming/{ identifier } .vtt" ,
740
- "type" : "Text" ,
741
- "format" : "text/vtt" ,
742
- })
725
+ # create the canvases for each original
726
+ for file in [f for f in originals if f ['format' ] in ['MPEG4' , 'h.264 HD' , 'h.264 MPEG4' , '512Kb MPEG4' , 'HiRes MPEG4' , 'MPEG2' , 'h.264' , 'Matroska' , 'Ogg Video' , 'Ogg Theora' , 'WebM' , 'Windows Media' , 'Cinepack' ,'QuickTime' ]]:
727
+ normalised_id = file ['name' ].rsplit ("." , 1 )[0 ]
728
+ slugged_id = normalised_id .replace (" " , "-" )
729
+ c_id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /canvas"
730
+ c = Canvas (id = c_id , label = normalised_id , duration = duration , height = int (filedata ['height' ]), width = int (filedata ['width' ]))
743
731
744
- segments = math .floor (duration / 60 )
745
- for i in range (segments ):
746
- start = i * 60
747
- if i == segments - 1 :
748
- end = int (duration )
749
- else :
750
- end = (i + 1 ) * 60
751
-
752
- #print (f"Start: {start} End: {end}, Duration: {float(end) - float(start)} full duration: {duration}")
753
- anno = Annotation (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /annotation/{ i } " , motivation = "painting" , target = f"{ c .id } #t={ start } ,{ end } " )
754
- streamurl = f"https://{ metadata ['server' ]} { metadata ['dir' ]} /{ mp4File } ?start={ start } &end={ end } &ignore=x.mp4&cnt=0"
755
- body = ResourceItem (id = streamurl ,
756
- type = 'Video' ,
757
- format = "video/mp4" ,
758
- label = {"en" : [f"Part { i + 1 } of { segments } " ]},
759
- duration = end - start ,
760
- height = int (filedata ['height' ]),
761
- width = int (filedata ['width' ]),
762
- )
732
+ ap = AnnotationPage (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /page" )
763
733
764
- anno .body = body
765
- ap .add_item (anno )
766
-
767
- c .add_item (ap )
768
- manifest .add_item (c )
734
+ vttAPId = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /vtt"
735
+ vtAnno = c .make_annotation (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /annotation/vtt/streamed" ,
736
+ motivation = "supplementing" ,
737
+ target = c .id ,
738
+ anno_page_id = vttAPId ,
739
+ body = {"id" : f"{ domain } vtt/streaming/{ identifier } .vtt" ,
740
+ "type" : "Text" ,
741
+ "format" : "text/vtt" ,
742
+ })
743
+
744
+ segments = math .floor (duration / 60 )
745
+ for i in range (segments ):
746
+ start = i * 60
747
+ if i == segments - 1 :
748
+ end = int (duration )
749
+ else :
750
+ end = (i + 1 ) * 60
751
+
752
+ #print (f"Start: {start} End: {end}, Duration: {float(end) - float(start)} full duration: {duration}")
753
+ anno = Annotation (id = f"{ URI_PRIFIX } /{ identifier } /{ slugged_id } /annotation/{ i } " , motivation = "painting" , target = f"{ c .id } #t={ start } ,{ end } " )
754
+ streamurl = f"https://{ metadata ['server' ]} { metadata ['dir' ]} /{ mp4File } ?start={ start } &end={ end } &ignore=x.mp4&cnt=0"
755
+ body = ResourceItem (id = streamurl ,
756
+ type = 'Video' ,
757
+ format = "video/mp4" ,
758
+ label = {"en" : [f"Part { i + 1 } of { segments } " ]},
759
+ duration = end - start ,
760
+ height = int (filedata ['height' ]),
761
+ width = int (filedata ['width' ]),
762
+ )
763
+
764
+ anno .body = body
765
+ ap .add_item (anno )
766
+
767
+ c .add_item (ap )
768
+ manifest .add_item (c )
769
769
else :
770
770
# create the canvases for each original
771
771
for file in [f for f in originals if f ['format' ] in ['MPEG4' , 'h.264 MPEG4' , '512Kb MPEG4' , 'HiRes MPEG4' , 'MPEG2' , 'h.264' , 'Matroska' , 'Ogg Video' , 'Ogg Theora' , 'WebM' , 'Windows Media' , 'Cinepack' ]]:
0 commit comments