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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Radio X 0.2
« en: 15 Octubre 2012, 02:54 am »

Estaba harto de escuchar siempre la misma cancion asi que mejore este script para poder escuchar musica con los siguientes generos.

  • Rock'n'Roll
  • Pop
  • Ambient
  • Trance
  • House
  • Y otros mas .......


Aclaro que necesitan bajar el mplayer , esta el link de descarga en el script , una vez que lo tengan descargado y descomprimido creen una carpeta llamada
"mplayer" y copian todos los archivos del archivo descomprimido en la carpeta recien creada , todo esto tiene que ser en el mismo directorio donde este el script.

El codigo es el siguiente

Código
  1. #!usr/bin/perl
  2. #Radio X
  3. #Version 0.2
  4. #Coded By Doddy H
  5. #
  6. #Download : http://www.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip
  7. #
  8.  
  9. use Cwd;
  10.  
  11. my @emisoras = (
  12.  
  13.    {},
  14.  
  15.    {
  16.  
  17.        "nombre" => "Absolute Classic Rock (Broadband)",
  18.        "genero" => "Rock'n'Roll",
  19.        "link" =>
  20. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vcbb"
  21.  
  22.    },
  23.  
  24.    {
  25.  
  26.        "nombre" => "Absolute Classic Rock (Modem)",
  27.        "genero" => "Rock'n'Roll",
  28.        "link" =>
  29. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vc"
  30.  
  31.    },
  32.  
  33.    {
  34.  
  35.        "nombre" => "Absolute Radio (Broadband)",
  36.        "genero" => "Pop",
  37.        "link" =>
  38. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb"
  39.  
  40.    },
  41.  
  42.    {
  43.  
  44.        "nombre" => "Absolute Radio (Modem)",
  45.        "genero" => "Pop",
  46.        "link" =>
  47. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vr"
  48.  
  49.    },
  50.  
  51.    {
  52.  
  53.        "nombre" => "Absolute Xtreme (Broadband)",
  54.        "genero" => "Modern Rock",
  55.        "link" =>
  56. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vxbb"
  57.  
  58.    },
  59.  
  60.    {
  61.  
  62.        "nombre" => "Absolute Xtreme (Modem)",
  63.        "genero" => "Modern Rock",
  64.        "link" =>
  65. "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vx"
  66.  
  67.    },
  68.  
  69.    {
  70.  
  71.        "nombre" => "HBR1.com - Dream Factory",
  72.        "genero" => "Ambient",
  73.        "link"   => "http://ubuntu.hbr1.com:19800/ambient.ogg"
  74.  
  75.    },
  76.  
  77.    {
  78.  
  79.        "nombre" => "HBR1.com - I.D.M. Tranceponder",
  80.        "genero" => "Trance",
  81.        "link"   => "http://ubuntu.hbr1.com:19800/trance.ogg"
  82.  
  83.    },
  84.  
  85.    {
  86.  
  87.        "nombre" => "HBR1.com - Tronic Lounge",
  88.        "genero" => "House",
  89.        "link"   => "http://ubuntu.hbr1.com:19800/tronic.ogg"
  90.  
  91.    },
  92.  
  93.    {
  94.  
  95.        "nombre" => "NRK Alltid Klassisk (Norway)",
  96.        "genero" => "Desconocido",
  97.        "link" =>
  98.          "http://media.hiof.no/streams/m3u/nrk-alltid-klassisk-172.ogg.m3u"
  99.  
  100.    },
  101.  
  102.    {
  103.  
  104.        "nombre" => "NRK Alltid Nyheter (Norway)",
  105.        "genero" => "Desconocido",
  106.        "link" =>
  107.          "http://media.hiof.no/streams/m3u/nrk-alltid-nyheter-172.ogg.m3u"
  108.  
  109.    },
  110.  
  111.    {
  112.  
  113.        "nombre" => "NRK mP3 (Norway)",
  114.        "genero" => "Desconocido",
  115.        "link"   => "http://media.hiof.no/streams/m3u/nrk-mpetre-172.ogg.m3u"
  116.  
  117.    },
  118.  
  119.    {
  120.  
  121.        "nombre" => "NRK P1 (Norway)",
  122.        "genero" => "General",
  123.        "link"   => "http://media.hiof.no/streams/m3u/nrk-p1-172.ogg.m3u",
  124.  
  125.    },
  126.  
  127.    {
  128.  
  129.        "nombre" => "NRK P2 (Norway)",
  130.        "genero" => "General",
  131.        "link"   => "http://media.hiof.no/streams/m3u/nrk-p2-172.ogg.m3u"
  132.  
  133.    },
  134.  
  135.    {
  136.  
  137.        "nombre" => "NRK P3 (Norway)",
  138.        "genero" => "General",
  139.        "link"   => "http://media.hiof.no/streams/m3u/nrk-petre-172.ogg.m3u"
  140.  
  141.    },
  142.  
  143.    {
  144.  
  145.        "nombre" => "WKNC 88.1 FM (NC State) (High Quality)",
  146.        "genero" => "Music",
  147.        "link"   => "http://wknc.sma.ncsu.edu:8000/wknchq.ogg.m3u"
  148.  
  149.    },
  150.  
  151.    {
  152.  
  153.        "nombre" => "WKNC 88.1 FM (NC State) (Low Quality)",
  154.        "genero" => "Music",
  155.        "link"   => "http://wknc.sma.ncsu.edu:8000/wkncmq.ogg.m3u"
  156.  
  157.    }
  158.  
  159. );
  160.  
  161. $SIG{INT} = \&retorno;
  162.  
  163. chdir( getcwd() . "/mplayer/" );
  164.  
  165. menu();
  166.  
  167. sub retorno {
  168.    print "\n\n[+] Press any key for return to the menu\n\n";
  169.    <stdin>;
  170.    menu();
  171. }
  172.  
  173. sub menu {
  174.  
  175.    head();
  176.  
  177.    for my $em ( 1 .. @emisoras - 1 ) {
  178.  
  179.        print "\n[+] Number : " . $em . "\n";
  180.        print "[+] Name : " . $emisoras[$em]->{nombre} . "\n";
  181.        print "[+] Station : " . $emisoras[$em]->{genero} . "\n";
  182.  
  183.    }
  184.  
  185.    print "\n\n[+] Option : ";
  186.    chomp( my $op = <stdin> );
  187.  
  188.    if ( $op =~ /\d+/ ) {
  189.        system("mplayer $emisoras[$op]->{link}");
  190.    }
  191.  
  192.    copyright();
  193.  
  194. }
  195.  
  196. sub head {
  197.  
  198.    clean();
  199.  
  200.    print qq(
  201.  
  202.  
  203. @@@@@     @    @@@@    @   @@@@     @     @
  204. @    @    @    @   @   @  @    @    @     @
  205. @    @   @ @   @    @  @  @    @     @   @
  206. @    @   @ @   @    @  @  @    @      @ @  
  207. @@@@@   @   @  @    @  @  @    @       @  
  208. @    @  @   @  @    @  @  @    @      @ @  
  209. @    @  @@@@@  @    @  @  @    @     @   @
  210. @    @ @     @ @   @   @  @    @    @     @
  211. @    @ @     @ @@@@    @   @@@@     @     @
  212.  
  213.  
  214.  
  215. );
  216.  
  217. }
  218.  
  219. sub copyright {
  220.    print "\n\n-- == (C) Doddy Hackman 2012 == --\n\n";
  221.    <stdin>;
  222.    exit(1);
  223. }
  224.  
  225. sub clean {
  226.    my $os = $^O;
  227.    if ( $os =~ /Win32/ig ) {
  228.        system("cls");
  229.    }
  230.    else {
  231.        system("clear");
  232.    }
  233. }
  234.  
  235. #The End ?
  236.  

