Thread Perl skript unterverzeichnisse öffnen (3 answers)
Opened by Gast at 2005-03-22 19:56

Gast Gast
 2005-03-22 19:56
#52887 #52887
Dieses script wandelt mp3 und wma s in ogg um nun möchte ich das es auch noch die Unterorderner des jeweiligen ordners öffnet und die enthaltenen lieder umwandelt
Code: (dl )
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
76
77
78
79
80
#! /usr/bin/perl 

### mp3 and wma to ogg by darklinux presents

use warnings;

$dir=`pwd`;

chomp($dir);

opendir(CHECKDIR,"$dir");

while ($file=readdir(CHECKDIR)) {
$orig_file=$file;

if($orig_file =~ m/\.mp3$/i)
{
print "Checking file: $orig_file\n";
$new_wav_file=$orig_file;$new_wav_file=~s/\.mp3/\.wav/;
$new_ogg_file=$orig_file;$new_ogg_file=~s/\.mp3/\.ogg/;
$convert_to_wav="mplayer \"./$orig_file\" -ao pcm -aofile \"./$new_wav_file\"";
$convert_to_ogg="oggenc -q 4 \"./$new_wav_file\" \"./$new_ogg_file\"";
$remove_wav="rm -rf \"./$new_wav_file\"";
$remove_mp3="rm -rf \"./$orig_file\"";
print "EXEC 1: $convert_to_wav\n";
$cmd=`$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd=`$convert_to_ogg`;
print "REMOVE WAV: $remove_wav\n";
$cmd=`$remove_wav`;
print "REMOVE MP3: $remove_mp3\n";
$cmd=`$remove_mp3`;
print "\n\n";
}

elsif($orig_file =~ m/\.wma$/i)
{
print "Checking file: $orig_file\n";
$new_wav_file=$orig_file;$new_wav_file=~s/\.wma/\.wav/;
$new_ogg_file=$orig_file;$new_ogg_file=~s/\.wma/\.ogg/;
$convert_to_wav="mplayer \"./$orig_file\" -ao pcm -aofile \"./$new_wav_file\"";
$convert_to_ogg="oggenc -q5 \"./$new_wav_file\" \"./$new_ogg_file\"";
$remove_wav="rm -rf \"./$new_wav_file\"";
$remove_wma="rm -rf \"./$orig_file\"";
print "EXEC 1: $convert_to_wav\n";
$cmd=`$convert_to_wav`;
print "EXEC 2: $convert_to_ogg\n";
$cmd=`$convert_to_ogg`;
print "REMOVE WAV: $remove_wav\n";
$cmd=`$remove_wav`;
print "REMOVE WMA: $remove_wma\n";
$cmd=`$remove_wma`;
print "\n\n";
}

}

use Gtk;
use strict;
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
}

View full thread Perl skript unterverzeichnisse öffnen