crea/integration/generator.html
changeset 2 44deeff592e2
child 15 f1d070549d94
equal deleted inserted replaced
1:e69e78a0b5e6 2:44deeff592e2
       
     1 <!DOCTYPE html>
       
     2 <html lang="fr">
       
     3     <head>
       
     4         <meta charset="utf-8" />
       
     5         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
       
     6         <title>Musitag - Futur en Seine 2012</title>
       
     7         <link rel="stylesheet" type="text/css" href="css/musitag.css" />
       
     8         <script type="text/javascript" src="libs/underscore-min.js"></script>
       
     9         <script type="text/javascript" src="metadataplayer/LdtPlayer-core.js"></script>
       
    10 
       
    11     </head>
       
    12     <body>
       
    13  
       
    14     <script type="text/javascript">
       
    15     
       
    16     IriSP._ = _;
       
    17     
       
    18     var _directory = new IriSP.Model.Directory(),
       
    19         _source = _directory.newLocalSource({
       
    20             serializer: IriSP.serializers.ldt
       
    21         }),
       
    22         _mediaList = new IriSP.Model.List(_directory),
       
    23         _annotationList = new IriSP.Model.List(_directory),
       
    24         _tagList = new IriSP.Model.List(_directory),
       
    25         _annotationTypeList = new IriSP.Model.List(_directory),
       
    26         _colors = ['red','yellow','green','blue'],
       
    27         _emoticons = ['happy','unhappy','laughing','surprised'],
       
    28         _alltags = _colors.concat(_emoticons),
       
    29         _duration = 147000;
       
    30     
       
    31     
       
    32     var _media = new IriSP.Model.Media('au-clair-de-la-lune',_source);
       
    33     _media.video = 'media/wari_0710.mp3';
       
    34     _media.setDuration(_duration);
       
    35     _media.title = "Au Clair de La Lune";
       
    36     _media.description = "Steve Waring";
       
    37     _mediaList.push(_media);
       
    38     
       
    39     var _annotationType = new IriSP.Model.Media('musitag',_source);
       
    40     _annotationType.title = "Musitag";
       
    41     _annotationType.description = "Une couleur + une émotion, déposés par Musitag";
       
    42     _annotationTypeList.push(_annotationType);
       
    43     
       
    44     _alltags.forEach(function(_name) {
       
    45         var _tag = new IriSP.Model.Tag(_name, _source);
       
    46         _tag.title = _name;
       
    47         _tagList.push(_tag);
       
    48     });
       
    49     
       
    50     for (var _i = 0; _i < 50; _i++) {
       
    51         var _time = Math.floor(_duration * Math.random()),
       
    52             _color = _colors[Math.floor(4*Math.random())],
       
    53             _emoticon = _emoticons[Math.floor(4*Math.random())],
       
    54             _annotation = new IriSP.Model.Annotation('annotation-'+_i,_source);
       
    55         _annotation.setTags([_color,_emoticon]);
       
    56         _annotation.setBegin(_time);
       
    57         _annotation.setEnd(_time);
       
    58         _annotation.setAnnotationType('musitag');
       
    59         _annotation.setMedia('au-clair-de-la-lune');
       
    60         _annotation.created = new Date();
       
    61         _annotation.creator = "Math.random()";
       
    62         _annotation.description = _color + " " + _emoticon;
       
    63         _annotationList.push(_annotation);
       
    64     }
       
    65     
       
    66     _source.addList('media',_mediaList);
       
    67     _source.addList('tag',_tagList);
       
    68     _source.addList('annotationType',_annotationTypeList);
       
    69     _source.addList('annotation',_annotationList);
       
    70     
       
    71     console.log(_source);
       
    72     console.log(_source.serialize());
       
    73     </script>
       
    74     </body>
       
    75 </html>