Changeset 3213

Show
Ignore:
Timestamp:
2007-08-30 04:53:07 (1 year ago)
Author:
dcrowdy
Message:

Fixed problems creating clip images when importing cmml files; cleaned up the appearance.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • arkaiv/trunk/TODO

    r3210 r3213  
    11TODO 
     2 
     3Handle whitespace in a source file name - doesn't do this at all at the moment 
    24 
    35When going to an item from a clip link on the search results page, any 
  • arkaiv/trunk/arkaiv/controllers/page.py

    r3210 r3213  
    229229        # create an image to display for the clip 
    230230        if has_video == "Yes": 
    231             basename = os.path.splitext(cmmlfile)[0] 
    232             imagedirname = basename + "_clipimages" 
    233             clipimagename = str(clip['starttime']) + ".png" 
    234             oggsource = model.getsourcepath(clip['itemid']) 
    235             cwd = os.getcwd() 
    236             os.chdir(imagedirname)  # ugly... 
    237             frameimage = Frame(oggsource, clip['starttime'], clipimagename)     
    238             os.chdir(cwd)   # very ugly... # 
    239  
    240             # add that info to the dictionary - only needs to be a relative 
    241             # location 
    242  
    243             relpath = os.path.split(imagedirname)[1] 
    244             clip['img_src'] = relpath + "/" + clipimagename  
     231            clip['img_src'] = self.__createimageforclip(cmmlfile, clip) 
     232#            basename = os.path.splitext(cmmlfile)[0] 
     233#            imagedirname = basename + "_clipimages" 
     234#            clipimagename = str(clip['starttime']) + ".png" 
     235#            oggsource = model.getsourcepath(clip['itemid']) 
     236#            cwd = os.getcwd() 
     237#            os.chdir(imagedirname)  # ugly... 
     238#            frameimage = Frame(oggsource, clip['starttime'], clipimagename)     
     239#            os.chdir(cwd)   # very ugly... # 
     240
     241#            # add that info to the dictionary - only needs to be a relative 
     242#            # location 
     243
     244#            relpath = os.path.split(imagedirname)[1] 
     245#            clip['img_src'] = relpath + "/" + clipimagename  
     246 
    245247        else: 
    246248            clip['img_src'] = "" 
     
    285287        if cmmlsource=="": 
    286288            print "creating source file" 
    287             basecmmlname = os.path.splitext(oggsource.filename)[0] + ".cmml" 
     289            basecmmlname = os.path.splitext(oggsource.filename)[0].replace(' ',"") + ".cmml" 
    288290            newcmmlname = os.path.join(archive_loc, basecmmlname) 
    289291            parser = cmmlParser() 
     
    293295 
    294296        else: 
    295             newcmmlname = os.path.join(archive_loc, cmmlsource.filename
     297            newcmmlname = os.path.join(archive_loc, cmmlsource.filename.replace(' ',"")
    296298            permanent_file = open(newcmmlname, 'w') 
    297299            shutil.copyfileobj(cmmlsource.file, permanent_file) 
     
    300302            
    301303            # Now the ogg file... 
    302         newoggname = os.path.join(archive_loc, oggsource.filename) 
     304        # FIXME whitespace is dealt with in a very clumsy manner 
     305        newoggname = os.path.join(archive_loc, oggsource.filename.replace(' ', "")) 
    303306        permanent_file = open(newoggname, 'w') 
    304307        shutil.copyfileobj(oggsource.file, permanent_file) 
     
    313316            os.makedirs(imagedirname, mode=0755) 
    314317 
    315 #        cmd = "mplayer -vo png:z=6 -vf scale -zoom -xy 96 -ao null -ss '1000' -frames 2 " + newoggname  
    316 #        cwd = os.getcwd() 
    317 #        os.chdir(imagedirname) 
    318 # 
    319 #        runit = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE 
    320 #, stderr=subprocess.PIPE) 
    321 #        out, err = runit.communicate() 
    322 #        os.chdir(cwd)   # very ugly... better image creation needed allround really. 
    323318                 
    324319        # Get the title for the item (head title) 
     
    346341        # Now extract any clip information and add it to the database 
    347342            # get a list of dictionary objects 
    348         cliplist = parser.getclipsfromcmml(newcmmlname)   
     343 
     344        o = OggzInfo(newoggname) 
     345        cliplist = parser.getclipsfromcmml()   
    349346        for clipdict in cliplist: 
    350347            clipdict['itemid'] = newitemid 
     348            if o.has_video(): 
     349                # get a still image for the correct frame 
     350                print "getting a clip image" 
     351                #clipdict['img_src'] = "" 
     352                clipdict['img_src'] = self.__createimageforclip(newcmmlname, clipdict) 
     353            else: 
     354                clipdict['img_src'] = "" 
    351355            model.addclip(clipdict) 
    352356 
     
    422426        files = os.listdir(directory) 
    423427        for file in files: 
    424             if os.path.splitext(file)[1] == ".cmml": 
    425                 oggfilename = directory + os.path.splitext(file)[0] + ".ogg" 
    426                 cmmlfilename = directory + file 
    427                 print "importing: " + cmmlfilename + " " + oggfilename 
    428                 self.__localdirimport(cmmlfilename, oggfilename) 
    429             else: 
    430                 print "moving right past: " + file 
    431  
     428            try: 
     429                if os.path.splitext(file)[1] == ".cmml": 
     430                    oggfilename = directory + os.path.splitext(file)[0] + ".ogg" 
     431                    cmmlfilename = directory + file 
     432                    print "importing: " + cmmlfilename + " " + oggfilename 
     433                    self.__localdirimport(cmmlfilename, oggfilename) 
     434                else: 
     435                    print "moving right past: " + file 
     436            except: 
     437                print " problem with " + file 
    432438        return 
    433439  
     
    469475        # Now extract any clip information and add it to the database 
    470476        # get a list of dictionary objects 
    471         cliplist = parser.getclipsfromcmml(newcmmlname)   
     477        cliplist = parser.getclipsfromcmml()   
    472478        for clipdict in cliplist: 
    473479            clipdict['itemid'] = newitemid 
     
    498504        return           
    499505 
    500  
     506    def __createimageforclip(self, cmmlfile, clipinfo): 
     507#        print "cmmlfile: " + cmmlfile 
     508#        print clipinfo 
     509        basename = os.path.splitext(cmmlfile)[0] 
     510#        print basename 
     511        imagedirname = basename + "_clipimages" 
     512        clipimagename = str(clipinfo['starttime']) + ".png" 
     513#        print "clip name: " + clipimagename 
     514        oggsource = model.getsourcepath(clipinfo['itemid']) 
     515#        print oggsource 
     516        cwd = os.getcwd() 
     517#        print cwd 
     518        os.chdir(imagedirname)  # ugly... 
     519        frameimage = Frame(oggsource, int(clipinfo['starttime']), clipimagename)     
     520        print "after frameimage" 
     521        os.chdir(cwd)   # very ugly... # 
     522 
     523        # add that info to the dictionary - only needs to be a relative 
     524        # location 
     525        relpath = os.path.split(imagedirname)[1] 
     526        imagefile = relpath + "/" + clipimagename 
     527#        print imagefile 
     528        return imagefile 
     529 
  • arkaiv/trunk/arkaiv/model/cmmlparser.py

    r3209 r3213  
    8888        return title 
    8989 
    90     def getclipsfromcmml(self, cmmlfilename): 
    91         Etree = ElementTre
    92         doc = Etree.parse(cmmlfilename) 
    93         root = doc.getroot() 
    94         clips = root.getiterator('clip') 
     90    def getclipsfromcmml(self): 
     91        """ returns a dictionary of clips from the object's cmmlfil
     92 
     93        """ 
     94        clips = self.root.getiterator('clip') 
    9595        cliplist = [] 
    9696        for clip in clips: 
     
    100100            desc = clip.find('desc') 
    101101            clipdict['desc'] = desc.text 
    102             clipdict['a_href'] = None 
    103             clipdict['a_text'] = None 
    104             clipdict['img_src'] = None 
     102            clipdict['a_href'] = None  # FIXME 
     103            clipdict['a_text'] = None  # FIXME 
     104            clipdict['img_src'] = None # FIXME 
    105105 
    106106            cliplist.append(clipdict) 
     
    143143            newclip.set('id', clip['id']) 
    144144            img = Etree.SubElement(newclip, 'img') 
    145             img.set('src', clip['img_src']
     145            img.set('src', str(clip['img_src'])
    146146            desc = Etree.SubElement(newclip, 'desc') 
    147147            desc.text = clip['desc'] 
  • arkaiv/trunk/arkaiv/public/quick.css

    r3208 r3213  
    11body { 
    2     font-family: sans-serif; 
    3     background-color: #888; 
     2    font-family: Helvetica, Verdana, Arial, sans-serif; 
     3    font-size: small; 
     4    background-color: #efefef; 
    45    margin: 25px; 
    56} 
     7a:link{ 
     8    color: #369; 
     9} 
     10a:visited{ 
     11    color: #00f; 
     12} 
     13a:hover{ 
     14    color: #000; 
     15} 
     16a:active{ 
     17    color: #666; 
     18} 
     19 
     20 
    621div.content{ 
    722    font-family: sans-serif; 
    823    margin: 0; 
    924    margin-bottom: 10px; 
    10     background-color: #d3e0ea; 
     25    background-color: #ccc; /*#d3e0ea */ 
    1126    border: 5px solid #333; 
    12     padding: 5px 25px 25px 25px; 
     27/*    padding: 5px 25px 25px 25px;*/ 
    1328} 
    1429#video{ 
    1530    float: left; 
    16     width: 60%; 
    17     background-color: #d3e0ea; 
     31    width: 50%; 
     32/*    max-width: 350px*/ 
     33    background-color: #ccc; 
    1834    font-family: sans-serif; 
    19     font-size: small 
     35    font-size: small; 
     36    /*padding: 10px 20px 10px 40px;*/ 
     37    padding-left: 10px; 
    2038} 
    2139#clips{ 
    2240    float: left; 
    23     width: 40%; 
     41    width: 45%; 
    2442    height: 500px; 
    2543    overflow: scroll; 
    2644    font-family: sans-serif; 
    2745    font-size: small 
     46    padding-left: 10px; 
    2847} 
    2948 
     
    3150    font-size: small 
    3251} 
     52 
    3353h1.main{ 
    3454    width: 100%; 
    3555    border-bottom: 1px solid #000; 
    3656} 
     57 
    3758p.footer{ 
    3859    width: 100%; 
    3960    padding-top: 3px; 
    40     border-top: 1px solid #000; 
     61    /*border-top: 1px solid #000;*/ 
    4162} 
    4263 
     64#navcontainer ul { 
     65        padding-left: 0; 
     66        margin-left: 0; 
     67        background-color: #036; 
     68        color: #fff; 
     69        float: left; 
     70        /*height: 40px;*/ 
     71        font-size: 18px; 
     72        width: 100%; 
     73        font-family: Helvetica, Verdana, Arial, sans-serif; 
     74} 
     75 
     76#navcontainer ul li { display: inline; } 
     77 
     78#navcontainer ul li a { 
     79        padding: 0.7em 1em; 
     80        /* padding: 11px 15px; */ 
     81        background-color: #036; 
     82        color: #fff; 
     83        text-decoration: none; 
     84        float: left; 
     85        border-right: 1px solid #fff; 
     86} 
     87 
     88#navcontainer ul li .searchpadding { 
     89        /* padding: 0.6em 1em;*/ 
     90        padding: 10px 15px 11px 15px; 
     91        background-color: #036; 
     92        color: #fff; 
     93        text-decoration: none; 
     94        float: left; 
     95        border-right: 1px solid #fff; 
     96} 
     97 
     98#navcontainer ul li a:hover { 
     99        background-color: #369; 
     100        color: #fff; 
     101} 
     102 
     103#navcontainer ul li a:active { 
     104        background-color: #fb0; 
     105        color: #fff; 
     106} 
     107 
  • arkaiv/trunk/arkaiv/templates/autohandler

    r3208 r3213  
    77    </head> 
    88    <body> 
    9         <p class="header"> 
     9<p class="header"> 
    1010<h1>Arkaiv</h1> 
    11 <table cellpadding="10"> 
    12 <tr
    13 <td>${ h.link_to("All Items", h.url(action="mainpage")) } </td
    14 <td>${ h.link_to("Collections", h.url(action="collections")) } </td
    15 <td>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</td
    16 <td
    17 ${ h.form(h.url(action='search'), multipart=True) }  
     11<div id="navcontainer"> 
     12<ul id="navlist"
     13  <li>${ h.link_to("All Items", h.url(action="mainpage")) }</li
     14  <li>${ h.link_to("Collections", h.url(action="collections")) }</li
     15  <li>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</li
     16  <li><span class="searchpadding"
     17${ h.form(h.url(action='search'), multipart=True) } 
    1818${ h.text_field('searchterms', value="Search") }  
    1919<!--${ h.submit('Submit') }--> 
    2020${ h.end_form() }  
    21 </td> 
    22 </tr> 
    23 </table> 
    24         </p> 
     21  </span> 
     22  </li> 
     23</ul> 
     24</div> 
     25</p> 
     26 
    2527        <!--div class="content"--> 
    2628${next.body()} 
  • arkaiv/trunk/arkaiv/templates/displayitem.mak

    r3210 r3213  
    138138<tr> 
    139139  <td></td> 
    140   <td>Start time</td> 
    141   <td>Id</td> 
    142   <td>Description</td> 
    143   <td>a_href</td>  
     140  <td>Time</td> 
     141  <td></td> 
     142  <td></td>  
    144143</tr> 
    145144% for clipinfo in c.cliplist: 
     
    149148% endif 
    150149%     if c.sourcedict['has_video'] == "No": 
    151    <td><a onclick="javascript:SetLocation('${c.sourcedict['urlpath']}?id=${clipinfo['id']}')"><img src="/public/blank.png"></a></td> 
     150   <td><a onclick="javascript:SetLocation('${c.sourcedict['urlpath']}?id=${clipinfo['id']}')"><img src="/images/blank.png"></a></td> 
    152151% endif 
    153152    <td>${clipinfo['start_time']}</td> 
    154     <td>${clipinfo['id']}</td> 
    155153    <td>${clipinfo['desc']}</td> 
    156154    <td>${clipinfo['a_href']}</td> 
  • arkaiv/trunk/data/templates/autohandler.py

    r3208 r3213  
    22UNDEFINED = runtime.UNDEFINED 
    33_magic_number = 2 
    4 _modified_time = 1188364190.6814849 
     4_modified_time = 1188463289.27105 
    55_template_filename=u'/home/dcrowdy/src/working/test/arkaiv/trunk/arkaiv/templates/autohandler' 
    66_template_uri=u'/autohandler' 
     
    2020        # SOURCE LINE 5 
    2121        context.write(unicode( h.javascript_include_tag('/javascripts/effects.js', builtins=True) )) 
    22         context.write(u' \n\n    </head>\n    <body>\n        <p class="header">\n<h1>Arkaiv</h1>\n<table cellpadding="10">\n<tr>\n<td>') 
     22        context.write(u' \n\n    </head>\n    <body>\n<p class="header">\n<h1>Arkaiv</h1>\n<div id="navcontainer">\n<ul id="navlist">\n  <li>') 
    2323        # SOURCE LINE 13 
    2424        context.write(unicode( h.link_to("All Items", h.url(action="mainpage")) )) 
    25         context.write(u' </td>\n<td>') 
     25        context.write(u'</li>\n  <li>') 
    2626        # SOURCE LINE 14 
    2727        context.write(unicode( h.link_to("Collections", h.url(action="collections")) )) 
    28         context.write(u' </td>\n<td>') 
     28        context.write(u'</li>\n  <li>') 
    2929        # SOURCE LINE 15 
    3030        context.write(unicode( h.link_to("Add annodex media", h.url(action="addannodexform")) )) 
    31         context.write(u'</td>\n<td>\n') 
     31        context.write(u'</li>\n  <li><span class="searchpadding">\n') 
    3232        # SOURCE LINE 17 
    3333        context.write(unicode( h.form(h.url(action='search'), multipart=True) )) 
    34         context.write(u' \n') 
     34        context.write(u'\n') 
    3535        # SOURCE LINE 18 
    3636        context.write(unicode( h.text_field('searchterms', value="Search") )) 
     
    4141        # SOURCE LINE 20 
    4242        context.write(unicode( h.end_form() )) 
    43         context.write(u' \n</td>\n</tr>\n</table>\n        </p>\n        <!--div class="content"-->\n') 
    44         # SOURCE LINE 26 
     43        context.write(u' \n  </span>\n  </li>\n</ul>\n</div>\n</p>\n\n        <!--div class="content"-->\n') 
     44        # SOURCE LINE 28 
    4545        context.write(unicode(next.body())) 
    4646        context.write(u'\n        <p class="footer">\n        </p>\n        <!--/div-->\n    </body>\n</html>\n\n') 
  • arkaiv/trunk/data/templates/displayitem.mak.py

    r3210 r3213  
    22UNDEFINED = runtime.UNDEFINED 
    33_magic_number = 2 
    4 _modified_time = 1188430842.531039 
     4_modified_time = 1188439839.8722601 
    55_template_filename='/home/dcrowdy/src/working/test/arkaiv/trunk/arkaiv/templates/displayitem.mak' 
    66_template_uri='/displayitem.mak' 
     
    137137        # SOURCE LINE 127 
    138138        context.write(unicode(c.sourcedict['has_audio'])) 
    139         context.write(u'</td>\n</tr>\n</table>\n\n<!--/div!-->\n</div>\n\n<div id="clips">\nClips:\n<br />\n<table style="font-size:small">\n<tr>\n  <td></td>\n  <td>Start time</td>\n  <td>Id</td>\n  <td>Description</td>\n  <td>a_href</td> \n</tr>\n') 
    140         # SOURCE LINE 145 
     139        context.write(u'</td>\n</tr>\n</table>\n\n<!--/div!-->\n</div>\n\n<div id="clips">\nClips:\n<br />\n<table style="font-size:small">\n<tr>\n  <td></td>\n  <td>Time</td>\n  <td></td>\n  <td></td> \n</tr>\n') 
     140        # SOURCE LINE 144 
    141141        for clipinfo in c.cliplist: 
     142            # SOURCE LINE 145 
     143            context.write(u'<tr>\n') 
    142144            # SOURCE LINE 146 
    143             context.write(u'<tr>\n') 
    144             # SOURCE LINE 147 
    145145            if c.sourcedict['has_video'] == "Yes": 
    146                 # SOURCE LINE 148 
     146                # SOURCE LINE 147 
    147147                context.write(u'   <td><a onclick="javascript:SetLocation(\'') 
    148148                context.write(unicode(c.sourcedict['urlpath'])) 
     
    153153                context.write(unicode(clipinfo['img_src'])) 
    154154                context.write(u'"></a></td>\n') 
    155             # SOURCE LINE 150 
     155            # SOURCE LINE 149 
    156156            if c.sourcedict['has_video'] == "No": 
    157                 # SOURCE LINE 151 
     157                # SOURCE LINE 150 
    158158                context.write(u'   <td><a onclick="javascript:SetLocation(\'') 
    159159                context.write(unicode(c.sourcedict['urlpath'])) 
    160160                context.write(u'?id=') 
    161161                context.write(unicode(clipinfo['id'])) 
    162                 context.write(u'\')"><img src="/public/blank.png"></a></td>\n') 
    163             # SOURCE LINE 153 
     162                context.write(u'\')"><img src="/images/blank.png"></a></td>\n') 
     163            # SOURCE LINE 152 
    164164            context.write(u'    <td>') 
    165165            context.write(unicode(clipinfo['start_time'])) 
    166166            context.write(u'</td>\n    <td>') 
    167             # SOURCE LINE 154 
    168             context.write(unicode(clipinfo['id'])) 
    169             context.write(u'</td>\n    <td>') 
    170             # SOURCE LINE 155 
     167            # SOURCE LINE 153 
    171168            context.write(unicode(clipinfo['desc'])) 
    172169            context.write(u'</td>\n    <td>') 
    173             # SOURCE LINE 156 
     170            # SOURCE LINE 154 
    174171            context.write(unicode(clipinfo['a_href'])) 
    175172            context.write(u'</td>\n\n\n') 
    176             # SOURCE LINE 159 
     173            # SOURCE LINE 157 
    177174            context.write(unicode( h.form(h.url(action='deleteclip'), multipart=True) )) 
    178175            context.write(u'\n<td>') 
    179             # SOURCE LINE 160 
     176            # SOURCE LINE 158 
    180177            context.write(unicode( h.submit('Delete') )) 
    181178            context.write(u' </td>\n') 
    182             # SOURCE LINE 161 
     179            # SOURCE LINE 159 
    183180            context.write(unicode( h.hidden_field('clipid', value=clipinfo['ixc']) )) 
    184181            context.write(u'\n') 
    185             # SOURCE LINE 162 
     182            # SOURCE LINE 160 
    186183            context.write(unicode( h.hidden_field('itemid', value=c.itemid) )) 
    187184            context.write(u'\n') 
    188             # SOURCE LINE 163 
     185            # SOURCE LINE 161 
    189186            context.write(unicode( h.end_form() )) 
    190187            context.write(u' \n\n\n</tr> \n') 
    191         # SOURCE LINE 168 
     188        # SOURCE LINE 166 
    192189        context.write(u'</table>\n\nAdd new clip:\n') 
    193         # SOURCE LINE 171 
     190        # SOURCE LINE 169 
    194191        context.write(unicode( h.form(h.url(action='addclip'), multipart=True) )) 
    195192        context.write(u'\n<table style="font-size:small">\n<tr>\n    <td>Start time</td>\n  <td>') 
    196         # SOURCE LINE 175 
     193        # SOURCE LINE 173 
    197194        context.write(unicode( h.text_field('starttime', size=5) )) 
    198195        context.write(u'</td>\n    <td>a_text</td>\n  <td>') 
    199         # SOURCE LINE 177 
     196        # SOURCE LINE 175 
    200197        context.write(unicode( h.text_field('a_text') )) 
    201198        context.write(u'</td>\n</tr>\n<tr>\n    <td>Id</td>\n  <td>') 
    202         # SOURCE LINE 181 
     199        # SOURCE LINE 179 
    203200        context.write(unicode( h.text_field('id', size=5) )) 
    204201        context.write(u'</td>\n    <td>a_href</td>\n  <td>') 
    205         # SOURCE LINE 183 
     202        # SOURCE LINE 181 
    206203        context.write(unicode( h.text_field('a_href') )) 
    207204        context.write(u'</td>\n</tr>\n<tr>\n    <td>img_src</td>\n  <td>') 
    208         # SOURCE LINE 187 
     205        # SOURCE LINE 185 
    209206        context.write(unicode( h.text_field('img_src', size=5) )) 
    210207        context.write(u'</td>\n    <td>desc</td>\n  <td>') 
    211         # SOURCE LINE 189 
     208        # SOURCE LINE 187 
    212209        context.write(unicode( h.text_field('desc') )) 
    213210        context.write(u'</td>\n</tr>\n</table>\n') 
     211        # SOURCE LINE 190 
     212        context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) )) 
     213        context.write(u'\n') 
     214        # SOURCE LINE 191 
     215        context.write(unicode( h.hidden_field('itemid', value=c.itemid) )) 
     216        context.write(u'\n') 
    214217        # SOURCE LINE 192 
    215         context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) )) 
    216         context.write(u'\n') 
    217         # SOURCE LINE 193 
    218         context.write(unicode( h.hidden_field('itemid', value=c.itemid) )) 
    219         context.write(u'\n') 
    220         # SOURCE LINE 194 
    221218        context.write(unicode( h.hidden_field('hasvideo', value=c.sourcedict['has_video']) )) 
    222219        context.write(u'\n\n') 
    223         # SOURCE LINE 196 
     220        # SOURCE LINE 194 
    224221        context.write(unicode( h.submit('Add') )) 
    225222        context.write(u' \n') 
    226         # SOURCE LINE 197 
     223        # SOURCE LINE 195 
    227224        context.write(unicode( h.end_form() )) 
    228225        context.write(u' \n</div>\n<script>\nvar plugin = document.embeds[0];\nvar input  = document.api.ifield;\nvar goto  = document.api.gotofield;\nvar output = document.api.ofield;\n\nfunction Play() {\n  plugin.play();\n  addOutput("Play!");\n}\n\nfunction Pause() {\n  plugin.pause();\n  addOutput("Pause!");\n}\n\nfunction SetLocation(location) {\n//  plugin.setPlayPosition(location);\n  plugin.setCurrentMovie(location);\n  addOutput("Current movie: " + plugin.getCurrentMovie());\n  addOutput("setting a location: " + location + " ms");\n}\n\nfunction GetPlayPosition() {\n  addOutput("Play position: " + plugin.getPlayPosition() + " ms");\n}\n\nfunction skip(dir) {\n//    addOutput("we get here")\n    i = getInput();\n    addOutput("i is " + i);\n    if (i <= 0) i = 1000;\n    addOutput("dir is " + dir);\n    t = plugin.getPlayPosition() + (i * dir);\n    addOutput("t is " + t);\n    addOutput("Skipping by " + i + " to " + t + " ms - " +\n            (plugin.setPlayPosition(t) ? "succeeded" : "failed"));\n}\n\nfunction getInput() {\n  i = parseInt(input.value);\n  return isNaN(i) ? 0 : i;\n}\n\nfunction getGoto() {\n  i = parseInt(goto.value);\n  return isNaN(i) ? 0 : i;\n}\n\n\nfunction GotoPosition() {\n  i = getGoto();\n  i = i * 1000;\n  plugin.setPlayPosition(i);\n}\n\nvar outLines = 0;\n\nfunction addOutput(str) {\n  if (outLines == 0) {\n    output.value = str;\n  } else {\n    output.value = str + "\\n" + output.value;\n  }\n  outLines++;\n  if (outLines == 11) {\n    i = output.value.lastIndexOf("\\n");\n    output.value = output.value.substr(0, i);\n    outLines--;\n  }\n}\n</script>\n\n')