readability fixes
comments are awsome, thanks josch git-svn-id: http://yolanda.mister-muffin.de/svn@68 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
4a99924443
commit
2aa752283b
4 changed files with 49 additions and 14 deletions
|
@ -7,6 +7,7 @@ use XML::Simple qw(:strict);
|
||||||
use Digest::SHA qw(sha256_hex);
|
use Digest::SHA qw(sha256_hex);
|
||||||
use Encode qw(decode_utf8);
|
use Encode qw(decode_utf8);
|
||||||
|
|
||||||
|
# change this as you install it somewhere else
|
||||||
$gnutube_root = '/var/www/gnutube';
|
$gnutube_root = '/var/www/gnutube';
|
||||||
|
|
||||||
use lib qw(/var/www/gnutube);
|
use lib qw(/var/www/gnutube);
|
||||||
|
|
|
@ -13,13 +13,46 @@ $dbh->do(qq{drop table videos});
|
||||||
|
|
||||||
$dbh->do(qq{drop table tagcloud});
|
$dbh->do(qq{drop table tagcloud});
|
||||||
|
|
||||||
$dbh->do(qq{create table tagcloud (text varchar(255) not null, count int not null)});
|
$dbh->do(qq{create table
|
||||||
|
tagcloud
|
||||||
|
(
|
||||||
|
text varchar(255) not null,
|
||||||
|
count int not null
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
$dbh->do(qq{insert into tagcloud values ('web tv', 68)});
|
$dbh->do(qq{insert into
|
||||||
|
tagcloud values
|
||||||
|
(
|
||||||
|
'web tv', 68
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
$dbh->do(qq{create table users (id int auto_increment not null, username varchar(255) not null, password char(41) not null, sid char(32) not null, primary key (id))});
|
$dbh->do(qq{create table
|
||||||
|
users
|
||||||
|
(
|
||||||
|
id int auto_increment not null,
|
||||||
|
username varchar(255) not null,
|
||||||
|
password char(41) not null,
|
||||||
|
sid char(32) not null,
|
||||||
|
primary key (id)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
$dbh->do(qq{create table videos (id int auto_increment not null, title varchar(255) not null, caption text not null, userid varchar(255) not null, hash char(64) not null, status int not null, timestamp datetime not null, primary key (id), fulltext (title, caption))});
|
$dbh->do(qq{create table
|
||||||
|
videos
|
||||||
|
(
|
||||||
|
id int auto_increment not null,
|
||||||
|
title varchar(255) not null,
|
||||||
|
caption text not null,
|
||||||
|
userid varchar(255) not null,
|
||||||
|
hash char(64) not null,
|
||||||
|
status int not null,
|
||||||
|
timestamp datetime not null,
|
||||||
|
primary key (id),
|
||||||
|
fulltext (title, caption)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
$dbh->disconnect() or die $dbh->errstr;
|
||||||
|
|
||||||
|
|
|
@ -33,22 +33,22 @@ if($query->param('query'))
|
||||||
#get every returned value
|
#get every returned value
|
||||||
while (my ($title, $caption, $userid, $timestamp) = $sth->fetchrow_array())
|
while (my ($title, $caption, $userid, $timestamp) = $sth->fetchrow_array())
|
||||||
{
|
{
|
||||||
#really obfuscated array/hash creation
|
#before code cleanup, this was a really obfuscated array/hash creation
|
||||||
push @{ $page->{'results'}->{'result'} },
|
push @{ $page->{'results'}->{'result'} },
|
||||||
{
|
{
|
||||||
'thumbnail' => ['./video-stills/225x150/4chan_city_mashup.png'],
|
'thumbnail' => ['./video-stills/225x150/4chan_city_mashup.png'],
|
||||||
'rdf:RDF' =>
|
'rdf:RDF' =>
|
||||||
{
|
{
|
||||||
'cc:Work' =>
|
'cc:Work' =>
|
||||||
{
|
{
|
||||||
'rdf:about' => './videos/1050x700/4chan_city_mashup.ogg',
|
'rdf:about' => './videos/1050x700/4chan_city_mashup.ogg',
|
||||||
'dc:title' => [$title],
|
'dc:title' => [$title],
|
||||||
'dc:date' => [$timestamp],
|
'dc:date' => [$timestamp],
|
||||||
'dc:publisher' => [get_username_from_id($userid)]
|
'dc:publisher' => [get_username_from_id($userid)]
|
||||||
},
|
},
|
||||||
'cc:License' =>
|
'cc:License' =>
|
||||||
{
|
{
|
||||||
'rdf:about' => 'http://creativecommons.org/licenses/GPL/2.0/'
|
'rdf:about' => 'http://creativecommons.org/licenses/GPL/2.0/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@ $session = new CGI::Session;
|
||||||
sub hook
|
sub hook
|
||||||
{
|
{
|
||||||
#this is going to become an ajax progress bar
|
#this is going to become an ajax progress bar
|
||||||
|
#alternatively, reloading every N seconds (mozilla doesn't flicker)
|
||||||
my ($filename, $buffer, $bytes_read, $data) = @_;
|
my ($filename, $buffer, $bytes_read, $data) = @_;
|
||||||
#print $ENV{'CONTENT_LENGTH'};
|
#print $ENV{'CONTENT_LENGTH'};
|
||||||
#print sha256_hex($buffer);
|
#print sha256_hex($buffer);
|
||||||
|
|
Loading…
Reference in a new issue