Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - ReVeNaNt

1
Hello,

Please find a few update for lyrics'plugin find in /usr/share/gmusicbrowser/plugins :

you can put this after "my %Sites="

lyricsondemand => [
    'Lyricsondemand',
    sub {
        my $ID = $_[0];
        my $artist = Songs::Get($ID,'artist') || '';
        my $title  = Songs::Get($ID,'title')  || '';

        # Nettoyer pour l'URL
        $artist =~ s/\s+/_/g;
        $artist =~ s/[^a-zA-Z0-9_]//g;
        $artist = lc $artist;

        $title  =~ s/\s+/_/g;
        $title  =~ s/[^a-zA-Z0-9_]//g;
        $title  =~ s/_+/_/g;
        $title  = lc $title;

        return "https://lyricsondemand.com/$artist/$title";
    },
    undef,
sub {
    my $html = $_[0];
    my $lyrics = '';

    # Extraire tout le bloc mainlyrics
    if ($html =~ m#<div\s+class="mainlyrics">(.*?)</div>\s*</div>\s*</div>#si) {
        my $main = $1;

        # Extraire toutes les lignes de paroles
        my @lines = $main =~ m#<div\s+class="line main-single-line [^"]*"\s+data-line-index="\d+">(.*?)</div>#gis;

        # Nettoyer chaque ligne
        @lines = map {
            my $line = $_;
            $line =~ s/<[^>]+>//g;        # retirer toutes les balises HTML restantes
            $line =~ s/&nbsp;/ /gi;       # espaces HTML
            $line =~ s/&amp;/&/gi;        # ampersand HTML
            $line =~ s/^\s+|\s+$//g;      # trim
            $line;                        # retourner la ligne nettoyée
        } grep { $_ !~ /^\*/ } @lines;    # filtrer les lignes qui commencent par *


        # Joindre toutes les lignes avec saut HTML
        $lyrics = join("<br>", @lines);
    } else {
        $_[0] = "No lyrics found";
        return 0;
    }

    $_[0] = $lyrics;
    return 1;
}],
2
Hello,

I try to update lyrics.pm

I should replace the escape in title by a "-" to work.

Could you help me ? (I don't know _[0] etc...)

genius => [genius => sub { ::ReplaceFields($_[0], "https://genius.com/%a-%t-lyrics", sub { my $s=::url_escapeall($_[0]); $s=~s/%20/-/g; $s }) }, undef,
sub {
                            if ($_[0] =~ m/<span class="lyrics__content__\w+">/) {
                                $_[0] =~ s/.*<span class="lyrics__content__\w+">(.+?)<\/span>.*/$1/s;
                                $_[0] =~ s/[\r\n]/<br>/g;
return 1;
                            } else {
$_[0] = $notfound;
return 0;
                            }
                        }],