Ejemplo de uso

Código:



 @@@@@     @    @@@@    @   @@@@     @     @
 @    @    @    @   @   @  @    @    @     @
 @    @   @ @   @    @  @  @    @     @   @
 @    @   @ @   @    @  @  @    @      @ @
 @@@@@   @   @  @    @  @  @    @       @
 @    @  @   @  @    @  @  @    @      @ @
 @    @  @@@@@  @    @  @  @    @     @   @
 @    @ @     @ @   @   @  @    @    @     @
 @    @ @     @ @@@@    @   @@@@     @     @




[+] Number : 1
[+] Name : Absolute Classic Rock (Broadband)
[+] Station : Rock'n'Roll

[+] Number : 2
[+] Name : Absolute Classic Rock (Modem)
[+] Station : Rock'n'Roll

[+] Number : 3
[+] Name : Absolute Radio (Broadband)
[+] Station : Pop

[+] Number : 4
[+] Name : Absolute Radio (Modem)
[+] Station : Pop

[+] Number : 5
[+] Name : Absolute Xtreme (Broadband)
[+] Station : Modern Rock

[+] Number : 6
[+] Name : Absolute Xtreme (Modem)
[+] Station : Modern Rock

[+] Number : 7
[+] Name : HBR1.com - Dream Factory
[+] Station : Ambient

