Last change
on this file since 14 was
1,
checked in by peter, 13 years ago
|
initial import of current flacrip files into the trunk
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/perl -w |
---|
2 | use strict; |
---|
3 | |
---|
4 | use Gtk2 -init; |
---|
5 | use Gtk2::Ex::Simple::List; |
---|
6 | use Audio::FLAC::Header; |
---|
7 | use File::Spec::Functions qw{catfile}; |
---|
8 | |
---|
9 | my $directory = '/home/peter/cds'; |
---|
10 | |
---|
11 | my $window = Gtk2::Window->new; |
---|
12 | $window->signal_connect(destroy => sub { Gtk2->main_quit }); |
---|
13 | |
---|
14 | my $vbox = Gtk2::VBox->new; |
---|
15 | |
---|
16 | my $list = Gtk2::Ex::Simple::List->new( |
---|
17 | 'Artist' => 'text', |
---|
18 | 'Album' => 'text', |
---|
19 | 'Filename' => 'text', |
---|
20 | ); |
---|
21 | |
---|
22 | my $scrollbox = Gtk2::ScrolledWindow->new(); |
---|
23 | $scrollbox->add_with_viewport($list); |
---|
24 | #$vbox->add($list); |
---|
25 | |
---|
26 | |
---|
27 | opendir FLAC_DIR, $directory; |
---|
28 | while (my $file = readdir(FLAC_DIR)) { |
---|
29 | next unless $file =~ /\.flac$/; |
---|
30 | my $flac = Audio::FLAC::Header->new(catfile($directory, $file)); |
---|
31 | my $tags = $flac->tags; |
---|
32 | push @{ $list->{data} }, [ |
---|
33 | $tags->{ARTIST} || '[No Artist]', |
---|
34 | $tags->{ALBUM} || '[No Title]', |
---|
35 | $file |
---|
36 | ]; |
---|
37 | } |
---|
38 | |
---|
39 | $list->signal_connect(row_activated => sub { |
---|
40 | my ($list, $path, $column) = @_; |
---|
41 | my $filename = $list->{data}[$path->to_string][2]; |
---|
42 | #TODO: burn flac file |
---|
43 | }); |
---|
44 | |
---|
45 | $window->add($scrollbox); |
---|
46 | $window->set_default_size(600, 400); |
---|
47 | $window->show_all; |
---|
48 | Gtk2->main; |
---|
Note: See
TracBrowser
for help on using the repository browser.