Underc0de

Programación Scripting => Perl => Mensaje iniciado por: BigBear en Marzo 28, 2014, 12:29:07 PM

Título: [Perl] Radio X 0.4
Publicado por: BigBear en Marzo 28, 2014, 12:29:07 PM
Actualice mi programa en perl llamado "Radio X" debido a que las emisoras no me gustaban , asi que actualice el hash con 31 estaciones , todas de diferentes generos , aunque la unica que siempre escucho siempre es la de musica clasica.

Aclaracion de dependencia :

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 :

Código (perl) [Seleccionar]

#!usr/bin/perl
#Radio X
#Version 0.4
#(C) Doddy Hackman 2014
#
#Download : http://www.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip
#

use Cwd;

my @emisoras = (

    {},

    {

        "nombre" => "idobi Radio",
        "genero" => "Alternative",
        "link"   => "http://69.46.88.21:80"

    },

    {

        "nombre" => "BLUES RADIO (1.FM TM)",
        "genero" => "Blues",
        "link"   => "http://205.164.35.58:80"

    },

    {

        "nombre" => "Venice Classic Radio Italia",
        "genero" => "Classical",
        "link"   => "http://174.36.206.197:8000"

    },

    {

        "nombre" => "100hitz - New Country",
        "genero" => "Country",
        "link"   => "http://69.4.234.186:9210"

    },

    {

        "nombre" => "RADIO 7 - POLNOCNE",
        "genero" => "Decades",
        "link"   => "http://94.23.36.107:443"

    },

    {

        "nombre" => "COOLfahrenheit 93",
        "genero" => "Easy Listening",
        "link"   => "http://203.150.225.77:8400"

    },

    {

        "nombre" => "Ibiza Global Radio",
        "genero" => "Electronic",
        "link"   => "http://198.50.197.161:8024"

    },

    {

        "nombre" => "HBR1.com - I.D.M. Tranceponder",
        "genero" => "Trance",
        "link"   => "http://ubuntu.hbr1.com:19800/trance.ogg"

    },

    {

        "nombre" => "COOL radio - Beograd",
        "genero" => "Folk",
        "link"   => "http://176.9.30.66:80"

    },

    {

        "nombre" => "COOL radio - Beograd",
        "genero" => "Folk",
        "link"   => "http://176.9.30.66:80"

    },

    {

        "nombre" => "HPR4",
        "genero" => "Inspirational",
        "link"   => "http://50.7.77.179:8024"

    },

    {

        "nombre" => "Radio Carsija - Melli",
        "genero" => "International",
        "link"   => "http://80.237.153.95:19406"

    },

    {

        "nombre" => "TheJazzGroove.com",
        "genero" => "Jazz",
        "link"   => "http://199.180.72.2:8015"

    },

    {

        "nombre" => "Paisa Estereo",
        "genero" => "Latin",
        "link"   => "http://199.217.118.10:7094"

    },

    {

        "nombre" => "RockRadio1.Com",
        "genero" => "Metal",
        "link"   => "http://77.74.192.50:8000"

    },

    {

        "nombre" => "Adom 106.3FM",
        "genero" => "Misc",
        "link"   => "http://67.159.60.45:8100"

    },

    {

        "nombre" => "Healing",
        "genero" => "New Age",
        "link"   => "http://222.122.178.183:11070"

    },

    {

        "nombre" => "RADIO SOUND POP",
        "genero" => "Pop",
        "link"   => "http://99.198.118.250:8076"

    },

    {

        "nombre" => "Latido 90.1 FM",
        "genero" => "Public Radio",
        "link"   => "http://64.251.21.48:42000"

    },

    {

        "nombre" => "Radio Mandela",
        "genero" => "Funk",
        "link"   => "http://184.154.150.93:9010"

    },

    {

        "nombre" => "Boneyaad Radio",
        "genero" => "Rap",
        "link"   => "http://69.175.103.226:8180"

    },

    {

        "nombre" => "Reggae141.com",
        "genero" => "Reggae",
        "link"   => "http://184.107.197.154:8002"

    },

    {

        "nombre" => "Classic Rock 915",
        "genero" => "Rock",
        "link"   => "http://117.53.175.113:15018"

    },

    {

        "nombre" => "181.fm - Rock 181 (Active Rock)",
        "genero" => "Rock",
        "link"   => "http://108.61.73.118:14008"

    },

    {

        "nombre" => "181.FM - The Buzz",
        "genero" => "Rock",
        "link"   => "http://108.61.73.119:14126"

    },

    {

        "nombre" => "181.FM - Good Time Oldies",
        "genero" => "Rock",
        "link"   => "http://108.61.73.118:14046"

    },

    {

        "nombre" => "Top40",
        "genero" => "Pop Dance R&B Rock",
        "link"   => "http://95.141.24.79:80"

    },

    {

        "nombre" => "MUSIK.ORIENTAL",
        "genero" => "Seasonal and Holiday",
        "link"   => "http://193.34.51.40:80"

    },

    {

        "nombre" => "NOVA 100.3",
        "genero" => "Soundtracks",
        "link"   => "http://117.53.175.113:15010"

    },

    {

        "nombre" => "Alex Jones - Infowars.com",
        "genero" => "Talk",
        "link"   => "http://50.7.130.109:80"

    },

    {

        "nombre" => "illusive Radio Punta",
        "genero" => "Themes",
        "link"   => "http://38.96.148.141:9996"

    }

);

