From 62092df6b1dbca0ddfce13c3c026b93d48e058b5 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 21 Oct 2011 13:08:38 +0000 Subject: [PATCH] --- fluidbook/tools/webvideo | 8 ++--- inc/ws/Util/class.ws.links.php | 56 ++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/fluidbook/tools/webvideo b/fluidbook/tools/webvideo index 18f401131..b96fe7de6 100644 --- a/fluidbook/tools/webvideo +++ b/fluidbook/tools/webvideo @@ -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 diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index a257aa9bc..0391ec9c8 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -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; -- 2.39.5