Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 397042dd rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

chore(sites): don't return the matched url, we don't use it

parent 1f8f2d38
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -265,7 +265,7 @@ sub on_speak { ...@@ -265,7 +265,7 @@ sub on_speak {
my %content; my %content;
# first we check for url # first we check for url
my @processed_str = PlayBot::sites::parse(@args); PlayBot::sites::parse(@args);
# and we check for command # and we check for command
my $cmd = ( split /\s/, $msg )[0]; my $cmd = ( split /\s/, $msg )[0];
......
...@@ -30,14 +30,13 @@ sub external_parse { ...@@ -30,14 +30,13 @@ sub external_parse {
die "Error"; die "Error";
} }
my ( $matched_url, $external_id, $url, $title, $author, $duration ) = my ( $external_id, $url, $title, $author, $duration ) =
split( /\n/, $content ); split( /\n/, $content );
return ( return (
author => $author, author => $author,
external_id => $external_id, external_id => $external_id,
duration => $duration, duration => $duration,
matched_url => $matched_url,
playlist => 0, playlist => 0,
site => 'soundcloud', site => 'soundcloud',
title => $title, title => $title,
...@@ -53,9 +52,6 @@ sub parse { ...@@ -53,9 +52,6 @@ sub parse {
my %content; my %content;
my $matching_url;
my @matching_tags;
eval { %content = external_parse($msg) }; eval { %content = external_parse($msg) };
if ($@) { if ($@) {
# parsing # parsing
...@@ -67,7 +63,6 @@ sub parse { ...@@ -67,7 +63,6 @@ sub parse {
my @args; my @args;
if ( @args = ( $msg =~ $site->regex ) ) { if ( @args = ( $msg =~ $site->regex ) ) {
eval { %content = $site->get(@args) }; eval { %content = $site->get(@args) };
$matching_url = $&;
$content{playlist} = 0; $content{playlist} = 0;
last; last;
} }
...@@ -75,7 +70,6 @@ sub parse { ...@@ -75,7 +70,6 @@ sub parse {
and @args = ( $msg =~ $site->regex_playlist ) ) and @args = ( $msg =~ $site->regex_playlist ) )
{ {
eval { %content = $site->get_playlist(@args) }; eval { %content = $site->get_playlist(@args) };
$matching_url = $&;
$content{playlist} = 1; $content{playlist} = 1;
last; last;
} }
...@@ -86,16 +80,13 @@ sub parse { ...@@ -86,16 +80,13 @@ sub parse {
$log->warning($@); $log->warning($@);
return; return;
} }
} else {
$matching_url = $content{matched_url};
delete $content{matched_url};
} }
my $id; my $id;
# if we get a new content, we must save it # if we get a new content, we must save it
if (%content) { if (%content) {
( $id, @matching_tags ) = $id =
insert_content( $kernel, $nick, $chan, dclone( \%content ), insert_content( $kernel, $nick, $chan, dclone( \%content ),
$msg, $playlist ); $msg, $playlist );
...@@ -107,8 +98,6 @@ sub parse { ...@@ -107,8 +98,6 @@ sub parse {
} }
} }
} }
return ( $matching_url, @matching_tags );
} }
sub insert_content { sub insert_content {
...@@ -200,7 +189,7 @@ sub insert_content { ...@@ -200,7 +189,7 @@ sub insert_content {
$dbh->commit; $dbh->commit;
} }
my @matching_tags = PlayBot::commands::parser::tag( $msg, $chan, $id ); PlayBot::commands::parser::tag( $msg, $chan, $id );
my @tags; my @tags;
...@@ -241,7 +230,7 @@ sub insert_content { ...@@ -241,7 +230,7 @@ sub insert_content {
privmsg => $chan => PlayBot::utils::print::print($content) ); privmsg => $chan => PlayBot::utils::print::print($content) );
} }
return $content->{id}, @matching_tags; return $content->{id};
} }
1; 1;
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter