File indexing completed on 2025-01-19 04:25:19

0001 /*#########################################################################
0002 #                                                                         #
0003 #   Simple script for testing the scriptable service browser              #
0004 #   by creating a simple static browser with some cool radio              #
0005 #   streams. URLs shamelessly stolen from Cool-Streams.xml.               #
0006 #                                                                         #
0007 #   Copyright                                                             #
0008 #   (C) 2007, 2008 Nikolaj Hald Nielsen  <nhnFreespirit@gmail.com>        #
0009 #   (C)       2008 Peter ZHOU <peterzhoulei@gmail.com>                    #
0010 #   (C)       2008 Mark Kretschmann <kretschmann@kde.org>                 #
0011 #                                                                         #
0012 #   This program is free software; you can redistribute it and/or modify  #
0013 #   it under the terms of the GNU General Public License as published by  #
0014 #   the Free Software Foundation; either version 2 of the License, or     #
0015 #   (at your option) any later version.                                   #
0016 #                                                                         #
0017 #   This program is distributed in the hope that it will be useful,       #
0018 #   but WITHOUT ANY WARRANTY; without even the implied warranty of        #
0019 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
0020 #   GNU General Public License for more details.                          #
0021 #                                                                         #
0022 #   You should have received a copy of the GNU General Public License     #
0023 #   along with this program; if not, write to the                         #
0024 #   Free Software Foundation, Inc.,                                       #
0025 #   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         #
0026 ##########################################################################*/
0027 
0028 function Station( name, url )
0029 {
0030     this.name = name;
0031     this.url = url;
0032 }
0033 
0034 var stationArray = new Array (
0035     new Station( "Afterhours.FM [Trance/Livesets]",                     "http://www.ah.fm/192k.m3u" ),
0036     new Station( "Bassdrive [Drum \'n Bass]",                           "http://www.bassdrive.com/v2/streams/BassDrive.pls" ),
0037     new Station( "Digitally Imported - Chillout [Chill-Out]",           "http://listen.di.fm/public3/chillout.pls" ),
0038     new Station( "Digitally Imported - Classic Techno [Techno]",        "http://listen.di.fm/public3/classictechno.pls" ),
0039     new Station( "Digitally Imported - Trance [Trance]",                "http://listen.di.fm/public3/trance.pls" ),
0040     new Station( "Kohina [Computer-Music]",                             "http://www.kohina.com/kohinasolanum.m3u" ),
0041     new Station( "Proton Radio [House/Dance]",                          "https://www.protonradio.com/proton.m3u" ),
0042     new Station( "Radio Paradise [Rock/Pop/Alternative]",               "http://www.radioparadise.com/musiclinks/rp_128.m3u" ),
0043     new Station( "SLAY Radio [C64 Remixes]",                            "http://www.slayradio.org/tune_in.php/128kbps/listen.m3u" ),
0044     new Station( "SomaFM - Drone Zone [Ambient]",                       "http://somafm.com/dronezone.pls" ),
0045     new Station( "SomaFM - Groove Salad [Chill-Out]",                   "http://somafm.com/groovesalad.pls" ),
0046     new Station( "SomaFM - Indie Pop Rocks [Indie]",                    "http://somafm.com/indiepop.pls" ),
0047     new Station( "SomaFM - Secret Agent [Downtempo/Lounge]",            "http://somafm.com/secretagent.pls" ),
0048     new Station( "SomaFM - Tags Trance Trip [Trance]",                  "http://somafm.com/tagstrance.pls" ),
0049     new Station( "Absolute Radio [Rock/Pop]",                           "http://network.absoluteradio.co.uk/core/audio/ogg/live.pls?service=vrbb" )
0050 );
0051 
0052 function CoolStream()
0053 {
0054     ScriptableServiceScript.call( this, "Cool Streams", 1, "List of some high quality radio streams", "Some really cool radio streams, hand picked for your listening pleasure by your friendly Amarok developers", false );
0055 }
0056 
0057 function onPopulating( level, callbackData, filter )
0058 {
0059     Amarok.debug( " Populating station level..." );
0060     //add the station streams as leaf nodes
0061     for ( i = 0; i < stationArray.length; i++ )
0062     {
0063         item = Amarok.StreamItem;
0064         item.level = 0;
0065         item.callbackData = "";
0066         item.itemName = stationArray[i].name;
0067         item.playableUrl = stationArray[i].url;
0068         item.infoHtml = "A cool stream called " + item.itemName;
0069         script.insertItem( item );
0070     }
0071     script.donePopulating();
0072 }
0073 
0074 script = new CoolStream();
0075 script.populate.connect( onPopulating );