fixed viewcount, fixed time calculation, fixed video filesize, fixed rss, fixed codec regex, fixed viewed content length, fixed one result redirect on multiple pages, fixed query string regex
git-svn-id: http://yolanda.mister-muffin.de/svn@226 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
474ce11a60
commit
2b40d41c1a
5 changed files with 13 additions and 10 deletions
|
@ -43,7 +43,8 @@ if($query->param('id'))
|
|||
#seems we only want to watch it - update viewcount
|
||||
$dbh->do(qq{update videos set viewcount=viewcount+1 where id = ? }, undef, $query->param('id')) or die $dbh->errstr;
|
||||
|
||||
print $query->header(-type=>'application/ogg');
|
||||
print $query->header(-type=>'application/ogg',
|
||||
-length=> -s "$root/videos/".$query->param('id'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ if($query->param('query'))
|
|||
my @args = ();
|
||||
|
||||
$strquery = $query->param('query');
|
||||
$strquery = s/%([0-9A-F]{2})/chr(hex($1))/eg;
|
||||
$strquery =~ s/%([0-9A-F]{2})/chr(hex($1))/eg;
|
||||
(@tags) = $strquery =~ /tag:(\w+)/gi;
|
||||
($orderby) = $strquery =~ /orderby:(\w+)/i;
|
||||
($sort) = $strquery =~ /sort:(\w+)/i;
|
||||
|
@ -112,7 +112,7 @@ if($query->param('query'))
|
|||
{
|
||||
print $query->redirect("index.pl?warning=warning_no_results");
|
||||
}
|
||||
elsif(@{$page->{'results'}->{'result'}} == 1 or $query->param('lucky'))
|
||||
elsif((@{$page->{'results'}->{'result'}} == 1 or $query->param('lucky')) and (not $query->param('page') or $query->param('page') == 1))
|
||||
{
|
||||
print $query->redirect($page->{'results'}->{'result'}[0]->{'rdf:RDF'}->{'cc:Work'}->{'dc:identifier'}[0]);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ while(1)
|
|||
|
||||
#these two regexes have to be applied seperately because nobody knows which stream (audio or video) comes first
|
||||
($audio) = $info =~ /Audio: (\w+)/;
|
||||
($video, $width, $height, $fps) = $info =~ /Video: (\w+),.+?(\d+)x(\d+),.+?(\d+\.\d+) fps/;
|
||||
($video, $width, $height, $fps) = $info =~ /Video: ([\w\d]+),.+?(\d+)x(\d+),.+?(\d+\.\d+) fps/;
|
||||
|
||||
if(!$audio or !$video or !$duration)
|
||||
{
|
||||
|
@ -160,9 +160,11 @@ while(1)
|
|||
$vwidth = int($vheight*($width/$height)/2 + .5)*2;
|
||||
|
||||
#TODO: addmetadata information
|
||||
system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --width $vwidth --height $vheight --output $root/videos/$id $root/tmp/$id 2>&1";
|
||||
system "ffmpeg2theora --optimize --videobitrate 1000 --audiobitrate 64 --sharpness 0 --width $vwidth --height $vheight --output $root/videos/$id $root/tmp/$id";
|
||||
appendlog $id, $audio, $video, $vwidth, $vheight, $fps, $duration, $sha;
|
||||
|
||||
$filesize = -s "$root/videos/$id";
|
||||
|
||||
#add video to videos table
|
||||
$dbh->do(qq{insert into videos select id, title, description, userid, timestamp, creator,
|
||||
subject, source, language, coverage, rights, license, ?, ?, ?, ?, ?, ?, 0, 0
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<xsl:value-of select="rdf:RDF/cc:Work/dc:title" />
|
||||
</a>
|
||||
<br />
|
||||
<xsl:variable name="minutes" select="floor(@duration div 60)" />
|
||||
<xsl:variable name="hours" select="floor(@duration div 3600)" />
|
||||
<xsl:variable name="minutes" select="floor((@duration - $hours*3600) div 60)" />
|
||||
<xsl:variable name="seconds" select="@duration - $minutes*60 - $hours*3600" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$hours=0">
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<xsl:if test="not(//@embed='true')">
|
||||
<div class="videotitle">
|
||||
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:title" />
|
||||
<xsl:variable name="minutes" select="floor(//video/@duration div 60)" />
|
||||
<xsl:variable name="hours" select="floor(//video/@duration div 3600)" />
|
||||
<xsl:variable name="hours" select="floor(@duration div 3600)" />
|
||||
<xsl:variable name="minutes" select="floor((@duration - $hours*3600) div 60)" />
|
||||
<xsl:variable name="seconds" select="//video/@duration - $minutes*60 - $hours*3600" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$hours=0">
|
||||
|
@ -41,7 +41,7 @@
|
|||
</xsl:attribute>
|
||||
<param name="url">
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
|
||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'view=true')" />
|
||||
</xsl:attribute>
|
||||
</param>
|
||||
<param name="seekable" value="true"/>
|
||||
|
@ -83,7 +83,7 @@
|
|||
<xsl:value-of select="//video/@height + 16" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="data">
|
||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'/view=true')" />
|
||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/@rdf:about,'view=true')" />
|
||||
</xsl:attribute>
|
||||
</object>
|
||||
<div class="watch-cortadoapplet">
|
||||
|
|
Loading…
Reference in a new issue