From 226495b893c401209a0693f1a507b27cc1ebb36c Mon Sep 17 00:00:00 2001 From: josch Date: Fri, 14 Dec 2007 06:18:58 +0000 Subject: [PATCH] fixed entime issue, cleaned up thumbnail generation, added status display of uploads, fixed default values in upload dialogue, fixed mysql datatypes git-svn-id: http://yolanda.mister-muffin.de/svn@198 7eef14d0-6ed0-489d-bf55-20463b2d70db --- trunk/account.pl | 4 ++-- trunk/daemon.pl | 15 ++++++++------- trunk/functions.pl | 8 +++++--- trunk/init_sql.pl | 4 ++-- trunk/search.pl | 7 ++++--- trunk/video.pl | 7 ++++--- trunk/xsl/xhtml/results.xsl | 19 ++++++++++++++++++- trunk/xsl/xhtml/upload.xsl | 37 +++++++++++++++++++++++++++++++------ 8 files changed, 74 insertions(+), 27 deletions(-) diff --git a/trunk/account.pl b/trunk/account.pl index f4ad5e1..d880596 100644 --- a/trunk/account.pl +++ b/trunk/account.pl @@ -34,12 +34,12 @@ if($userinfo->{'username'}) #build mysql query $dbquery = "(select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ) as timestamp, v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights, - v.license, filesize, duration, width, height, fps, viewcount, downloadcount + v.license, filesize, duration, width, height, fps, viewcount, downloadcount, 1 from videos as v, users as u where v.userid = u.id and u.sid = ?) union (select v.id, v.title, '', u.username, from_unixtime( v.timestamp ) as timestamp, v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights, - v.license, 0, 0, 0, 0, 0, 0, 0 + v.license, 0, 0, 0, 0, 0, 0, 0, v.status from uploaded as v, users as u where v.userid = u.id and u.sid = ?)"; if($query->param('orderby')) diff --git a/trunk/daemon.pl b/trunk/daemon.pl index d4a455e..1f95a16 100755 --- a/trunk/daemon.pl +++ b/trunk/daemon.pl @@ -130,12 +130,14 @@ while(1) $thumbnailsec = int($duration/3 + .5); #the width/height calculation could of course be much shorter but less readable then - $tnwidth = 160; - $tnheight = int(160*($height/$width)/2 + .5)*2; - if($tnheight > 120) + $tnmaxwidth = 160; + $tnmaxheight = 120 + $tnwidth = $tnmaxwidth; + $tnheight = int($tnwidth*($height/$width)/2 + .5)*2; + if($tnheight > $tnmaxheight) { - $tnheight = 120; - $tnwidth = int(120*($width/$height)/2 + .5)*2; + $tnheight = $tnmaxheight; + $tnwidth = int($tnheight*($width/$height)/2 + .5)*2; } system "ffmpeg -i $root/tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $root/video-stills/$id"; @@ -156,9 +158,8 @@ while(1) } else #encode video { - #FIXME: remove endtime - this is for testing only #TODO: addmetadata information - system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --endtime 10 --output $root/videos/$id $root/tmp/$id 2>&1"; + system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --output $root/videos/$id $root/tmp/$id 2>&1"; appendlog $id, $audio, $video, $width, $height, $fps, $duration, $sha; #add video to videos table diff --git a/trunk/functions.pl b/trunk/functions.pl index 91fc1a8..c3f6665 100644 --- a/trunk/functions.pl +++ b/trunk/functions.pl @@ -85,9 +85,10 @@ sub fill_results $page->{'results'}->{'pagesize'} = $pagesize; #get every returned value - while (my ($id, $title, $description, $publisher, $timestamp, $creator, $subject, - $contributor, $source, $language, $coverage, $rights, $license, - $filesize, $duration, $width, $height, $fps, $viewcount, $downloadcount) = $sth->fetchrow_array()) + while (my ($id, $title, $description, $publisher, $timestamp, $creator, + $subject, $contributor, $source, $language, $coverage, $rights, + $license, $filesize, $duration, $width, $height, $fps, $viewcount, + $downloadcount, $status) = $sth->fetchrow_array()) { #before code cleanup, this was a really obfuscated array/hash creation push @{ $page->{'results'}->{'result'} }, @@ -95,6 +96,7 @@ sub fill_results 'thumbnail' => $duration == 0 ? "/images/tango/video-x-generic.png" : "/video-stills/$id", 'duration' => $duration, 'viewcount' => $viewcount, + 'status' => $status, 'edit' => $userinfo->{'username'} eq $publisher ? "true" : "false", 'rdf:RDF' => { diff --git a/trunk/init_sql.pl b/trunk/init_sql.pl index 1608088..42c8457 100644 --- a/trunk/init_sql.pl +++ b/trunk/init_sql.pl @@ -75,7 +75,7 @@ $dbh->do(qq{create table ( id int auto_increment not null, title varchar(255) not null, - description varchar(255) not null, + description text not null, userid int not null, timestamp bigint not null, creator varchar(255) not null, @@ -100,7 +100,7 @@ $dbh->do(qq{create table ( id int auto_increment not null, title varchar(255) not null, - description varchar(255) not null, + description text not null, userid int not null, timestamp bigint not null, creator varchar(255) not null, diff --git a/trunk/search.pl b/trunk/search.pl index 41904f6..608c8bb 100644 --- a/trunk/search.pl +++ b/trunk/search.pl @@ -29,9 +29,10 @@ if($query->param('query') or $query->param('orderby')) $strquery =~ s/^\s*(.*?)\s*$/$1/; #build mysql query - $dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ), - v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights, - v.license, filesize, duration, width, height, fps, viewcount, downloadcount"; + $dbquery = "select v.id, v.title, v.description, u.username, + from_unixtime( v.timestamp ), v.creator, v.subject, v.contributor, + v.source, v.language, v.coverage, v.rights, v.license, filesize, + duration, width, height, fps, viewcount, downloadcount, 1"; if($strquery) { diff --git a/trunk/video.pl b/trunk/video.pl index d0b82ae..181cb8d 100644 --- a/trunk/video.pl +++ b/trunk/video.pl @@ -51,9 +51,10 @@ elsif($query->url_param('title') or $query->url_param('id')) #if there was a title passed, then perform a search if($rowcount == 0 and $query->url_param('title')) { - $dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ), - v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights, - v.license, filesize, duration, width, height, fps, viewcount, downloadcount"; + $dbquery = "select v.id, v.title, v.description, u.username, + from_unixtime( v.timestamp ), v.creator, v.subject, v.contributor, + v.source, v.language, v.coverage, v.rights, v.license, filesize, + duration, width, height, fps, viewcount, downloadcount, 1"; $dbquery .= ", match(v.title, v.description, v.subject) against( ? in boolean mode) as relevance"; $dbquery .= " from videos as v, users as u where u.id = v.userid"; $dbquery .= " and match(v.title, v.description, v.subject) against( ? in boolean mode)"; diff --git a/trunk/xsl/xhtml/results.xsl b/trunk/xsl/xhtml/results.xsl index db24ed4..b6ca16a 100644 --- a/trunk/xsl/xhtml/results.xsl +++ b/trunk/xsl/xhtml/results.xsl @@ -51,11 +51,28 @@ + + + processing, please wait.... + + + invalid audio and/or video stream + + + file not found - contact the admin + + + file is not a video + + + same video was already uploaded + + - + diff --git a/trunk/xsl/xhtml/upload.xsl b/trunk/xsl/xhtml/upload.xsl index f3d974c..1d2c3e5 100644 --- a/trunk/xsl/xhtml/upload.xsl +++ b/trunk/xsl/xhtml/upload.xsl @@ -174,22 +174,39 @@

- + + + + +

- + + + + +

- @@ -197,7 +214,11 @@

- + + + + +
@@ -262,7 +283,11 @@

- + + + + +