<commit_before><?php

namespace App\Listeners;

use App\Events\SongsBatchUnliked;
use App\Services\LastfmService;
use Illuminate\Contracts\Queue\ShouldQueue;

class UnloveMultipleTracksOnLastfm implements ShouldQueue
{
    private LastfmService $lastfm;

    public function __construct(LastfmService $lastfm)
    {
        $this->lastfm = $lastfm;
    }

    public function handle(SongsBatchUnliked $event): void
    {
        $this->lastfm->batchToggleLoveTracks($event->songs, $event->user, false);
    }
}<commit_msg>fix: batch unfavorite songs<commit_after><?php

namespace App\Listeners;

use App\Events\SongsBatchUnliked;
use App\Models\Song;
use App\Services\LastfmService;
use App\Values\LastfmLoveTrackParameters;
use Illuminate\Contracts\Queue\ShouldQueue;

class UnloveMultipleTracksOnLastfm implements ShouldQueue
{
    private LastfmService $lastfm;

    public function __construct(LastfmService $lastfm)
    {
        $this->lastfm = $lastfm;
    }

    public function handle(SongsBatchUnliked $event): void
    {
        $this->lastfm->batchToggleLoveTracks(
            $event->songs->map(static function (Song $song): LastfmLoveTrackParameters {
                return LastfmLoveTrackParameters::make($song->title, $song->artist->name);
            }),
            $event->user,
            false
        );
    }
}
{'fraction_non_alphanumeric': 0.10404191616766467, 'fraction_numerical': 0.0, 'mean_word_length': 3.5322033898305083, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1076336', 'n_tokens_mistral': 406, 'n_tokens_neox': 397, 'n_words': 75}