Hi Zentara! (its me renegadex) just wanted to share to you a Gtk2 version of your karaoke player. its not yet finish but atleast i was able to make it do the thing that you do (display lyrics on the go). this is the code i used (borrowed from some examples etc).
#!/usr/bin/perl # modules use strict; use Gtk2 '-init'; use Gtk2::Helper; use Image::Magick; use Goo::Canvas; use Data::Dumper; use IPC::Open2; use FileHandle; my $wfh = FileHandle->new(); my $rfh = FileHandle->new(); my $text; my $timpid; my $tag; $|=1; # i dont know what this is???? open2($rfh,$wfh, "/bin/sh"); my $tag = Gtk2::Helper->add_watch($rfh->fileno(), 'in',\&get_from); my $window = Gtk2::Window->new(); $window->fullscreen(); my $canvas = Goo::Canvas->new(); config_canvas(); $window->add($canvas); $window->show_all(); Gtk2->main(); sub config_canvas { my $res_line = `xdpyinfo | grep 'dimensions:'`; my ($dw,$dh) = $res_line =~ m/(\d*)x(\d*) pixel/; my $uw = $dw - 50; my $uh = $dh - 50; $canvas->set_bounds(-$uw/2,-$uh/2,$uw/2,$uh/2); $canvas->set('background-color'=>"black"); $canvas->set('anchor','center'); $canvas->set('integer-layout'=>1); my $root = $canvas->get_root_item; my $bkg = Goo::Canvas::Group->new($root); my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file_at_scale('karaok +e/b1.jpg',$uw,$uh,1); my $img = Goo::Canvas::Image->new($bkg,$pixbuf,-$uw/2,-$uh/2); $img->signal_connect('button_press_event'=>\&mouse_press); my $video = Goo::Canvas::Group->new($root); my $lyrics = Goo::Canvas::Group->new($root); $text = Goo::Canvas::Text->new($lyrics,"testing",0,0,0,'center +'); } sub get_from { # we safely can read a chunk into $buffer my $buffer; if ( not sysread($rfh, $buffer, 1024) ) { # obviously the connected pipe was closed print "exit\n"; Gtk2::Helper->remove_watch ($tag) or die "couldn't remove watc +her"; close($rfh); return 1; } # do something with $buffer ... print $buffer . "\n"; # *always* return true return 1; } sub mouse_press { my ($widget, $target, $event) = @_; if($event->button == 1){ print "start\n"; send_to_shell(undef,'Just Beat It','/home/server/karaoke/sloop +-john-b.kar'); }else{ print "stop\n"; send_stop(); } } sub send_to_shell { my ($widget,$title,$file) = @_; print "Playing.. $title\n"; my $cmd = "timidity '$file'"; print $wfh "$cmd\n"; } sub send_stop{ my $timgrep = `ps -a | grep timidity`; ($timpid) = $timgrep =~ /(\d+)/; system("kill $timpid"); }
some of the modules here are not yet being used. anyway... im also here to ask you if there is a way to extract lyrics from a .kar file? i saw kmid2 and it was able to display the whole lyrics, and i want to know how that is made. tnx!

In reply to Re: Tk-Karoake Player-w-timidity by Anonymous Monk
in thread Tk-Karoake Player-w-timidity by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.