$SIG{INT} = \&retorno;

chdir( getcwd() . "/mplayer/" );

menu();

sub retorno {
    print "\n\n[+] Press any key for return to the menu\n\n";
    <stdin>;
    clean();
    menu();
}

sub menu {

    head();

    print "\n\n[+] Listing ["
      . int( @emisoras - 1 ) . "] "
      . "stations found ...\n";

    for my $em ( 1 .. @emisoras - 1 ) {

        print "\n[+] ID : " . $em . "\n";
        print "[+] Name : " . $emisoras[$em]->{nombre} . "\n";
        print "[+] Type : " . $emisoras[$em]->{genero} . "\n";

        #print "[$em] - ".$emisoras[$em]->{genero}."\n";

    }

    print "\n[+] Write exit to go out\n";

    print "\n[+] Option : ";
    chomp( my $op = <stdin> );

    if ( $op eq "exit" ) {
        copyright();
    }

    if ( $op =~ /\d+/ ) {
        print "\n[!] Listening : " . $emisoras[$op]->{link} . " ...\n\n";
        system("mplayer $emisoras[$op]->{link}");
    }

    copyright();

}

sub head {

    clean();

    print qq(


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

);

}

sub copyright {
    print "\n\n-- == (C) Doddy Hackman 2014 == --\n\n";
    <stdin>;
    exit(1);
}

sub clean {
    my $os = $^O;
    if ( $os =~ /Win32/ig ) {
        system("cls");
    }
    else {
        system("clear");
    }
}

#The End ?



Un ejemplo de uso





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



[+] Listing [31] stations found ...

[+] ID : 1
[+] Name : idobi Radio
[+] Type : Alternative

[+] ID : 2
[+] Name : BLUES RADIO (1.FM TM)
[+] Type : Blues

[+] ID : 3
[+] Name : Venice Classic Radio Italia
[+] Type : Classical

[+] ID : 4
[+] Name : 100hitz - New Country
[+] Type : Country

[+] ID : 5
[+] Name : RADIO 7 - POLNOCNE
[+] Type : Decades

[+] ID : 6
[+] Name : COOLfahrenheit 93
[+] Type : Easy Listening

[+] ID : 7
[+] Name : Ibiza Global Radio
[+] Type : Electronic

[+] ID : 8
[+] Name : HBR1.com - I.D.M. Tranceponder
[+] Type : Trance

[+] ID : 9
[+] Name : COOL radio - Beograd
[+] Type : Folk

[+] ID : 10
[+] Name : COOL radio - Beograd
[+] Type : Folk

[+] ID : 11
[+] Name : HPR4
[+] Type : Inspirational

[+] ID : 12
[+] Name : Radio Carsija - Melli
[+] Type : International

[+] ID : 13
[+] Name : TheJazzGroove.com
[+] Type : Jazz

