]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Oct 2011 13:08:38 +0000 (13:08 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Oct 2011 13:08:38 +0000 (13:08 +0000)
fluidbook/tools/webvideo
inc/ws/Util/class.ws.links.php

index 18f401131a47c2763b382abf2ab2c25d68edf3ca..b96fe7de67db22c42b37eaf065b7c8ca107083ba 100644 (file)
@@ -5,7 +5,7 @@ extension=${filename##*.}
 filename=${filename%.*}
 
 
-/usr/local/bin/ffmpeg -i $1 -y -r 1 -ss 00:00:04 -t 00:00:01 -f image2 $2/$filename.jpg
-/usr/local/bin/ffmpeg -i $1 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -vcodec libvpx -b 614400 -acodec libvorbis -y $2/$filename.webm
-/usr/bin/ffmpeg -i $1 -y -acodec aac -ab 128k -vcodec libx264 -b 1200k -mbd 2 -cmp 2 -subcmp 2 -strict experimental $2/$filename.mp4
-/usr/local/bin/ffmpeg2theora $1 -o $2/$filename.ogv
\ No newline at end of file
+ulimit -t 360;/usr/local/bin/ffmpeg -i $1 -y -r 1 -ss 00:00:04 -t 00:00:01 -f image2 $2/$filename.jpg
+ulimit -t 360;/usr/local/bin/ffmpeg -i $1 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -vcodec libvpx -b 614400 -acodec libvorbis -y $2/$filename.webm
+ulimit -t 360;/usr/bin/ffmpeg -i $1 -y -acodec aac -ab 128k -vcodec libx264 -b 1200k -mbd 2 -cmp 2 -subcmp 2 -strict experimental $2/$filename.mp4
+ulimit -t 360;/usr/local/bin/ffmpeg2theora $1 -o $2/$filename.ogv
\ No newline at end of file
index a257aa9bc3b42e605cdd65896b11a4a12a663619..0391ec9c81c474bba9c8ecb202eeb9e7419e46d7 100644 (file)
@@ -103,7 +103,7 @@ class wsLinks {
                global $core;
                $c = $core->con->openCursor('document_links_versions');
                $c1 = $core->con->openCursor('document_links');
-               $c1->document_id=$c->document_id=$document_id;
+               $c1->document_id = $c->document_id = $document_id;
                $c1->links = $c->links = $links;
                $c1->rulers = $c->rulers = $rulers;
                $c->comments = $comments;
@@ -114,17 +114,45 @@ class wsLinks {
                $core->con->execute('DELETE FROM document_links WHERE document_id=' . $document_id);
                $c1->insert();
        }
-       
-       public static function getLinksAndRulers($book_id, &$links, &$rulers, $time=null) {
 
+       public static function getDocumentLastLinks($document_id) {
+               global $core;
+
+               $r = $core->con->select('SELECT * FROM document_links WHERE document_id=\'' . $document_id . '\'');
+               if (!$r->count()) {
+                       $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id . ' ORDER BY `update` DESC LIMIT 1');
+                       $c = $core->con->openCursor('document_links');
+                       $c->document_id = $document_id;
+                       $c->links = $r->links;
+                       $c->rulers = $r->rulers;
+                       $c->insert();
+               }
+
+               return self::_recordToLinks($r);
+       }
+
+       public static function getDocumentVersionLinks($document_id, $time) {
                global $core;
-               
-               if (is_null($time)) {
-                       $timeQuery = 'ORDER BY `update` DESC LIMIT 1';
+               $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $document_id . ' AND `update`=' . $time);
+               return self::_recordToLinks($r);
+       }
+
+       protected static function _recordToLinks($r) {
+               if (mb_substr($r->links, 1, 1) == ':') {
+                       $ll = unserialize($r->links);
+                       $rr = unserialize($r->rulers);
                } else {
-                       $timeQuery = 'AND `update`=' . $time;
+                       $ll = json_decode($r->links, true);
+                       $rr = json_decode($r->rulers, true);
                }
 
+               return array('links' => $ll, 'rulers' => $rr);
+       }
+
+       public static function getLinksAndRulers($book_id, &$links, &$rulers, $time=null) {
+
+               global $core;
+
                $daoBook = new wsDAOBook($core->con);
                $pages = $daoBook->getPagesOfBookAt($book_id, $time);
 
@@ -140,17 +168,13 @@ class wsLinks {
                $rulers = array();
 
                foreach ($documents as $d) {
-                       $r = $core->con->select('SELECT * FROM document_links_versions WHERE document_id=' . $d . ' ' . $timeQuery);
-
-                       if (mb_substr($r->links, 1, 1) == ':') {
-                               $ll = unserialize($r->links);
-                               $rr = unserialize($r->rulers);
+                       if (is_null($time)) {
+                               $lr = self::getDocumentLastLinks($d);
                        } else {
-                               $ll = json_decode($r->links, true);
-                               $rr = json_decode($r->rulers, true);
+                               $lr = self::getDocumentVersionLinks($d, $time);
                        }
-                       $tlinks[$d] = $ll;
-                       $trulers[$d] = $rr;
+                       $tlinks[$d] = $lr['links'];
+                       $trulers[$d] = $lr['rulers'];
                }
 
                $i = 1;