[+] Number : 8
[+] Name : HBR1.com - I.D.M. Tranceponder
[+] Station : Trance

[+] Number : 9
[+] Name : HBR1.com - Tronic Lounge
[+] Station : House

[+] Number : 10
[+] Name : NRK Alltid Klassisk (Norway)
[+] Station : Desconocido

[+] Number : 11
[+] Name : NRK Alltid Nyheter (Norway)
[+] Station : Desconocido

[+] Number : 12
[+] Name : NRK mP3 (Norway)
[+] Station : Desconocido

[+] Number : 13
[+] Name : NRK P1 (Norway)
[+] Station : General

[+] Number : 14
[+] Name : NRK P2 (Norway)
[+] Station : General

[+] Number : 15
[+] Name : NRK P3 (Norway)
[+] Station : General

[+] Number : 16
[+] Name : WKNC 88.1 FM (NC State) (High Quality)
[+] Station : Music

[+] Number : 17
[+] Name : WKNC 88.1 FM (NC State) (Low Quality)
[+] Station : Music


[+] Option : 7
MPlayer 1.0rc2-4.2.1 (C) 2000-2007 MPlayer Team
CPU: AMD Sempron(tm) 140 Processor (Family: 16, Model: 6, Stepping: 2)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing http://ubuntu.hbr1.com:19800/ambient.ogg.
Resolving ubuntu.hbr1.com for AF_INET...
Connecting to server ubuntu.hbr1.com[93.94.83.51]: 19800...
Cache size set to 320 KBytes
Cache fill: 15.00% (49152 bytes)
[Ogg] stream 0: audio (Vorbis), -aid 0
Ogg file format detected.
Clip info:
 Artist: A.C.E. (chillgressive tunes)
 Name: Acid Chill Experience (DJ-Set, exclusive 4 hbr1.com)
 Album: hbr1.com
 Genre: Ambient
 Track: 1
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
Ogg : bad packet in stream 0
AUDIO: 44100 Hz, 2 ch, s16le, 64.0 kbit/4.54% (ratio: 8000->176400)
Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis decoder)
==========================================================================
AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...


« Última modificación: 16 Octubre 2012, 16:50 pm por Doddy » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
RADIO!!
Multimedia
fufy 1 1,551 Último mensaje 27 Enero 2006, 23:34 pm
por Sourraund
Radio en VB
Programación Visual Basic
ranslsad 1 1,164 Último mensaje 19 Septiembre 2006, 21:57 pm
por Snort
la radio
Multimedia
Rakelita 1 1,544 Último mensaje 20 Octubre 2006, 01:30 am
por Songoku
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,837 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Perl] Radio X 0.4
Scripting
BigBear 0 1,526 Último mensaje 28 Marzo 2014, 16:29 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines