]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - config/mpfire/mpfire.pl
ee21f4a2a6349a1e81c6c95875c96d20d546992a
6 require '/var/ipfire/general-functions.pl';
7 require "${General::swroot}/lang.pl";
8 require "${General::swroot}/header.pl";
14 if ($ARGV[0] eq 'scan') {
15 my $command = "find ";
17 $command .= "\"$ARGV[1]\"";
18 if ($ARGV[2] eq 'off'){$command .= " -maxdepth 1";}
19 $command .= " -name *.mp3";
20 my @files = `$command`;
29 open(DATEI
, ">${General::swroot}/mpfire/db/songs.db") || die "Kann Datenbank nicht speichern";
34 if ($ARGV[0] eq 'getdb') {
39 if ($ARGV[0] eq 'play') {
40 if ($debug){print "Yes we are called and we will play $ARGV[1]\n";}
41 system("/usr/bin/mpg123 -b 1024 --aggressive -q \"$ARGV[1]\" 2>/dev/null >/dev/null &");
44 if ($ARGV[0] eq 'stop') {
45 my $PID = `ps -ef | grep mpg123 | grep playlist | head -1 | awk '{ print \$2 }'`;
46 if ($debug){print "Stopping $PID\n";}
47 system("kill -KILL $PID");
50 if ($ARGV[0] eq 'volup') {
51 if ($debug){print "Increasing Volume\n";}
52 system("/usr/bin/amixer set Master $ARGV[1]%+ 2>/dev/null >/dev/null");
55 if ($ARGV[0] eq 'voldown') {
56 if ($debug){print "Decreasing Volume\n";}
57 system("/usr/bin/amixer set Master $ARGV[1]%- 2>/dev/null >/dev/null");
60 if ($ARGV[0] eq 'playall') {
61 if ($debug){print "Playing everything\n";}
62 system("/usr/bin/mpg123 -b 1024 --aggressive -Zq@ /var/ipfire/mpfire/playlist 2>/dev/null >/dev/null &");
65 if ($ARGV[0] eq 'pause') {
66 my $PID = `ps -ef | grep mpg123 | grep playlist | head -1 | awk '{ print \$2 }'`;
67 if ($debug){print "Pausing Process $PID\n";}
68 system("kill -STOP $PID");
71 if ($ARGV[0] eq 'resume') {
72 my $PID = `ps -ef | grep mpg123 | grep playlist | head -1 | awk '{ print \$2 }'`;
73 if ($debug){print "Resuming Process $PID\n";}
74 system("kill -CONT $PID");
77 if ($ARGV[0] eq 'next') {
78 if ($debug){print "Next Song\n";}
79 my $PID = `ps -ef | grep mpg123 | grep playlist | head -1 | awk '{ print \$2 }'`;
80 system("kill -SIGINT $PID");
84 my $mp3 = MP3
::Tag
->new($filename);
85 my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
86 my $info = get_mp3info
($filename);
88 $songs{$filename} = "|".$artist."|".$title."|".$track."|".$album."|".$year."|".$genre."|".$info->{MM
}."|".$info->{SS
}."|".$info->{BITRATE
}."|".$info->{FREQUENCY
}."|".$info->{MODE
}."\n";
91 sub getExistingSongs
(){
92 open(DATEI
, "<${General::swroot}/mpfire/db/songs.db") || die "Keine Datenbank vorhanden";
96 my @Zeile = split(/\|/,$_);
97 $songs{$Zeile[0]} = "|".$Zeile[1]."|".$Zeile[2]."|".$Zeile[3]."|".$Zeile[4]."|".$Zeile[5]."|".$Zeile[6]."|".$Zeile[7]."|".$Zeile[8]."|".$Zeile[9]."|".$Zeile[10]."|".$Zeile[11]."\n";