diff --git a/lib/commands/get.pm b/lib/commands/get.pm index e93ace836ca87e6536bae32ac77fe8a25614345a..38ed533df86e85d4a30cfb68d6936be65ff2c7dc 100644 --- a/lib/commands/get.pm +++ b/lib/commands/get.pm @@ -120,7 +120,7 @@ sub exec { $sth = $dbh->prepare("select group_concat(tag separator ' ') from playbot_tags - where id = ? and context = 0 + where id = ? group by id"); $sth->execute($content->[0]); diff --git a/lib/commands/tag.pm b/lib/commands/tag.pm index ec91ce9cbca98fc2f43271b56453d654c92c59a6..ea31e853ecb063198957abe9191e11bf783d8b38 100644 --- a/lib/commands/tag.pm +++ b/lib/commands/tag.pm @@ -4,8 +4,6 @@ require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(exec); -use Lingua::StopWords qw(getStopWords); - our $dbh; our $log; @@ -17,37 +15,19 @@ sub exec { } } -sub addContext -{ - my ($id, $msg) = @_; - - while ($msg =~ /#?([a-zA-Z0-9_-]+)/g) { - addTag($id, $1, 1); - } -} - sub addTag { - my ($id, $tag, $context) = @_; + my ($id, $tag) = @_; my $stopwords_en = getStopWords('en'); my $stopwords_fr = getStopWords('fr'); - return if ($context and ($stopwords_en->{lc $tag} or $stopwords_fr->{lc $tag})); - my $sth; - if (!$context) { - $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) - VALUES (?, ?, ?) - ON DUPLICATE KEY - UPDATE context = 0'); - } else { - $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag, context) - VALUES (?, ?, ?)'); - } + $sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag) + VALUES (?, ?)'); $log->error("Couldn't prepare querie; aborting") unless (defined $sth); - $sth->execute($id, $tag, ($context) ? 1 : 0) + $sth->execute($id, $tag) or $log->error("Couldn't finish transaction: " . $dbh->errstr); } diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm index a0d1ecb77137455dc3b0b6f7becdf273368c46cf..9a8261b344347fffecc83a12b21cce0556c94b2d 100644 --- a/lib/sites/parser.pm +++ b/lib/sites/parser.pm @@ -80,9 +80,6 @@ sub parse { or $log->error("Couldn't finish transaction: " . $dbh->errstr); $id = $sth->fetch->[0]; - - # we don't want to reinsert the context, so we delete it - delete $content{'context'}; } # message sur irc @@ -101,10 +98,6 @@ sub parse { $sth->execute($id, $chan->[0]) or $log->error("Couldn't finish transaction: " . $dbh->errstr); - - if (defined $content{'context'}) { - commands::tag::addContext($id, $content{'context'}); - } } return $id; diff --git a/lib/sites/soundcloud.pm b/lib/sites/soundcloud.pm index 1cb8eeeb2c8c66636465588d2e00334e781e5b2b..d65e6f12bf2b59e19c25938df14f88fa1594df79 100644 --- a/lib/sites/soundcloud.pm +++ b/lib/sites/soundcloud.pm @@ -30,16 +30,6 @@ sub get { $infos{'ddl'} = $content->{'download_url'}; } - my $context = $content->{'tag_list'}.' '.$content->{'description'}; - $context = $context.' '.$infos{'title'}.' '.$infos{'author'}; - my $finder = URI::Find->new( sub { '' } ); - - # we remove the URI and the punctuation - $finder->find(\$context); - $context =~ s/[[:punct:]]/ /g; - - $infos{'context'} = $context; - return %infos; } diff --git a/lib/sites/youtube.pm b/lib/sites/youtube.pm index 920c0d54e73db37d0256a06e9351a5081ae6a1b6..7f3d0c26f6e128d1c178231e9ad319e5c867f855 100644 --- a/lib/sites/youtube.pm +++ b/lib/sites/youtube.pm @@ -21,17 +21,6 @@ sub get { $infos{'author'} = $video->uploader; $infos{'url'} = $video->base_uri; -=cut - my $context = decode("UTF-8", $video->description) . ' ' . $infos{'title'}; - my $finder = URI::Find->new( sub { '' } ); - - # we remove the URI and the punctuation - $finder->find(\$context); - $context =~ s/[[:punct:]]/ /g; - - $infos{'context'} = $context; -=cut - return %infos; }