[+] ID : 14
[+] Name : Paisa Estereo
[+] Type : Latin

[+] ID : 15
[+] Name : RockRadio1.Com
[+] Type : Metal

[+] ID : 16
[+] Name : Adom 106.3FM
[+] Type : Misc

[+] ID : 17
[+] Name : Healing
[+] Type : New Age

[+] ID : 18
[+] Name : RADIO SOUND POP
[+] Type : Pop

[+] ID : 19
[+] Name : Latido 90.1 FM
[+] Type : Public Radio

[+] ID : 20
[+] Name : Radio Mandela
[+] Type : Funk

[+] ID : 21
[+] Name : Boneyaad Radio
[+] Type : Rap

[+] ID : 22
[+] Name : Reggae141.com
[+] Type : Reggae

[+] ID : 23
[+] Name : Classic Rock 915
[+] Type : Rock

[+] ID : 24
[+] Name : 181.fm - Rock 181 (Active Rock)
[+] Type : Rock

[+] ID : 25
[+] Name : 181.FM - The Buzz
[+] Type : Rock

[+] ID : 26
[+] Name : 181.FM - Good Time Oldies
[+] Type : Rock

[+] ID : 27
[+] Name : Top40
[+] Type : Pop Dance R&B Rock

[+] ID : 28
[+] Name : MUSIK.ORIENTAL
[+] Type : Seasonal and Holiday

[+] ID : 29
[+] Name : NOVA 100.3
[+] Type : Soundtracks

[+] ID : 30
[+] Name : Alex Jones - Infowars.com
[+] Type : Talk

[+] ID : 31
[+] Name : illusive Radio Punta
[+] Type : Themes

[+] Write exit to go out

[+] Option : 3

[!] Listening : http://174.36.206.197:8000 ...

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://174.36.206.197:8000.
Connecting to server 174.36.206.197[174.36.206.197]: 8000...
Name   : Venice Classic Radio Italia
Genre  : Classical
Website: http://www.veniceclassicradio.eu/
Public : yes
Bitrate: 128kbit/s
Cache size set to 320 KBytes
Cache fill:  0.00% (0 bytes)   No bind found for key ''.

Cache fill:  7.50% (24576 bytes)
ICY Info: StreamTitle='Frederic Chopin (1810-1849) - 'Allegro de concert' per pi
anoforte in la Maggiore Op.46 (11:37)  {+info: veniceclassicradio.eu}';StreamUrl
='';
Cache fill: 17.50% (57344 bytes)
Audio file file format detected.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
mpg123: Can't rewind stream by 154 bits!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [dsound] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...

ICY Info: StreamTitle='Mauro Giuliani (1781-1829) - Variazioni su 'Deh! Calma, o
h ciel!' per chitarra e quartetto (08:00)  {+info: veniceclassicradio.eu}';Strea
mUrl='';

ICY Info: StreamTitle='Johann Sebastian Bach (1685-1750) - 'Il clavicembalo ben
temperato' - Libro I - Praeludium et Fuga in si bemolle Maggiore BWV866 (02:42)
{+info: veniceclassicradio.eu}';StreamUrl='';

ICY Info: StreamTitle='Antonio Palella (1692-1761) - Concerto a 4  in sol Maggio
re (12:42)  {+info: veniceclassicradio.eu}';StreamUrl='';

ICY Info: StreamTitle='Anton Reicha (1770-1836) - Sonata per fagotto e pianofort
e (16:19)  {+info: veniceclassicradio.eu}';StreamUrl='';

ICY Info: StreamTitle='Gioachino Rossini (1792-1868) - Sonata per archi in mi be
molle Maggiore No.5 (14:51)  {+info: veniceclassicradio.eu}';StreamUrl='';

ICY Info: StreamTitle='Fernand De La Tombelle (1854-1928) - Andante espressivo p
er violoncello e pianoforte (04:39)  {+info: veniceclassicradio.eu}';StreamUrl='
';

ICY Info: StreamTitle='Franz Schubert (1797-1828) - Sinfonia in re Maggiore No.3
D200 (23:09)  {+info: veniceclassicradio.eu}';StreamUrl='';



Eso es todo.