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

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

This reverts commit 397042dd.
parent 7627e489
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -30,13 +30,14 @@ sub external_parse {
die "Error";
}
my ( $external_id, $url, $title, $author, $duration ) =
my ( $matched_url, $external_id, $url, $title, $author, $duration ) =
split( /\n/, $content );
return (
author => $author,
external_id => $external_id,
duration => $duration,
matched_url => $matched_url,
playlist => 0,
site => 'soundcloud',
title => $title,
......@@ -52,6 +53,9 @@ sub parse {
my %content;
my $matching_url;
my @matching_tags;
eval { %content = external_parse($msg) };
if ($@) {
# parsing
......@@ -63,6 +67,7 @@ sub parse {
my @args;
if ( @args = ( $msg =~ $site->regex ) ) {
eval { %content = $site->get(@args) };
$matching_url = $&;
$content{playlist} = 0;
last;
}
......@@ -70,6 +75,7 @@ sub parse {
and @args = ( $msg =~ $site->regex_playlist ) )
{
eval { %content = $site->get_playlist(@args) };
$matching_url = $&;
$content{playlist} = 1;
last;
}
......@@ -80,13 +86,16 @@ sub parse {
$log->warning($@);
return;
}
} else {
$matching_url = $content{matched_url};
delete $content{matched_url};
}
my $id;
# if we get a new content, we must save it
if (%content) {
$id =
( $id, @matching_tags ) =
insert_content( $kernel, $nick, $chan, dclone( \%content ),
$msg, $playlist );
......@@ -98,6 +107,8 @@ sub parse {
}
}
}
return ( $matching_url, @matching_tags );
}
sub insert_content {
......@@ -189,7 +200,7 @@ sub insert_content {
$dbh->commit;
}
PlayBot::commands::parser::tag( $msg, $chan, $id );
my @matching_tags = PlayBot::commands::parser::tag( $msg, $chan, $id );
my @tags;
......@@ -230,7 +241,7 @@ sub insert_content {
privmsg => $chan => PlayBot::utils::print::print($content) );
}
return $content->{id};
return $content->{id}, @matching_tags;
}
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