Last.fm est à la fois une webradio et un site internet proposant un système de collection de statistiques et de recommandation de musique. En mars 2008, le site se targuait d'avoir plus de 21 millions d'utilisateurs actifs dans plus de 200 pays
bon
je suis parti du principe que plus des artistes ( d'antisocial ) étaient écoutés, plus ils seraient recommandés
petit regard du coté de perl
http://search.cpan.org/~roam/Audio-Scrobbler-0.01/lib/Audio/Scrobbler.pmet j'ai donc modifié le code source du logiciel pour créer un auditeur ( robot ) qui écoute que du antisocial
#!/usr/bin/perl -w
use 5.006;
use strict;
=head1 NAME
scrobbler-helper - submit a track to AudioScrobbler
=head1 SYNOPSIS
scrobbler-helper [-nv] [-e encoding] [-f configfile] -P progname
-V progver title artist album year comment genre length
=head1 DESCRIPTION
The B<scrobbler-helper> utility uses the C<Audio::Scrobbler> module to
submit a single track's information to Last.fm's AudioScrobbler -
http://www.audioscrobbler.com/. It requires the program (plug-in) name
and version to be specified on the command line, and also requires all
seven track attributes, although some of them may be omitted by supplying
empty strings.
The following command-line options are recognized:
=over 4
=item -e encoding
Specify the character encoding of the track info, if it is neither UTF-8
nor the one specified via B<default_encoding> in the configuration file.
=item -f configfile
Specify a different configuration file, not ~/.scrobbler-helper.conf.
=item -n
Do not actually perform the handshake and submission
(sets the C<Audio::Scrobbler> B<"fake"> option).
=item -P progname
Specify the name of the AudioScrobbler plug-in submitting the data.
This option is B<mandatory>!
=item -v
Verbose operation - display diagnostic messages to the standard output
(sets the C<Audio::Scrobbler> B<"verbose"> option).
=item -V progver
Specify the version of the AudioScrobbler plug-in submitting the data.
This option is B<mandatory>!
=back
Besides the command line, the B<scrobbler-helper> utility also retrieves
information from a per-user configuration file, usually
~/.scrobbler-helper.conf; it is a INI-style file, which must contain a
secion named B<"global">. The following variables are recognized, with
B<username> and B<password> being mandatory:
=over 4
=item * default_encoding
The encoding to assume for the track info, if none is supplied with
the B<-e> command-line option. If neither B<-e> is given on the command
line nor B<default_encoding> specified in the configuration file, the
B<scrobbler-helper> utility assumes UTF-8.
=item * fix_track_name
A boolean flag specifying whether to do some trivial fixes on the song
name before submitting it. Currently, this only removes a "DD. "
sequence at the start of the name, where 'D' is a digit.
The values C<on>, C<true>, C<yes>, and C<1> are considered to be true.
=item * password
The password for the AudioScrobbler account.
=item * username
The username for the AudioScrobbler account.
=back
[global]
username=antisocial-net
password=xxxxxxxxxx
# Optional (the default is UTF-8)
default_encoding=windows-1251
# Optional (the default is "no")
fix_track_name=yes
=cut
use Config::IniFiles;
use Encode;
use Getopt::Std;
use Audio::Scrobbler;
sub is_true($);
my %infovars = (
'cmdopts' => [ qw/P V/ ],
'cmdline' => [ qw/title artist album year comment genre length/ ],
'global' => [ qw/username password/ ],
'global_nc' => [ qw/default_encoding fix_track_name/ ],
);
my $verbose = 0;
MAIN:
{
//le debut de la modification
my $i = 0; # les tableaux commencent à 0
my @tab_artiste = ();
my @tab_title = ();
my @tab_album = ();
my @tab_year = ();
my @tab_duration = ();
my @LASTFM = 0;
open(LISTE, "listes") or die "ouverture de fichiers impossible:$!\n"; // on prend un artiste dans une liste
while (my $ligne = <LISTE>) { # attention, ici my est local aux {}
chomp $ligne; # on chomp de suite !
my ($artiste, $title,$album,$year,$duration)= split(/:/,$ligne);
$tab_artiste[$i]=$artiste;
$tab_album[$i]=$album;
$tab_title[$i]=$title; # plus élégant: push(@tab_title, $title);
$tab_year[$i]=$year;
$tab_duration[$i]=$duration;
$i++;
}
my $aleatoire= int (rand $i);
sleep $aleatoire; // on dort pour tromper l ennemi
#print "le nombre aleatoire",$aleatoire,"\n";
#######
my %info;
my (%opts, %cfg) = ();
my ($configfname) = "scrobbler-helper.conf";
my ($scrob);
getopts('nve:f:P:V:', \%opts) or die "Parsing options: $!\n";
$configfname = $opts{'f'} if $opts{'f'};
$verbose = 1 if $opts{'v'};
$info{'verbose'} = $verbose;
$info{'fake'} = 1 if $opts{'n'};
@info{qw/progname progver encoding/} = @opts{@{$infovars{'cmdopts'}}};
if (!($info{'progname'} && $info{'progver'})) {
die "Must specify program name (-P) and version (-V)!\n";
}
if (@ARGV != @{$infovars{'cmdline'}}) {
die 'Need '.@{$infovars{'cmdline'}}.' args: '.
join(', ', @{$infovars{'cmdline'}}).".\n";
}
#print "le title est ",$tab_title[$aleatoire], "l'album est:",$tab_album[$aleatoire],"l artiste:",$tab_artiste[$aleatoire],$tab_year[$aleat
oire],"---",$tab_duration[$aleatoire],"\n";
@LASTFM=($tab_title[$aleatoire],$tab_artiste[$aleatoire],$tab_album[$aleatoire],$tab_year[$aleatoire],"www.antisocial.be","Experime
ntal",$tab_duration[$aleatoire]);
#@info{@{$infovars{'cmdline'}}} = @ARGV;
@info{@{$infovars{'cmdline'}}} = @LASTFM;
map { s/^\s+//; s/\s+$//; } @info{@{$infovars{'cmdline'}}};
if (!tie %cfg, 'Config::IniFiles',
(-file => $configfname, -allowcontinue => 1)) {
my $err = join "\n", "Could not read $configfname: $!",
@Config::IniFiles::errors;
die "$err\n";
}
@info{@{$infovars{'global'}}, @{$infovars{'global_nc'}}} =
@{$cfg{'global'}}{@{$infovars{'global'}},
@{$infovars{'global_nc'}}};
for (@{$infovars{'global'}}) {
die 'Missing variables in the config file, need at least '.
join(', ', @{$infovars{'global'}}).".\n"
unless defined($info{$_});
}
# Recode the track info into UTF-8
if (defined($info{'default_encoding'}) &&
(!defined($info{'encoding'}) || $info{'encoding'} eq '')) {
$info{'encoding'} = $info{'default_encoding'};
}
if (defined($info{'encoding'}) && $info{'encoding'} !~ /^utf-?8$/i) {
print "RDBG recoding track info from $info{encoding} to UTF8\n"
if $verbose;
foreach (@{$infovars{'cmdline'}}) {
$info{$_} = decode($info{'encoding'}, $info{$_});
}
}
# Fix up the track name if requested
if (defined($info{'fix_track_name'}) &&
is_true($info{'fix_track_name'})) {
$info{'title'} =~ s/^\d\d?\. //;
print "RDBG fixed up the track name to $info{title}\n"
if $verbose;
}
print "valeurs cmdline:",%info, "\n";
# Rock'n'roll!
$scrob = new Audio::Scrobbler('cfg' => \%info) or
die "Could not create an Audio::Scrobbler object\n";
$scrob->handshake() or die "Scrobbler: ".$scrob->err()."\n";
print "RDBG handshake successful, it seems\n" if $verbose;
$scrob->submit(\%info) or
die "Scrobbler submit: ".$scrob->err()."\n";
print "RDBG submision successful, it seems\n" if $verbose;
}
sub is_true($)
{
my $s = lc $_[0];
return ($s eq '1' || $s eq 'on' || $s =~ /^[ty]/);
}
=head1 TODO
=over 4
=item *
Command-line options, so people don't have to submit everything...
=item *
Storing and caching of unsuccessful submissions for later retrying.
=back
=head1 SEE ALSO
B<Audio::Scrobbler>
=over 4
=item * http://www.last.fm/
=item * http://www.audioscrobbler.com/
=item * http://www.audioscrobbler.net/
=back
The home site of the C<Audio::Scrobbler> module is
http://devel.ringlet.net/audio/Audio-Scrobbler/
=head1 AUTHOR
Peter Pentchev, E<lt>roam@ringlet.netE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005, 2006 by Peter Pentchev.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.7 or,
at your option, any later version of Perl 5 you may have available.
$Id: scrobbler-helper 88 2006-01-02 09:16:32Z roam $
=cut
le fichier liste
MoDuLe VxD:le bucgoer au queen:Bugcore is not a crime:2005:188
sensible:human:tasty:2006:160
silence:1:La machine:2006:159
TheGalactix lassad:Corbeil essonne bonjour:Les idees saines de serge dassault:2004:208
Tzii:sex on my tv screen:Sexe, Domination et autres rejouissances:2005:198
Simone & Flu:Depressa:[MA019] Wonderbra...zil:2004:154
UNAS:2ND BOSS:8-BIT RNR:2006:191
Le tout est lancé tous les quart d'heures pendant les heures ouvrables
et le résultat ici
http://www.lastfm.fr/user/antisocial-net