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
main
josch 17 years ago
parent 3be9501d41
commit 226495b893

@ -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'))

@ -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

@ -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' =>
{

@ -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,

@ -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)
{

@ -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)";

@ -51,11 +51,28 @@
</td>
</tr>
</table>
<xsl:choose>
<xsl:when test="@status=0">
processing, please wait....
</xsl:when>
<xsl:when test="@status=2">
invalid audio and/or video stream
</xsl:when>
<xsl:when test="@status=3">
file not found - contact the admin
</xsl:when>
<xsl:when test="@status=4">
file is not a video
</xsl:when>
<xsl:when test="@status=5">
same video was already uploaded
</xsl:when>
</xsl:choose>
<xsl:if test="@edit='true'">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="@duration=0">
<xsl:when test="not(@status=1)">
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
</xsl:when>
<xsl:otherwise>

@ -174,22 +174,39 @@
<div>
<xsl:value-of select="$locale_strings[@id='instruction_creator']" />
<br />
<input name="DC.Creator" type="text" size="30" />
<input name="DC.Creator" type="text" size="30">
<xsl:attribute name="value">
<xsl:value-of select="//uploadform/@DC.Creator" />
</xsl:attribute>
</input>
</div>
<div>
<xsl:value-of select="$locale_strings[@id='instruction_source']" />
<br />
<input name="DC.Source" type="text" size="30" />
<input name="DC.Source" type="text" size="30">
<xsl:attribute name="value">
<xsl:value-of select="//uploadform/@DC.Source" />
</xsl:attribute>
</input>
</div>
<div>
<xsl:value-of select="$locale_strings[@id='instruction_language']" />
<br />
<select name="DC.Language">
<option></option>
<select name="DC.Language" size="2">
<option>
<xsl:if test="//uploadform/@DC.Language=$locale_strings[@id='language_en-us']">
<xsl:attribute name="selected">
selected
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='language_en-us']" />
</option>
<option>
<xsl:if test="//uploadform/@DC.Language=$locale_strings[@id='language_de-de']">
<xsl:attribute name="selected">
selected
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$locale_strings[@id='language_de-de']" />
</option>
</select>
@ -197,7 +214,11 @@
<div>
<xsl:value-of select="$locale_strings[@id='instruction_coverage']" />
<br />
<input name="DC.Coverage" type="text" size="30" />
<input name="DC.Coverage" type="text" size="30">
<xsl:attribute name="value">
<xsl:value-of select="//uploadform/@DC.Coverage" />
</xsl:attribute>
</input>
</div>
<input type="submit" name="4">
<xsl:attribute name="value">
@ -262,7 +283,11 @@
<fieldset>
<xsl:value-of select="$locale_strings[@id='instruction_license']" />
<br />
<input name="License" type="text" size="30" />
<input name="License" type="text" size="30">
<xsl:attribute name="value">
<xsl:value-of select="//uploadform/@DC.License" />
</xsl:attribute>
</input>
<br />
<xsl:value-of select="$locale_strings[@id='instruction_license_cc']" />
<br />

Loading…
Cancel
Save