En esta version podran tener buscar musica y reproducirla todo en una ventana grosa
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 99 100 101 102 103 104 | #!usr/bin/perl #DH Player 0.1 #(C) Doddy Hackman 2011 use Tk; use Win32::MediaPlayer; if ($^O eq 'MSWin32') { use Win32::Console; Win32::Console::Free(); } $test = new Win32::MediaPlayer; $new = MainWindow->new(-background=>"black"); $new->geometry("350x420+20+20"); $new->resizable(0,0); $new->title("DH Player 0.1 (C) Doddy Hackman 2011"); $new->Label(-background=>"black",-foreground=>"green",-font=>"Impact",-text=>"Directory : ")->place(-x=>"20",-y=>"20"); my $dir = $new->Entry(-background=>"black",-foreground=>"green",-text=>"C:\\Users\\Daniel\\Desktop\\WarFactory\\Perl\\musica")->place(-x=>"100",-y=>"25"); $new->Button(-background=>"black",-foreground=>"green",-activebackground=>"green",-text=>"Search",-width=>"10",-command=>\&buscar)->place(-x=>"240",-y=>"25"); $new->Label(-background=>"black",-foreground=>"green",-text=>"Files Found",-font=>"Impact")->place(-y=>"95",-x=>"120"); my $lists = $new->Listbox(-background=>"black",-foreground=>"green")->place(-y=>"130",-x=>"100"); $new->Button(-background=>"black",-foreground=>"green",-text=>"Play",-width=>"55",-activebackground=>"green",-command=>\&play)->place(-y=>"310"); $new->Button(-background=>"black",-foreground=>"green",-text=>"Pause",-width=>"55",-activebackground=>"green",-command=>\&pause)->place(-y=>"333"); $new->Button(-background=>"black",-foreground=>"green",-text=>"Resume",-width=>"55",-activebackground=>"green",-command=>\&resume)->place(-y=>"356"); $new->Button(-background=>"black",-foreground=>"green",-text=>"Stop",-width=>"55",-activebackground=>"green",-command=>\&stop)->place(-y=>"379"); MainLoop; sub play { my $dir = $dir->get; $d = $lists->curselection(); for my $id (@$d) { my $cancion = $lists->get($id); $test->load($dir."\\".$cancion); $test->play; } } sub stop { $test->close; } sub pause { my $dir = $dir->get; $d = $lists->curselection(); for my $id (@$d) { my $cancion = $lists->get($id); $test->pause; } } sub resume { my $dir = $dir->get; $d = $lists->curselection(); for my $id (@$d) { my $cancion = $lists->get($id); $test->resume; } } sub buscar { $lists->delete(0.0,"end"); #$dir = "C:\\Users\\Daniel\\Desktop\\WarFactory\\Perl\\musica"; my $dir = $dir->get; opendir DIR,$dir; my @archivos = readdir DIR; close DIR; chomp @archivos; foreach my $file(@archivos) { if (-f $dir."\\".$file) { $lists->insert("end",$file); } } } # ¿ The End ? |
0 comentarios: sobre [Perl] DH Player
Publicar un comentario para [Perl] DH Player