Schrift
[thread]7216[/thread]

MP3-tag überschreiben: Hilfe, überschreiben klappt nicht (Seite 2)



<< |< 1 2 >| >> 15 Einträge, 2 Seiten
GwenDragon
 2005-08-17 20:12
#57258 #57258
User since
2005-01-17
14542 Artikel
Admin1
[Homepage]
user image
Probier mal CPAN:MP3-Tag
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

Tugi2o
 2005-08-18 14:09
#57259 #57259
User since
2005-08-17
3 Artikel
BenutzerIn
[default_avatar]
also so gehts endlich, Danke für die Hilfe:

Code: (dl )
1
2
3
4
5
6
my $file = "test.mp3;
my $tag = get_mp3tag($file) or die "No TAG info";
$tag->{ARTIST}   =  "Hans";
$tag->{TITLE}    =  "Wurst";
$tag->{ALBUM}    =  "Doener";
set_mp3v2tag($file, $tag);
J-jayz-Z
 2005-08-19 05:05
#57260 #57260
User since
2005-04-13
625 Artikel
BenutzerIn
[Homepage] [default_avatar]
Ich hab mir ein kleines Tk Tool geschrieben zu dem Thema, vielleicht interessiert es ja jemand:
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/perl
use strict;
use warnings;

use Tk;
use Tk::FileSelect;
use MP3::ID3v1Tag;

my $file;
my $select;
my %info;
my @info = qw/title artist album year genre genre_num comment/;
my %mp3;


#Frames deklarieren
my %config;
$config{main} = MainWindow->new();
$config{up} = $config{main}->Frame()->pack(-side => 'top');
$config{bottom} = $config{main}->Frame()->pack(-side => 'bottom');
$config{bottom_left} = $config{bottom}->Frame()->pack(-side => 'left');
$config{bottom_right} = $config{bottom}->Frame()->pack(-side => 'right');
$config{middle} = $config{main}->Frame()->pack(-side => 'bottom');
$config{middle_left} = $config{middle}->Frame()->pack(-side => 'left');
$config{middle_right} = $config{middle}->Frame()->pack(-side => 'right');
$config{top} = $config{main}->Frame()->pack(-side => 'top');
$config{top_left} = $config{top}->Frame()->pack(-side => 'left');
$config{top_right} = $config{top}->Frame()->pack(-side => 'right');

#Titel erzeugen
$config{main}->configure(-title => "MP3 Tag Editor");


#Überschrift erzeugen
$config{header} = $config{up}->Label(-text => 'MP3 Tag Editor', -font => '{Arial} 15 {underline}')->pack();

#Buttons erzeugen
$config{button_save} = $config{bottom_left}->Button(-text => 'Save', -command => \&save)->pack(-side => 'left');

$config{button_exit} = $config{bottom_right}->Button(-text => 'Quit', -command => sub { $config{main}->destroy(); })->pack(-side => 'right');

$config{button_clear} = $config{bottom_right}->Button(-text => 'Clear', -command => \&clear)->pack();

#MP3 Selektion
$config{top_left}->Entry(-textvariable => \$file)->pack(-side => 'top');
$config{top_right}->Button(-text => 'MP3', -command => \&mp3_select)->pack(-side => 'top');

#Hauptinhalt erzeugen
foreach (@info) {
$config{middle_left}->Label(-text => "$_")->pack();
$mp3{$_} = $config{middle_right}->Entry(-textvariable => \$info{$_})->pack();
}

MainLoop();


sub mp3_select {
$select = $config{main}->FileSelect(-directory => './');
$file= "";
$file = $select->Show;
unless($file =~ /.*\.mp3/i) {
$file = "";
$config{error} = $config{main}->Toplevel();
$config{error}->Label(-text => 'Kann nur MP3 Dateien öffnen !')->pack();
$config{error}->Button(-text => 'Schließen', -command => sub { $config{error}->destroy(); })->pack(-side => 'bottom');
} else {
&mp3_info();
}
}

sub mp3_info {
my $mp3_file = new MP3::ID3v1Tag($file);
foreach my $info (@info) {
my $tmp = "get_$info";
$info{$info} = $mp3_file->$tmp();
}
}

sub clear {
foreach (@info) {
$mp3{$_}->delete('0.0','end');
}
}

sub save {
my $mp3_file = new MP3::ID3v1Tag($file);
foreach (@info) {
my $tmp = "set_$_";
my $new = $mp3{$_}->get();
$mp3_file->$tmp($new);
my $save_status = $mp3_file->save();
unless($save_status) {
$config{popup} = $config{main}->Toplevel();
$config{popup}->Label(-text => "Fehler beim sichern von $_")->pack();
$config{popup}->Button(-text => 'Schließen', -command => sub { $config{popup}->destroy(); })->pack(-side => 'bottom');
}
}
}
perl -Mstrict -Mwarnings -e 'package blub; sub new { bless {} } sub bar {my $self=shift; $self->{bla}="5065726c2d436f6d6d756e697479"; return $self->{bla};} my $foo=blub->new();print "Hallo ";print pack("H*",$foo->bar()); print "\n"'

http://perl-tutor.de
Crian
 2005-08-22 11:52
#57261 #57261
User since
2003-08-04
5866 Artikel
ModeratorIn
[Homepage]
user image
Klar interessiert das, find ich sehr gut solche Rückmeldungen :-)

Ich habs mal kopiert und werd es zu Hause ausprobieren (Modul installieren etc...).
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite
[E|B]
 2005-08-22 12:30
#57262 #57262
User since
2003-08-08
2561 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Quote
Use of uninitialized value in pattern match (m//) at ./mp3.pl line 61.


Wenn du beim File-Select kein MP3 ausgewählt hast, bleibt $file (line 61) leer und erzeugt diese Meldung.
Gruß, Erik!

s))91\&\/\^z->sub{}\(\@new\)=>69\&\/\^z->sub{}\(\@new\)=>124\&\/\^z->sub{}\(\@new\)=>);
$_.=qq~66\&\/\^z->sub{}\(\@new\)=>93~;for(@_=split(/\&\/\^z->sub{}\(\@new\)=>/)){print chr;}

It's not a bug, it's a feature! - [CGI-World.de]
<< |< 1 2 >| >> 15 Einträge, 2 Seiten



View all threads created 2005-08-17 17:50.