diff --git a/PlayBot/sessions/irc.pm b/PlayBot/sessions/irc.pm index f6e5a758fa156be3378af4b913f35392555e716a..c0f9b53035f863fd17317c18990e7f47c61b78e7 100644 --- a/PlayBot/sessions/irc.pm +++ b/PlayBot/sessions/irc.pm @@ -265,7 +265,7 @@ sub on_speak { my %content; # first we check for url - my @processed_str = PlayBot::sites::parse(@args); + PlayBot::sites::parse(@args); # and we check for command my $cmd = ( split /\s/, $msg )[0]; diff --git a/PlayBot/sites.pm b/PlayBot/sites.pm index 1b09c2cc32c85d3107389f3f4296ccdbf3c17ec0..57eff845cc498a1e22330ac4437638ed6fe1caae 100644 --- a/PlayBot/sites.pm +++ b/PlayBot/sites.pm @@ -30,14 +30,13 @@ sub external_parse { die "Error"; } - my ( $matched_url, $external_id, $url, $title, $author, $duration ) = + my ( $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, @@ -53,9 +52,6 @@ sub parse { my %content; - my $matching_url; - my @matching_tags; - eval { %content = external_parse($msg) }; if ($@) { # parsing @@ -67,7 +63,6 @@ sub parse { my @args; if ( @args = ( $msg =~ $site->regex ) ) { eval { %content = $site->get(@args) }; - $matching_url = $&; $content{playlist} = 0; last; } @@ -75,7 +70,6 @@ sub parse { and @args = ( $msg =~ $site->regex_playlist ) ) { eval { %content = $site->get_playlist(@args) }; - $matching_url = $&; $content{playlist} = 1; last; } @@ -86,16 +80,13 @@ 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, @matching_tags ) = + $id = insert_content( $kernel, $nick, $chan, dclone( \%content ), $msg, $playlist ); @@ -107,8 +98,6 @@ sub parse { } } } - - return ( $matching_url, @matching_tags ); } sub insert_content { @@ -200,7 +189,7 @@ sub insert_content { $dbh->commit; } - my @matching_tags = PlayBot::commands::parser::tag( $msg, $chan, $id ); + PlayBot::commands::parser::tag( $msg, $chan, $id ); my @tags; @@ -241,7 +230,7 @@ sub insert_content { privmsg => $chan => PlayBot::utils::print::print($content) ); } - return $content->{id}, @matching_tags; + return $content->{id}; } 1;