Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #===============================================================================
- #
- # archivo: infomp3.pl
- #
- # USAGE: ./infomp3.pl MP3
- #
- # DESCRIPTION: Programa para colocar y mostrar informacion de su musica mp3
- #
- # OPTIONS: ---
- # REQUIREMENTS: Gtk3,MP3::Info
- # BUGS: gobject-introspection >= 1.33.10
- # NOTES: Error de gobject en mi sistema donde se compilo,compilar en su propio sistema para evitar bugs.
- # CODER: demianx864 (http://www.itimetux.com)
- # PROGRAMER: http://search.cpan.org/dist/MP3-Info/Info.pm,http://search.cpan.org/~tsch/Gtk3-0.009/lib/Gtk3.pm
- # COMPANY:
- # VERSION: 1.0
- # CREATED: 15/06/13 12:02:01
- # REVISION: ---
- #===============================================================================
- # For developing #
- #use strict;
- #use warnings;
- use utf8;
- use MP3::Info;
- use feature ':5.14';
- use Glib qw/TRUE FALSE/;
- use Gtk3 -init;
- my $title = "Mp3InfoPerl";
- my $ventana = Gtk3::Window->new('toplevel');
- $ventana->set_default_size(170, 260);
- $ventana->set_title($title);
- $ventana->set_border_width(2);
- $ventana->set_resizable(FALSE);
- $ventana->signal_connect(delete_event => \&salir);
- my $ajustes = Gtk3::Settings->get_default;
- $ajustes->set( 'gtk-application-prefer-dark-theme', TRUE );
- my $archivo = "@ARGV";
- my $tag = get_mp3tag("$archivo") || die exit;
- my $info = get_mp3info("$archivo") || die exit;
- my $titulo = Gtk3::Entry->new();
- my $artista = Gtk3::Entry->new();
- my $album = Gtk3::Entry->new();
- my $anio = Gtk3::Entry->new();
- my $comentario = Gtk3::Entry->new();
- my $genero = Gtk3::Entry->new();
- my %labels = ( Titulo => Gtk3::Label->new("Titulo : "),
- Artista => Gtk3::Label->new("Artista : "),
- Album => Gtk3::Label->new("Album : "),
- Anio => Gtk3::Label->new("AƱo : "),
- Comentario => Gtk3::Label->new("Comentario : "),
- Genero => Gtk3::Label->new("Genero : ")
- );
- my $separador = Gtk3::Separator->new('vertical');
- my $aceptar = Gtk3::Button->new_with_label("Aceptar");
- my $binfo = Gtk3::Button->new_with_label("Informacion");
- my $cancelar = Gtk3::Button->new_with_label("Cancelar");
- $aceptar->signal_connect ( "clicked" => \&settags);
- $binfo->signal_connect ( "clicked" => \&informacion,0);
- $cancelar->signal_connect ( "clicked" => \&salir);
- my $vbox = Gtk3::Box->new("vertical", 0);
- $vbox->pack_start($titulo, TRUE,TRUE , 0);
- $vbox->pack_start($artista, TRUE,TRUE , 0);
- $vbox->pack_start($album, TRUE,TRUE , 0);
- $vbox->pack_start($anio, TRUE,TRUE , 0);
- $vbox->pack_start($comentario, TRUE,TRUE , 0);
- $vbox->pack_start($genero, TRUE,TRUE , 0);
- my $vboxlabels = Gtk3::Box->new("vertical", 0);
- $vboxlabels->pack_start($labels{"Titulo"}, TRUE,TRUE , 0);
- $vboxlabels->pack_start($labels{"Artista"}, TRUE,TRUE , 0);
- $vboxlabels->pack_start($labels{"Album"}, TRUE,TRUE , 0);
- $vboxlabels->pack_start($labels{"Anio"}, TRUE,TRUE , 0);
- $vboxlabels->pack_start($labels{"Comentario"}, TRUE,TRUE , 0);
- $vboxlabels->pack_start($labels{"Genero"}, TRUE,TRUE , 0);
- my $hbox = Gtk3::Box->new("horizontal", 0);
- $hbox->pack_start($vboxlabels, TRUE,TRUE , 0);
- $hbox->pack_start($separador, TRUE,TRUE , 0);
- $hbox->pack_start($vbox, TRUE,TRUE , 0);
- my $hboxbtons = Gtk3::Box->new("horizontal", 0);
- $hboxbtons->pack_start($aceptar, FALSE,FALSE , 0);
- $hboxbtons->pack_start($binfo, FALSE,FALSE , 0);
- $hboxbtons->pack_start($cancelar, FALSE,FALSE , 0);
- my $vboxall = Gtk3::Box->new("vertical", 0);
- $vboxall->pack_start($hbox, TRUE,TRUE , 0);
- $vboxall->pack_start($hboxbtons, FALSE,FALSE , 0);
- $ventana->add($vboxall);
- tags();
- $ventana->show_all();
- Gtk3->main();
- sub salir { Gtk3->main_quit; }
- sub tags
- {
- $titulo->set_text($tag->{TITLE});
- $artista->set_text($tag->{ARTIST});
- $album->set_text($tag->{ALBUM});
- $anio->set_text($tag->{YEAR});
- $comentario->set_text($tag->{COMMENT});
- $genero->set_text($tag->{GENRE});
- }
- sub informacion
- {
- my $stereo = "No";
- my $copyrigth = " ";
- if ($info->{STEREO})
- {
- $stereo = "Si";
- }
- if ($info->{COPYRIGHT})
- {
- $copyrigth = "Si";
- }
- my $texto =<<EOF;
- Nonmbre(Archivo) : $archivo
- Version : $info->{VERSION}
- MPEG Layer : $info->{LAYER}
- Stereo : $stereo
- Frequency : $info->{FREQUENCY}
- Size (bytes) : $info->{SIZE}
- Time : $info->{TIME}
- COPYRIGHT : $copyrigth
- EOF
- my $dialog = Gtk3::MessageDialog->new(
- $ventana,'destroy-with-parent', 'info', 'close', $texto);
- $dialog->signal_connect( response => sub { $dialog->destroy } );
- $dialog->show();
- }
- sub settags
- {
- $tag->{TITLE} = $titulo->get_text;
- $tag->{ARTIST} = $artista->get_text;
- $tag->{ALBUM} = $album->get_text;
- $tag->{YEAR} = $anio->get_text;
- $tag->{COMMENT} = $comentario->get_text;
- $tag->{GENRE} = $genero->get_text;
- set_mp3tag($archivo,$tag);
- salir();
- }
- =head LICENSE
- This library is free software; you can redistribute it and/or modify it under
- the terms of the GNU Library General Public License as published by the Free
- Software Foundation; either version 2.1 of the License, or (at your option) any
- later version.
- =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement