elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] DH Player
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] DH Player  (Leído 1,292 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] DH Player
« en: 14 Octubre 2011, 15:26 pm »

Bueno , este es un simple reproductor de musica que hice en perl
En esta version podran tener buscar musica y reproducirla todo en una ventana grosa

Código
  1. #!usr/bin/perl
  2. #DH Player 0.1
  3. #(C) Doddy Hackman 2011
  4.  
  5. use Tk;
  6. use Win32::MediaPlayer;
  7.  
  8. if ($^O eq 'MSWin32') {
  9. use Win32::Console;
  10. Win32::Console::Free();
  11. }
  12.  
  13.  
  14. $test = new Win32::MediaPlayer;
  15.  
  16. $new = MainWindow->new(-background=>"black");
  17. $new->geometry("350x420+20+20");
  18. $new->resizable(0,0);
  19. $new->title("DH Player 0.1 (C) Doddy Hackman 2011");
  20. $new->Label(-background=>"black",-foreground=>"green",-font=>"Impact",-text=>"Directory : ")->place(-x=>"20",-y=>"20");
  21. my $dir = $new->Entry(-background=>"black",-foreground=>"green",-text=>"C:\\Users\\Daniel\\Desktop\\WarFactory\\Perl\\musica")->place(-x=>"100",-y=>"25");
  22. $new->Button(-background=>"black",-foreground=>"green",-activebackground=>"green",-text=>"Search",-width=>"10",-command=>\&buscar)->place(-x=>"240",-y=>"25");
  23. $new->Label(-background=>"black",-foreground=>"green",-text=>"Files Found",-font=>"Impact")->place(-y=>"95",-x=>"120");
  24. my $lists = $new->Listbox(-background=>"black",-foreground=>"green")->place(-y=>"130",-x=>"100");
  25. $new->Button(-background=>"black",-foreground=>"green",-text=>"Play",-width=>"55",-activebackground=>"green",-command=>\&play)->place(-y=>"310");
  26. $new->Button(-background=>"black",-foreground=>"green",-text=>"Pause",-width=>"55",-activebackground=>"green",-command=>\&pause)->place(-y=>"333");
  27. $new->Button(-background=>"black",-foreground=>"green",-text=>"Resume",-width=>"55",-activebackground=>"green",-command=>\&resume)->place(-y=>"356");
  28. $new->Button(-background=>"black",-foreground=>"green",-text=>"Stop",-width=>"55",-activebackground=>"green",-command=>\&stop)->place(-y=>"379");
  29.  
  30.  
  31. MainLoop;
  32.  
  33.  
  34. sub play {
  35.  
  36. my $dir = $dir->get;
  37.  
  38. $d = $lists->curselection();
  39.  
  40. for my $id (@$d) {
  41. my $cancion = $lists->get($id);
  42. $test->load($dir."\\".$cancion);
  43. $test->play;
  44. }
  45.  
  46. }
  47.  
  48. sub stop {
  49. $test->close;
  50. }
  51.  
  52. sub pause {
  53.  
  54. my $dir = $dir->get;
  55.  
  56. $d = $lists->curselection();
  57.  
  58. for my $id (@$d) {
  59. my $cancion = $lists->get($id);
  60. $test->pause;
  61. }
  62.  
  63. }
  64.  
  65. sub resume {
  66.  
  67. my $dir = $dir->get;
  68.  
  69. $d = $lists->curselection();
  70.  
  71. for my $id (@$d) {
  72. my $cancion = $lists->get($id);
  73. $test->resume;
  74. }
  75.  
  76. }
  77.  
  78. sub buscar {
  79.  
  80. $lists->delete(0.0,"end");
  81.  
  82. #$dir = "C:\\Users\\Daniel\\Desktop\\WarFactory\\Perl\\musica";
  83.  
  84. my $dir = $dir->get;
  85.  
  86. opendir DIR,$dir;
  87.  
  88. my @archivos = readdir DIR;
  89.  
  90. close DIR;
  91.  
  92. chomp @archivos;
  93.  
  94. foreach my $file(@archivos) {
  95. if (-f $dir."\\".$file) {
  96. $lists->insert("end",$file);
  97. }
  98. }
  99.  
  100. }
  101.  
  102.  
  103. # ¿ The End ?
  104.  
  105.  
  106.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
perl
Scripting
nobo 0 3,204 Último mensaje 22 Febrero 2005, 07:49 am
por nobo
Perl
Scripting
zhynar_X 2 2,234 Último mensaje 12 Enero 2008, 04:36 am
por GroK
-=PERL=-
Scripting
D4RIO 1 5,724 Último mensaje 25 Febrero 2008, 17:27 pm
por D4RIO
VMware Player 3.1.3. Crea y ejecuta máquinas virtuales con VMware Player
Software
wolfbcn 0 4,142 Último mensaje 23 Noviembre 2010, 21:11 pm
por wolfbcn
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,840 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines