[Perl] Radio X 0.2

Iniciado por BigBear, Octubre 14, 2012, 09:57:25 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Octubre 14, 2012, 09:57:25 PM Ultima modificación: Octubre 16, 2012, 11:50:31 AM por Doddy
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: perl

    #!usr/bin/perl
    #Radio X
    #Version 0.2
    #Coded By Doddy H
    #
    #Download : http://www.mplayerhq.hu/MPlayer/releases/win32/MPlayer-mingw32-1.0rc2.zip
    #

    use Cwd;

    my @emisoras = (

        {},

        {

            "nombre" => "Absolute Classic Rock (Broadband)",
            "genero" => "Rock'n'Roll",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vcbb"

        },

        {

            "nombre" => "Absolute Classic Rock (Modem)",
            "genero" => "Rock'n'Roll",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vc"

        },

        {

            "nombre" => "Absolute Radio (Broadband)",
            "genero" => "Pop",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb"

        },

        {

            "nombre" => "Absolute Radio (Modem)",
            "genero" => "Pop",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vr"

        },

        {

            "nombre" => "Absolute Xtreme (Broadband)",
            "genero" => "Modern Rock",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vxbb"

        },

        {

            "nombre" => "Absolute Xtreme (Modem)",
            "genero" => "Modern Rock",
            "link" =>
    "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vx"

        },

        {

            "nombre" => "HBR1.com - Dream Factory",
            "genero" => "Ambient",
            "link"   => "http://ubuntu.hbr1.com:19800/ambient.ogg"

        },

        {

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

        },

        {

            "nombre" => "HBR1.com - Tronic Lounge",
            "genero" => "House",
            "link"   => "http://ubuntu.hbr1.com:19800/tronic.ogg"

        },

        {

            "nombre" => "NRK Alltid Klassisk (Norway)",
            "genero" => "Desconocido",
            "link" =>
              "http://media.hiof.no/streams/m3u/nrk-alltid-klassisk-172.ogg.m3u"

        },

        {

            "nombre" => "NRK Alltid Nyheter (Norway)",
            "genero" => "Desconocido",
            "link" =>
              "http://media.hiof.no/streams/m3u/nrk-alltid-nyheter-172.ogg.m3u"

        },

        {

            "nombre" => "NRK mP3 (Norway)",
            "genero" => "Desconocido",
            "link"   => "http://media.hiof.no/streams/m3u/nrk-mpetre-172.ogg.m3u"

        },

        {

            "nombre" => "NRK P1 (Norway)",
            "genero" => "General",
            "link"   => "http://media.hiof.no/streams/m3u/nrk-p1-172.ogg.m3u",

        },

        {

            "nombre" => "NRK P2 (Norway)",
            "genero" => "General",
            "link"   => "http://media.hiof.no/streams/m3u/nrk-p2-172.ogg.m3u"

        },

        {

            "nombre" => "NRK P3 (Norway)",
            "genero" => "General",
            "link"   => "http://media.hiof.no/streams/m3u/nrk-petre-172.ogg.m3u"

        },

        {

            "nombre" => "WKNC 88.1 FM (NC State) (High Quality)",
            "genero" => "Music",
            "link"   => "http://wknc.sma.ncsu.edu:8000/wknchq.ogg.m3u"

        },

        {

            "nombre" => "WKNC 88.1 FM (NC State) (Low Quality)",
            "genero" => "Music",
            "link"   => "http://wknc.sma.ncsu.edu:8000/wkncmq.ogg.m3u"

        }

    );

    $SIG{INT} = \&retorno;

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

    menu();

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

    sub menu {

        head();

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

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

        }

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

        if ( $op =~ /\d+/ ) {
            system("mplayer $emisoras[$op]->{link}");
        }

        copyright();

    }

    sub head {

        clean();

        print qq(


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



    );

    }

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

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

    #The End ?


    Ejemplo de uso

    Código: php




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




    [+] 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...