Changeset 1884

Show
Ignore:
Timestamp:
2006-01-26 20:24:15 (3 years ago)
Author:
ctford
Message:

Can play annodexes, but has trouble uploading large ogg files. CMML not yet touched.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Anode/trunk/acidfree/class_anode.inc

    r1883 r1884  
    5454 
    5555        //FIXME files stored with missing extension. Dunno why.  
    56         $node->large = acidfree_add_file($node, $file->filepath, "{$node->nid}_large.{$node->media_ext}", $node->mime, false); 
     56        $node->large = acidfree_add_file($node, $file->filepath, "{$node->nid}_large.ogg", $node->mime, TRUE); 
    5757 
    5858        $node->small = $node->large; // For now there's no distinction between 
     
    6565                                     // passes to other methods. 
    6666         
    67         $media_location = _acidfree_filemanager_url($node->large,true); 
     67        $media_location = _acidfree_get_path($node->large,true); 
     68        $output_anx_location = __FILE__."/../output_annodex.php"; 
    6869        $anx_stub = '<?php 
    69                 require_once("../../../modules/output_annodex.php"); 
    70                 output_annodex( "'.$media_location.'" )'; 
     70                require_once("'.$output_anx_location.'"); 
     71                output_annodex( "'.$media_location.'" );'; 
    7172                //FIXME this kind of path hardcoding can't be good. 
    7273         
     
    7576        fwrite( $anx_stub_handle, $anx_stub ); 
    7677        fclose( $anx_stub_handle ); 
    77         $anx_handler = acidfree_add_file($node, $anx_stub_name, "{$node->nid}_anx_handler.php", $node->mime, true); 
     78        $anx_handler = acidfree_add_file($node, $anx_stub_name, "{$node->nid}_anx_server.php", $node->mime, true); 
    7879         
    7980        //FIXME maybe just define the node id? 
    8081        $cmml_stub = '<?php 
    8182                require_once("../../../modules/output_annodex.php"); 
    82                 output_cmml( "'.$media_location.'" )'; 
     83                output_cmml( "'.$media_location.'" );'; 
    8384                //FIXME this kind of path hardcoding can't be good. 
    8485         
     
    9394        db_query("INSERT INTO {acidfree_annodex}(nid, cmml_handler, annodex_handler) VALUES({$node->nid}, {$cmml_handler->fid}, {$anx_handler->fid});"); 
    9495 
    95         if ($file->source != 'acidfree_local_filesystem') { 
    96               file_delete($file->filepath); 
    97        
     96        //if ($file->source != 'acidfree_local_filesystem') { 
     97        //    file_delete($file->filepath); 
     98        //
    9899} 
    99100 
     
    168169        $output .= "<a href='$cmml'>view CMML</a><br/>"; 
    169170 
     171        $output .= var_export( $node ); 
     172 
    170173        return $output; 
    171174} 
  • Anode/trunk/acidfree/output_annodex.php

    r1883 r1884  
    11<?php 
    22 
    3 /* This file is to be used to output Annodex to a browser. It should be 
    4  * included into a php file that does nothing but define '$media_file'. 
     3/* This file is to be used to output Annodex to a browser.  
    54 */ 
    65 
    76require_once("phpannodex/AnnodexWriter.php"); 
     7//require_once("acidfree.module"); 
    88 
    99function output_annodex( $media_file, $output_headers=TRUE ) { 
     10 
     11        //$media_file = _acidfree_filemanager_url($node_large, TRUE); 
     12         
    1013        $anx = new AnnodexWriter(); 
    11         $anx->import($media_file,NULL,NULL,0,-1); 
     14        $anx->import($media_file, NULL, NULL, 0, -1); 
    1215 
     16        output_annodex_headers( $anx ); 
     17         
    1318        while( $buffer = $anx->write_output() ) { 
    1419                echo $buffer; 
     
    2126function output_cmml( $cmml_file, $output_headers=TRUE ) { 
    2227         
    23         echo "This is pretty CMML"; 
     28        header("Content-Type: application/x-annodex"); 
     29        header(""); 
     30 
     31        echo "<cmml>This is cmml</cmml>"; 
     32 
    2433        return; 
     34} 
     35 
     36function make_preamble() { 
     37        $preamble = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE cmml SYSTEM "cmml.dtd">'; 
     38        return $preamble; 
     39} 
     40 
     41function make_clip( $a, $img, $description, $start, $end ) { 
     42 
     43        $clip .= "<clip"; 
     44 
     45        if( $a ) { 
     46                $clip .= 'a="$a" '; 
     47        } 
     48        if( $img ) { 
     49                $clip .= 'img="$a" '; 
     50        } 
     51        if( $description ) { 
     52                $clip .= 'desc="$a" '; 
     53        } 
     54        if( $start ) { 
     55                $clip .= 'start="$a" '; 
     56        } 
     57        if( $end ) { 
     58                $clip .= 'end="$a" '; 
     59        } 
     60 
     61        $clip .= "/>"; 
     62 
     63        return $clip; 
    2564} 
    2665 
     
    3170 
    3271function output_annodex_headers( AnnodexWriter $anx ) { 
    33          
     72 
     73        header("Content-Type: application/x-annodex"); 
     74        header("X-Content-Bitrate-Average: {$anx->get_bitrate()}"); 
     75        header("X-Content_Duration: {$anx->get_duration()}"); 
     76        header(""); 
     77                 
    3478        return; 
    3579}