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
This commit is contained in:
parent
3be9501d41
commit
226495b893
8 changed files with 74 additions and 27 deletions
|
@ -34,12 +34,12 @@ if($userinfo->{'username'})
|
||||||
#build mysql query
|
#build mysql query
|
||||||
$dbquery = "(select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ) as timestamp,
|
$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.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 = ?)
|
from videos as v, users as u where v.userid = u.id and u.sid = ?)
|
||||||
union
|
union
|
||||||
(select v.id, v.title, '', u.username, from_unixtime( v.timestamp ) as timestamp,
|
(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.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 = ?)";
|
from uploaded as v, users as u where v.userid = u.id and u.sid = ?)";
|
||||||
|
|
||||||
if($query->param('orderby'))
|
if($query->param('orderby'))
|
||||||
|
|
|
@ -130,12 +130,14 @@ while(1)
|
||||||
$thumbnailsec = int($duration/3 + .5);
|
$thumbnailsec = int($duration/3 + .5);
|
||||||
|
|
||||||
#the width/height calculation could of course be much shorter but less readable then
|
#the width/height calculation could of course be much shorter but less readable then
|
||||||
$tnwidth = 160;
|
$tnmaxwidth = 160;
|
||||||
$tnheight = int(160*($height/$width)/2 + .5)*2;
|
$tnmaxheight = 120
|
||||||
if($tnheight > 120)
|
$tnwidth = $tnmaxwidth;
|
||||||
|
$tnheight = int($tnwidth*($height/$width)/2 + .5)*2;
|
||||||
|
if($tnheight > $tnmaxheight)
|
||||||
{
|
{
|
||||||
$tnheight = 120;
|
$tnheight = $tnmaxheight;
|
||||||
$tnwidth = int(120*($width/$height)/2 + .5)*2;
|
$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";
|
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
|
else #encode video
|
||||||
{
|
{
|
||||||
#FIXME: remove endtime - this is for testing only
|
|
||||||
#TODO: addmetadata information
|
#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;
|
appendlog $id, $audio, $video, $width, $height, $fps, $duration, $sha;
|
||||||
|
|
||||||
#add video to videos table
|
#add video to videos table
|
||||||
|
|
|
@ -85,9 +85,10 @@ sub fill_results
|
||||||
$page->{'results'}->{'pagesize'} = $pagesize;
|
$page->{'results'}->{'pagesize'} = $pagesize;
|
||||||
|
|
||||||
#get every returned value
|
#get every returned value
|
||||||
while (my ($id, $title, $description, $publisher, $timestamp, $creator, $subject,
|
while (my ($id, $title, $description, $publisher, $timestamp, $creator,
|
||||||
$contributor, $source, $language, $coverage, $rights, $license,
|
$subject, $contributor, $source, $language, $coverage, $rights,
|
||||||
$filesize, $duration, $width, $height, $fps, $viewcount, $downloadcount) = $sth->fetchrow_array())
|
$license, $filesize, $duration, $width, $height, $fps, $viewcount,
|
||||||
|
$downloadcount, $status) = $sth->fetchrow_array())
|
||||||
{
|
{
|
||||||
#before code cleanup, this was a really obfuscated array/hash creation
|
#before code cleanup, this was a really obfuscated array/hash creation
|
||||||
push @{ $page->{'results'}->{'result'} },
|
push @{ $page->{'results'}->{'result'} },
|
||||||
|
@ -95,6 +96,7 @@ sub fill_results
|
||||||
'thumbnail' => $duration == 0 ? "/images/tango/video-x-generic.png" : "/video-stills/$id",
|
'thumbnail' => $duration == 0 ? "/images/tango/video-x-generic.png" : "/video-stills/$id",
|
||||||
'duration' => $duration,
|
'duration' => $duration,
|
||||||
'viewcount' => $viewcount,
|
'viewcount' => $viewcount,
|
||||||
|
'status' => $status,
|
||||||
'edit' => $userinfo->{'username'} eq $publisher ? "true" : "false",
|
'edit' => $userinfo->{'username'} eq $publisher ? "true" : "false",
|
||||||
'rdf:RDF' =>
|
'rdf:RDF' =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ $dbh->do(qq{create table
|
||||||
(
|
(
|
||||||
id int auto_increment not null,
|
id int auto_increment not null,
|
||||||
title varchar(255) not null,
|
title varchar(255) not null,
|
||||||
description varchar(255) not null,
|
description text not null,
|
||||||
userid int not null,
|
userid int not null,
|
||||||
timestamp bigint not null,
|
timestamp bigint not null,
|
||||||
creator varchar(255) not null,
|
creator varchar(255) not null,
|
||||||
|
@ -100,7 +100,7 @@ $dbh->do(qq{create table
|
||||||
(
|
(
|
||||||
id int auto_increment not null,
|
id int auto_increment not null,
|
||||||
title varchar(255) not null,
|
title varchar(255) not null,
|
||||||
description varchar(255) not null,
|
description text not null,
|
||||||
userid int not null,
|
userid int not null,
|
||||||
timestamp bigint not null,
|
timestamp bigint not null,
|
||||||
creator varchar(255) not null,
|
creator varchar(255) not null,
|
||||||
|
|
|
@ -29,9 +29,10 @@ if($query->param('query') or $query->param('orderby'))
|
||||||
$strquery =~ s/^\s*(.*?)\s*$/$1/;
|
$strquery =~ s/^\s*(.*?)\s*$/$1/;
|
||||||
|
|
||||||
#build mysql query
|
#build mysql query
|
||||||
$dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ),
|
$dbquery = "select v.id, v.title, v.description, u.username,
|
||||||
v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights,
|
from_unixtime( v.timestamp ), v.creator, v.subject, v.contributor,
|
||||||
v.license, filesize, duration, width, height, fps, viewcount, downloadcount";
|
v.source, v.language, v.coverage, v.rights, v.license, filesize,
|
||||||
|
duration, width, height, fps, viewcount, downloadcount, 1";
|
||||||
|
|
||||||
if($strquery)
|
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 there was a title passed, then perform a search
|
||||||
if($rowcount == 0 and $query->url_param('title'))
|
if($rowcount == 0 and $query->url_param('title'))
|
||||||
{
|
{
|
||||||
$dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ),
|
$dbquery = "select v.id, v.title, v.description, u.username,
|
||||||
v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights,
|
from_unixtime( v.timestamp ), v.creator, v.subject, v.contributor,
|
||||||
v.license, filesize, duration, width, height, fps, viewcount, downloadcount";
|
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 .= ", 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 .= " 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)";
|
$dbquery .= " and match(v.title, v.description, v.subject) against( ? in boolean mode)";
|
||||||
|
|
|
@ -51,11 +51,28 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</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'">
|
<xsl:if test="@edit='true'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@duration=0">
|
<xsl:when test="not(@status=1)">
|
||||||
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
|
<xsl:value-of select="rdf:RDF/cc:Work/dc:identifier" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
|
|
@ -174,22 +174,39 @@
|
||||||
<div>
|
<div>
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_creator']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_creator']" />
|
||||||
<br />
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_source']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_source']" />
|
||||||
<br />
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_language']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_language']" />
|
||||||
<br />
|
<br />
|
||||||
<select name="DC.Language">
|
<select name="DC.Language" size="2">
|
||||||
<option></option>
|
|
||||||
<option>
|
<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']" />
|
<xsl:value-of select="$locale_strings[@id='language_en-us']" />
|
||||||
</option>
|
</option>
|
||||||
<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']" />
|
<xsl:value-of select="$locale_strings[@id='language_de-de']" />
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -197,7 +214,11 @@
|
||||||
<div>
|
<div>
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_coverage']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_coverage']" />
|
||||||
<br />
|
<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>
|
</div>
|
||||||
<input type="submit" name="4">
|
<input type="submit" name="4">
|
||||||
<xsl:attribute name="value">
|
<xsl:attribute name="value">
|
||||||
|
@ -262,7 +283,11 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_license']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_license']" />
|
||||||
<br />
|
<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 />
|
<br />
|
||||||
<xsl:value-of select="$locale_strings[@id='instruction_license_cc']" />
|
<xsl:value-of select="$locale_strings[@id='instruction_license_cc']" />
|
||||||
<br />
|
<br />
|
||||||
|
|
Loading…
Reference in a new issue