ungetestet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /usr/bin/perl
use Gtk;
use strict;
use warnings;
use File::Find;
### mp3 and wma to ogg by darklinux presents
my $dir=`pwd`;
chomp $dir;
my @files;
find(\&get_files,$dir);
conver_file($_) for(@files);
#==
# Gtk-part
#==
set_locale Gtk;
init Gtk;
my $false = 0;
my $true = 1;
my $window = new Gtk::Window( "toplevel" );
my $button = new Gtk::Button( "Fertig" );
$window->signal_connect( "delete_event", \&CloseAppWindow );
$button->signal_connect( "clicked", \&CloseAppWindow );
$button->show();
$window->border_width( 15 );
$window->add( $button );
$window->show();
main Gtk;
exit( 0 );
sub CloseAppWindow
{
Gtk->exit( 0 );
system('exit');
return $false;
exit
}
#------------------------
# Subroutines
#------------------------
sub convert_file{
my ($file) = @_;
my %valid = (mp3 => 4, wma => 5);
my $extension = (split(/\./,$file))[-1];
return unless($valid{$extension});
print "Checking file: $orig_file\n";
my $new_wav_file = $orig_file;
$new_wav_file =~ s/$extension$/wav/;
my $new_ogg_file = $orig_file;
$new_ogg_file =~ s/$extension$/ogg/;
my $convert_to_wav =qq~mplayer "$orig_file" -ao pcm -aofile "$new_wav_file"~;
my $convert_to_ogg = qq~oggenc -q $valid{$extension} "$new_wav_file" "$new_ogg_file"~;
print "EXEC 1: $convert_to_wav\n";
my $cmd = `$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd = `$convert_to_ogg`;
print "REMOVE WAV:\n";
unlink $new_wav_file;
print "REMOVE MP3:\n";
unlink $orig_file;
print "\n\n";
}
sub get_files{
push(@files,$File::Find::name) if(-f $_);
}# get_files
\n\n
<!--EDIT|renee|1111566395-->