Hello,
Please find a few update for lyrics'plugin find in /usr/share/gmusicbrowser/plugins :
you can put this after "my %Sites="
Please find a few update for lyrics'plugin find in /usr/share/gmusicbrowser/plugins :
you can put this after "my %Sites="
Code Select
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/ / /gi; # espaces HTML
$line =~ s/&/&/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;
}],