Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Check-in [a140e97c02]

Overview
Comment:Migrate to JSON api
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a140e97c0208e300d0e052a423e9d2ba0d9f918a
User & Date: mario on 2022-02-17 06:17:14
Other Links: manifest | tags
Context
2022-02-20
05:57
filtermusic: update for current station list HTML, add favicons + homepages check-in: ce7292f416 user: mario tags: trunk
2022-02-17
06:17
Migrate to JSON api check-in: a140e97c02 user: mario tags: trunk
2022-02-16
21:08
remove docblock, reinstate max_streams for loop. check-in: e9dc9616e1 user: mario tags: trunk
Changes

Modified contrib/radiolist.py from [a64e8fb450] to [c48d3418c2].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93


94



95




96
97
98

# encoding: UTF-8
# api: streamtuner2
# title: radiolist.net
# description: Station list by categories
# url: http://radiolist.net/
# version: 0.6
# type: channel
# category: radio
# priority: obsolete
# png:
#   iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAFVBMVEVKb61qibyDnMegs9S6yeDV4O37/vyx66abAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMB
#   AJqcGAAAAAd0SU1FB+ECDBAgLJqgZW4AAADoSURBVBjTNdBNj4MgEAbgqdLeZdo9C5NwFmo5Y7Wedauc1y/+/09YdLskkDwJmZl3IOxnON4A8frQhdc/7mG2cv3gx29X
#   rdUfZuVHQ3JHEzZ7GSuNXxFV/FYYwryO6MOiZqEdnQPUC/fsXZaMuxa6MFfOVYN7kIWpHZClyJGLFjbbC617KaRUEJ4r4fU7IqNYrW5f2kgU5gZInG6MZ086eejcyIvO
#   1KwoLayoJjqnuWO5giW8msxVmBQXD5PttSlRm8TG2fDNZS3rRO/opeSCMnPa82xSmNgkfRxJ5yZxlPrPDmLu+7GqX4lERq4G0UEyAAAAAElFTkSuQmCC
# extraction-method: regex
#
# ⚠ Requires a [Channel → Reload category tree] after updating.
#
# Radio station list, now categorized.
# Search would be possible now, but isn't implemented.


import re
import action
import ahttp
from config import *
from channels import *


# radiolist.net
#
# · Only fetches titles/urls.
#
class radiolist (ChannelPlugin):

    # module attributes
    listformat = "pls"
    has_search = False
    categories = []
    catmap = []
    titles = dict( genre="Genre", title="Station", playing="Location", bitrate="Bitrate", listeners=False )

    # countries would still be available, but there seems to be no /country/ url map
    """<option value="4"  >Albania</option><option value="7"  >Andorra</option><option value="11"  >Argentina</option><option value="12"  >Armenia</option><option value="14"  >Australia</option><option value="15"  >Austria</option><option value="16"  >Azerbaijan</option><option value="21"  >Belarus</option><option value="22"  >Belgium</option><option value="28"  >Bosnia and Herzegovina</option><option value="30"  >Brazil</option><option value="32"  >Bulgaria</option><option value="38"  >Canada</option><option value="43"  >Chile</option><option value="45"  >Colombia</option><option value="52"  >Croatia</option><option value="54"  >Cyprus</option><option value="55"  >Czech Republic</option><option value="58"  >Denmark</option><option value="67"  >Estonia</option><option value="70"  >Faroe Islands</option><option value="72"  >Finland</option><option value="73"  >France</option><option value="79"  >Germany</option><option value="82"  >Greece</option><option value="96"  >Hungary</option><option value="97"  >Iceland</option><option value="98"  >India</option><option value="102"  >Ireland</option><option value="104"  >Israel</option><option value="105"  >Italy</option><option value="107"  >Japan</option><option value="118"  >Latvia</option><option value="123"  >Liechtenstein</option><option value="124"  >Lithuania</option><option value="125"  >Luxembourg</option><option value="126"  >Macedonia</option><option value="132"  >Malta</option><option value="138"  >Mexico</option><option value="140"  >Moldova</option><option value="141"  >Monaco</option><option value="143"  >Montenegro</option><option value="153"  >Netherlands</option><option value="155"  >New Zealand</option><option value="160"  >Norway</option><option value="170"  >Poland</option><option value="171"  >Portugal</option><option value="175"  >Romania</option><option value="176"  >Russian Federation</option><option value="183"  >San Marino</option><option value="187"  >Serbia</option><option value="192"  >Slovakia</option><option value="193"  >Slovenia</option><option value="197"  >Spain</option><option value="202"  >Sweden</option><option value="203"  >Switzerland</option><option value="215"  >Turkey</option><option value="220"  >Ukraine</option><option value="222"  >United Kingdom</option><option value="223"  >United States</option><option value="227"  >Venezuela</option>"""
    """<option value="671"  >00</option><option value="288"  >00s</option><option value="377"  >10s</option><option value="621"  >20s</option><option value="433"  >30s</option><option value="431"  >40s</option><option value="970"  >47/5000 balada</option><option value="976"  >50</option><option value="363"  >50s</option><option value="252"  >60s</option><option value="678"  >60s 70s 80s</option><option value="665"  >60s 70s 80s 90s 00s</option><option value="257"  >70s</option><option value="714"  >80 s</option><option value="245"  >80s</option><option value="715"  >90 s</option><option value="244"  >90s</option><option value="727"  >90s classic</option><option value="550"  >90s.pop</option><option value="721"  >90s105.9</option><option value="772"  >acid house</option><option value="287"  >acid jazz</option><option value="420"  >acoustic</option><option value="335"  >active rock</option><option value="794"  >adult comtemporary</option><option value="657"  >adult contempopary</option><option value="695"  >adult contemporar</option><option value="272"  >adult contemporary</option><option value="861"  >adult contemprory</option><option value="249"  >african</option><option value="769"  >afropop</option><option value="840"  >air traffic</option><option value="545"  >albanian</option><option value="878"  >aldan cruz</option><option value="251"  >alternative</option><option value="318"  >alternative metal</option><option value="328"  >alternative rock</option><option value="435"  >alternatve</option><option value="871"  >amateur radio</option><option value="283"  >ambient</option><option value="381"  >american</option><option value="369"  >anime</option><option value="340"  >aor</option><option value="248"  >arabic</option><option value="569"  >arabic-pop</option><option value="586"  >armenian</option><option value="458"  >asian</option><option value="371"  >astrology</option><option value="255"  >azerbaijani</option><option value="268"  >b</option><option value="870"  >b.hip-hop</option><option value="514"  >b.oldies</option><option value="917"  >bach</option><option value="510"  >bachata</option><option value="398"  >balada</option><option value="596"  >balcan</option><option value="816"  >banda</option><option value="898"  >banda.bachata</option><option value="783"  >bangladeshi</option><option value="427"  >baroque</option><option value="685"  >base</option><option value="853"  >baseball</option><option value="302"  >bass</option><option value="523"  >beatles</option><option value="831"  >beethoven</option><option value="925"  >bengali</option><option value="528"  >beyonce</option><option value="451"  >bhangra</option><option value="338"  >black metal</option><option value="430"  >bluegrass</option><option value="246"  >blues</option><option value="507"  >bob marley</option><option value="566"  >bolero</option><option value="730"  >bolivian</option><option value="460"  >bollywood</option><option value="975"  >boogie</option><option value="708"  >bosnian</option><option value="347"  >bossa nova</option><option value="487"  >brazilian</option><option value="491"  >brazilian pop</option><option value="308"  >breakbeat</option><option value="324"  >britpop</option><option value="782"  >buddhist</option><option value="291"  >business</option><option value="937"  >c</option><option value="922"  >c-pop</option><option value="558"  >cabaret</option><option value="906"  >cajun</option><option value="885"  >calypso</option><option value="862"  >cantonese</option><option value="452"  >caribbean</option><option value="720"  >caribean</option><option value="582"  >caribian</option><option value="723"  >catalan</option><option value="534"  >catolic</option><option value="526"  >católica</option><option value="802"  >caucasian</option><option value="442"  >celtic</option><option value="271"  >chanson</option><option value="568"  >charanga</option><option value="546"  >charts</option><option value="351"  >chil out</option><option value="297"  >children</option><option value="404"  >chill-house</option><option value="270"  >chill-out</option><option value="445"  >chinese</option><option value="740"  >choir</option><option value="698"  >chr</option><option value="295"  >christian</option><option value="462"  >christian contemporary</option><option value="459"  >christian pop</option><option value="471"  >christian rock</option><option value="911"  >christian talk</option><option value="969"  >christiana</option><option value="881"  >christianl</option><option value="434"  >christmas</option><option value="454"  >chutney</option><option value="502"  >clasical rock</option><option value="247"  >classic</option><option value="577"  >classic jazz</option><option value="441"  >classic metal</option><option value="312"  >classic rock</option><option value="799"  >classico</option><option value="455"  >classik rock</option><option value="380"  >classsic</option><option value="649"  >classsic rock</option><option value="265"  >club</option><option value="355"  >club house</option><option value="943"  >colombian</option><option value="953"  >combia</option><option value="277"  >comedy</option><option value="439"  >community</option><option value="835"  >contemporary jazz</option><option value="655"  >cool jazz</option><option value="739"  >corelli</option><option value="916"  >countru</option><option value="309"  >country</option><option value="965"  >criollas</option><option value="675"  >croatian</option><option value="952"  >croosover</option><option value="950"  >crosover</option><option value="903"  >crossover</option><option value="949"  >crossover. gospel</option><option value="951"  >crossover.community</option><option value="797"  >cuambia</option><option value="808"  >cubaton</option><option value="296"  >culture</option><option value="509"  >cumbia</option><option value="498"  >dacnce</option><option value="242"  >dance</option><option value="733"  >dance hall</option><option value="887"  >dance l</option><option value="378"  >dance pop</option><option value="337"  >dance rock</option><option value="372"  >dance.trance</option><option value="801"  >dancec</option><option value="479"  >dancehall</option><option value="770"  >dancehip-hop</option><option value="521"  >dances</option><option value="397"  >danse</option><option value="735"  >danсe</option><option value="804"  >dark metal</option><option value="417"  >david bowie</option><option value="814"  >dean martin</option><option value="327"  >death metal</option><option value="315"  >deathcore</option><option value="610"  >decades</option><option value="292"  >deep electronic</option><option value="264"  >deep house</option><option value="548"  >deep techno</option><option value="553"  >depeche mode</option><option value="964"  >deportes</option><option value="672"  >depp</option><option value="849"  >desi</option><option value="624"  >deutsch</option><option value="928"  >devotional</option><option value="755"  >disc</option><option value="258"  >disco</option><option value="692"  >disco polo</option><option value="940"  >disco. oldies</option><option value="615"  >discofox</option><option value="541"  >disсo</option><option value="307"  >dj</option><option value="332"  >doom</option><option value="832"  >doowop</option><option value="276"  >downtempo</option><option value="706"  >drama</option><option value="647"  >drum´n bass</option><option value="301"  >drum&amp;#39</option><option value="684"  >drum&amp;amp</option><option value="753"  >dsnce</option><option value="294"  >dub techno</option><option value="298"  >dubstep</option><option value="682"  >dutch</option><option value="274"  >easy listening</option><option value="629"  >ebm</option><option value="367"  >eclectic</option><option value="592"  >eclectique</option><option value="415"  >economic</option><option value="873"  >ecuadorian</option><option value="494"  >edm</option><option value="349"  >education</option><option value="643"  >ekectro</option><option value="779"  >elcectic</option><option value="641"  >elecreo</option><option value="652"  >elecrto</option><option value="547"  >electric</option><option value="359"  >electro house</option><option value="339"  >electro rock</option><option value="711"  >electro trance</option><option value="595"  >electro-pop</option><option value="250"  >electronic</option><option value="511"  >eletro</option><option value="499"  >eletronic</option><option value="646"  >elrctro</option><option value="680"  >elvis presley</option><option value="687"  >emergency</option><option value="658"  >english</option><option value="360"  >enterntainment</option><option value="341"  >entertainment</option><option value="634"  >entertainmenthits</option><option value="539"  >entertaintment</option><option value="503"  >entretainment</option><option value="742"  >entrtainment</option><option value="368"  >ethnic</option><option value="465"  >eurodance</option><option value="674"  >evergreen</option><option value="869"  >fank</option><option value="855"  >filipino</option><option value="638"  >fisco</option><option value="529"  >flamenco</option><option value="497"  >flash back</option><option value="841"  >fock</option><option value="241"  >folk</option><option value="744"  >folk pop rock</option><option value="389"  >folk rock</option><option value="631"  >folk. deutsch</option><option value="967"  >folkl</option><option value="411"  >football</option><option value="493"  >forró</option><option value="771"  >foul</option><option value="617"  >fox</option><option value="482"  >frace</option><option value="813"  >frank sinatra</option><option value="677"  >freestyle</option><option value="424"  >french</option><option value="300"  >funk</option><option value="336"  >funk rock</option><option value="525"  >funk. sertanea</option><option value="793"  >fusion</option><option value="966"  >gaitas</option><option value="374"  >games music</option><option value="304"  >garage</option><option value="560"  >garage rock</option><option value="780"  >garage.r&amp;#39</option><option value="518"  >gauchesca</option><option value="622"  >german</option><option value="746"  >gits</option><option value="700"  >glam</option><option value="609"  >goa</option><option value="948"  >golpel</option><option value="894"  >golspel</option><option value="348"  >gospel</option><option value="905"  >gospel jazz</option><option value="329"  >gothic</option><option value="345"  >grange</option><option value="738"  >grecian</option><option value="659"  >greece</option><option value="467"  >greek</option><option value="784"  >greekg</option><option value="775"  >grime</option><option value="575"  >groove</option><option value="323"  >grunge</option><option value="806"  >grupera</option><option value="927"  >gujarati</option><option value="915"  >gurbani</option><option value="826"  >haitian</option><option value="850"  >halloween</option><option value="892"  >hamradio</option><option value="623"  >hands up</option><option value="625"  >handsup</option><option value="437"  >hard</option><option value="563"  >hard core</option><option value="313"  >hard rock</option><option value="868"  >hard roock</option><option value="628"  >hard style</option><option value="924"  >hard-rave</option><option value="426"  >hardcore</option><option value="747"  >hardr rock</option><option value="824"  >hardstep</option><option value="594"  >hardstyle</option><option value="904"  >hatian</option><option value="751"  >hause</option><option value="477"  >hawaiian</option><option value="396"  >health</option><option value="616"  >heavy</option><option value="311"  >heavy metal</option><option value="608"  >heavy rock</option><option value="447"  >hindu</option><option value="847"  >hinduism</option><option value="899"  >hip hp</option><option value="701"  >hip-hip</option><option value="254"  >hip-hop</option><option value="766"  >hip-hop r&amp;#39</option><option value="585"  >hit</option><option value="278"  >hits</option><option value="584"  >hits 60s</option><option value="591"  >hitsб 80s</option><option value="909"  >hot adult contemporary</option><option value="286"  >house</option><option value="908"  >http://visiondeselus.com</option><option value="446"  >iindie</option><option value="938"  >indi</option><option value="707"  >india</option><option value="421"  >indian</option><option value="321"  >indie</option><option value="331"  >indie rock</option><option value="788"  >indie-folk</option><option value="787"  >indie-pop</option><option value="406"  >indigo</option><option value="500"  >industrial</option><option value="688"  >info trafic</option><option value="432"  >information</option><option value="607"  >informations</option><option value="910"  >inspirational</option><option value="741"  >instreumental</option><option value="306"  >instrumental</option><option value="557"  >instrumental.pop</option><option value="366"  >international</option><option value="486"  >international / jazz / punk</option><option value="842"  >interview podcasts</option><option value="810"  >iranian</option><option value="613"  >irish</option><option value="353"  >islamic</option><option value="416"  >islamik</option><option value="601"  >israeli</option><option value="663"  >italan</option><option value="564"  >italian</option><option value="670"  >itallian</option><option value="466"  >italodance</option><option value="918"  >j-metal</option><option value="391"  >j-pop</option><option value="920"  >japan</option><option value="390"  >japanese</option><option value="956"  >japanesse</option><option value="243"  >jazz</option><option value="764"  >jazz funk</option><option value="709"  >jazz piano</option><option value="805"  >jazz-rock</option><option value="939"  >jesus</option><option value="485"  >jewish</option><option value="578"  >johnny hallyday</option><option value="605"  >jpop</option><option value="606"  >jrock</option><option value="383"  >judaism</option><option value="551"  >jungle</option><option value="379"  >k-pop</option><option value="929"  >kannada</option><option value="926"  >kashmiri</option><option value="854"  >kirtan</option><option value="827"  >kizomba</option><option value="933"  >kollywood</option><option value="864"  >kompa</option><option value="889"  >konpa</option><option value="422"  >korean</option><option value="834"  >kumbia</option><option value="627"  >kurdish</option><option value="778"  >l</option><option value="654"  >laika</option><option value="974"  >lain</option><option value="791"  >language</option><option value="376"  >latin</option><option value="971"  >latin folk</option><option value="567"  >latin jazz</option><option value="913"  >latin pop</option><option value="732"  >latinvariety</option><option value="761"  >laurence olivier</option><option value="691"  >led zeppelin</option><option value="587"  >lgbt</option><option value="425"  >lifestyle</option><option value="645"  >limp bizkit</option><option value="669"  >live</option><option value="803"  >live shows</option><option value="962"  >llanera</option><option value="554"  >lnew age</option><option value="821"  >local</option><option value="819"  >local news</option><option value="387"  >longe</option><option value="273"  >lounge</option><option value="728"  >love</option><option value="537"  >love song</option><option value="364"  >love songs</option><option value="765"  >love sungs</option><option value="666"  >malayalam</option><option value="866"  >malayalam music</option><option value="697"  >manele</option><option value="829"  >mantra</option><option value="790"  >maori</option><option value="930"  >mappila</option><option value="865"  >marathi</option><option value="818"  >marengue</option><option value="833"  >mariachi</option><option value="901"  >marimba</option><option value="316"  >mathcore</option><option value="620"  >medieval</option><option value="305"  >meditation</option><option value="639"  >melodic rock</option><option value="959"  >merenga</option><option value="845"  >merenge</option><option value="589"  >merengue</option><option value="314"  >metal</option><option value="633"  >metal core</option><option value="580"  >metal rock</option><option value="319"  >metalcore</option><option value="712"  >mexican</option><option value="495"  >michael jackson</option><option value="473"  >military</option><option value="718"  >milonga</option><option value="293"  >minimal</option><option value="696"  >mix</option><option value="436"  >modern rock</option><option value="583"  >motown</option><option value="880"  >movie</option><option value="863"  >movie news</option><option value="828"  >mozart</option><option value="483"  >multilingual</option><option value="428"  >music</option><option value="785"  >muslim</option><option value="748"  >n&amp;#34</option><option value="267"  >n&amp;#39</option><option value="867"  >national news</option><option value="505"  >nature</option><option value="637"  >nb</option><option value="932"  >ndian</option><option value="468"  >neapolitan music</option><option value="679"  >nederlands</option><option value="410"  >neo soul</option><option value="538"  >nes</option><option value="648"  >netherlands</option><option value="480"  >new</option><option value="358"  >new age</option><option value="852"  >new school</option><option value="320"  >new wave</option><option value="668"  >newage</option><option value="238"  >news</option><option value="544"  >news. sport</option><option value="896"  >news.talk</option><option value="858"  >nits</option><option value="809"  >nostalgie</option><option value="963"  >noticias</option><option value="350"  >nu disco</option><option value="317"  >nu metal</option><option value="403"  >nu-jazz</option><option value="667"  >nu-soul</option><option value="579"  >nudisco</option><option value="792"  >nz music</option><option value="756"  >o dance</option><option value="635"  >ock</option><option value="902"  >odies</option><option value="773"  >odlies</option><option value="470"  >old</option><option value="619"  >old school</option><option value="650"  >oldie</option><option value="262"  >oldies</option><option value="703"  >oldies rock</option><option value="662"  >oldies. hits</option><option value="934"  >oldies.pop</option><option value="686"  >oldies.top40</option><option value="743"  >oldis</option><option value="763"  >oldschool</option><option value="776"  >oldskool</option><option value="823"  >oos</option><option value="382"  >opera</option><option value="811"  >organ</option><option value="960"  >pachanga</option><option value="490"  >pagode</option><option value="476"  >paranormal</option><option value="851"  >paranormal talk</option><option value="632"  >party</option><option value="734"  >persian</option><option value="501"  >pink floyd</option><option value="676"  >piraten</option><option value="478"  >poetry</option><option value="893"  >poker</option><option value="822"  >police</option><option value="690"  >polish</option><option value="795"  >politic</option><option value="574"  >political talk</option><option value="357"  >politics</option><option value="555"  >polka</option><option value="236"  >pop</option><option value="573"  >pop 80s</option><option value="722"  >pop dance</option><option value="726"  >pop indie</option><option value="936"  >pop ingles</option><option value="530"  >pop teen</option><option value="269"  >pop-rock</option><option value="689"  >pop. 90s</option><option value="630"  >pop. news</option><option value="972"  >pop. rock. folk</option><option value="593"  >pop.60s</option><option value="400"  >pop.talk</option><option value="561"  >pop.talk.news</option><option value="543"  >pop.top40</option><option value="571"  >pop70s</option><option value="527"  >popo</option><option value="540"  >popular</option><option value="457"  >portuguese</option><option value="419"  >post-rock</option><option value="886"  >postrock</option><option value="334"  >power metal</option><option value="472"  >power rock</option><option value="542"  >ppop</option><option value="409"  >prayer</option><option value="699"  >preaching</option><option value="259"  >progressive</option><option value="290"  >progressive house</option><option value="333"  >progressive metal</option><option value="330"  >progressive rock</option><option value="281"  >progressive trance</option><option value="279"  >psy trance</option><option value="749"  >psychedelic</option><option value="611"  >psychill</option><option value="752"  >psychobilly</option><option value="653"  >psytrance</option><option value="443"  >public</option><option value="817"  >public safety</option><option value="786"  >pundjabi</option><option value="464"  >punjabi</option><option value="326"  >punk</option><option value="798"  >punk electronic</option><option value="407"  >punk-rock</option><option value="636"  >punkrock</option><option value="516"  >queen</option><option value="656"  >r &amp;#39</option><option value="429"  >r`n`b</option><option value="266"  >r&amp;#39</option><option value="789"  >racing</option><option value="588"  >ragga</option><option value="777"  >raggae</option><option value="872"  >rail</option><option value="844"  >railroad</option><option value="731"  >ranchera</option><option value="299"  >rap</option><option value="923"  >rave</option><option value="626"  >rawstyle</option><option value="310"  >reading</option><option value="895"  >reageton</option><option value="888"  >reagge</option><option value="438"  >regae</option><option value="947"  >regaeton</option><option value="935"  >regeaton</option><option value="384"  >reggae</option><option value="508"  >reggaeton</option><option value="725"  >reggaeton.bachata</option><option value="524"  >reggateon</option><option value="724"  >reggaton</option><option value="604"  >reggeae</option><option value="736"  >reggeaton</option><option value="944"  >reggeton</option><option value="710"  >regueaton</option><option value="745"  >regueton</option><option value="954"  >reguetoon</option><option value="275"  >relax</option><option value="506"  >religion</option><option value="393"  >religious</option><option value="361"  >religous</option><option value="618"  >remix</option><option value="846"  >rescue</option><option value="914"  >resque</option><option value="261"  >retro</option><option value="599"  >rn&amp;#39</option><option value="897"  >road</option><option value="549"  >roc</option><option value="253"  >rock</option><option value="857"  >rock &amp;amp</option><option value="800"  >rock news</option><option value="702"  >rock pop</option><option value="512"  >rock`n roll</option><option value="891"  >rock. rock&amp;#39</option><option value="683"  >rock.oldies</option><option value="664"  >rock.talk</option><option value="642"  >rock‘n‘roll</option><option value="385"  >rock&amp;#39</option><option value="325"  >rockabilly</option><option value="651"  >rocknews</option><option value="877"  >rockбr&amp;#39</option><option value="532"  >rok</option><option value="737"  >rok&amp;#39</option><option value="386"  >roll</option><option value="346"  >romance</option><option value="704"  >romanian</option><option value="343"  >romantic</option><option value="830"  >romatic</option><option value="946"  >romаntica</option><option value="562"  >roots</option><option value="912"  >rpm</option><option value="418"  >rturkish</option><option value="961"  >ruben blades</option><option value="565"  >rumba</option><option value="263"  >russian</option><option value="942"  >salasa</option><option value="520"  >salsa</option><option value="489"  >samba</option><option value="815"  >sammy davis</option><option value="492"  >sartanejo</option><option value="533"  >saundtrack</option><option value="754"  >schanson</option><option value="463"  >schlagers</option><option value="496"  >school</option><option value="519"  >seraneja</option><option value="705"  >serbian</option><option value="488"  >sertaneja</option><option value="531"  >sertaneja religious</option><option value="513"  >sertanejо</option><option value="504"  >setanejo</option><option value="860"  >sex education</option><option value="760"  >sherlock holmes</option><option value="448"  >sikh</option><option value="931"  >sindhi</option><option value="388"  >ska</option><option value="681"  >ski</option><option value="408"  >slow</option><option value="719"  >smooth</option><option value="344"  >smooth jazz</option><option value="673"  >smooth jazz .lounge . house</option><option value="825"  >smooth rock</option><option value="453"  >soca</option><option value="405"  >soft</option><option value="693"  >soft jazz</option><option value="375"  >soft pop</option><option value="322"  >soft rock</option><option value="729"  >songs</option><option value="413"  >sort</option><option value="768"  >sou</option><option value="392"  >soudtrack</option><option value="284"  >soul</option><option value="600"  >soul.r&amp;#39</option><option value="603"  >soulful</option><option value="342"  >soundtrack</option><option value="919"  >sountracks</option><option value="874"  >southern gospel</option><option value="469"  >spanish</option><option value="955"  >spanish rock</option><option value="758"  >speed</option><option value="399"  >spiritual</option><option value="522"  >spo</option><option value="240"  >sports</option><option value="517"  >sports б entertainment</option><option value="957"  >spots</option><option value="536"  >srorts</option><option value="474"  >student radio</option><option value="907"  >swamp pop</option><option value="303"  >swing</option><option value="481"  >swing jazz</option><option value="285"  >symphonic</option><option value="759"  >symphonic metal</option><option value="362"  >synth-pop</option><option value="644"  >synthie pop</option><option value="614"  >synthpop</option><option value="535"  >taalk</option><option value="456"  >tak</option><option value="239"  >talk</option><option value="973"  >talk pop</option><option value="836"  >talk.adult contemporary</option><option value="713"  >talk.news</option><option value="661"  >talk.top40</option><option value="450"  >tamil</option><option value="475"  >tamil pop</option><option value="612"  >tango</option><option value="945"  >tangо</option><option value="812"  >tech</option><option value="354"  >tech house</option><option value="280"  >tech trance</option><option value="289"  >techno</option><option value="796"  >techno. folk</option><option value="843"  >technology</option><option value="807"  >tejano</option><option value="900"  >telugu</option><option value="757"  >thrash</option><option value="694"  >thrash metal</option><option value="484"  >tip40</option><option value="921"  >to-40</option><option value="640"  >to40</option><option value="884"  >today</option><option value="556"  >top</option><option value="837"  >top 40s</option><option value="660"  >top hits</option><option value="572"  >top-40</option><option value="882"  >top0</option><option value="237"  >top40</option><option value="774"  >top40 pop</option><option value="876"  >tourism</option><option value="449"  >traditional</option><option value="440"  >traffic</option><option value="414"  >trafik</option><option value="260"  >trance</option><option value="395"  >transe</option><option value="559"  >trap</option><option value="590"  >trash metal</option><option value="875"  >travel</option><option value="781"  >tribal</option><option value="461"  >trip</option><option value="402"  >trip-hop</option><option value="838"  >trop rock</option><option value="890"  >tropic</option><option value="365"  >tropical</option><option value="859"  >tropics</option><option value="597"  >tubes</option><option value="423"  >turk</option><option value="401"  >turkish</option><option value="412"  >turkish pop</option><option value="839"  >u2</option><option value="581"  >ukrainian</option><option value="352"  >underground</option><option value="282"  >uplifting trance</option><option value="394"  >urban</option><option value="820"  >urban contemporary</option><option value="570"  >urdu</option><option value="941"  >vallenata</option><option value="716"  >vallenato</option><option value="717"  >valse</option><option value="958"  >variada</option><option value="598"  >varietes</option><option value="256"  >variety</option><option value="767"  >various</option><option value="968"  >variуен</option><option value="879"  >video game</option><option value="856"  >vietnamese</option><option value="373"  >vocal</option><option value="356"  >vocal house</option><option value="370"  >weather</option><option value="444"  >world</option><option value="602"  >world music</option><option value="883"  >yesterday</option><option value="848"  >yoga</option><option value="552"  >zen</option><option value="576"  >zouk</option><option value="750"  >поп</option><option value="515"  >сhristian</option><option value="762"  >сountry</option>       """

    # just a static list for now
    def update_categories(self):
        c = []
        rx_sel = re.compile(r"""<select name="genre"(.+)</select>""", re.S)
        rx_gen = re.compile(r"""<option value="(\d+)"\s*>([\w\s\-]+)</option>""", re.S)
        html = ahttp.get("http://radiolist.net/")
        html = re.findall(rx_sel, html)[0]

        for id,title in re.findall(rx_gen, html):

            c.append(title)
            self.catmap[title] = id
        self.categories = c
        
    # extraction rules
    recipe = {
        "block": """(<div\s+class="wp-radio-listing[^>]*>.+?)\n</div>""",
        "split": None,
        "fields": {
            "title": 'alt="(.+?)"',
            "genre": '<div class="genres">(.+?)</div>',
            "url": 'data-url="(http.+?)"',
            "homepage": '<a href="(.+?)"',
            "favicon": '<img[^>]+src="(.+?)"',
            "description": '<p[^>]*>(.+?)</p>'
        }
    }

    # extract stream urls
    def update_streams(self, cat):
        entries = []
        html = ""
        for i in range(1, int(int(conf.max_streams)/50)+1):
            self.status(i / 11.0)
            html = html + ahttp.get("http://radiolist.net/genre/{}?paginate={}".format(cat.lower(), i))
            if not html.find('?paginate={}">Next'.format(i+1)) >= 0:
                break
        for block in re.findall(self.recipe["block"], html, re.S|re.M):
            #log.HTML(block)
            e = {"genre":"-", "playing":cat, "format":"audio/mpeg"}
            for id,rx in self.recipe["fields"].iteritems():
                uu = re.findall(rx, block)
                #log.RX(id,rx,uu)
                if uu:
                    if id == "genre":
                        uu[0] = uu[0].replace("<a", " <a")
                    e[id] = unhtml(uu[0])
            if "url" in e and "title" in e:
                entries.append(e)


        # done    



        #[log.DATA(e) for e in entries]




        return entries

    






|


|





|



|
|


|















|
|


<
<
<
<



|
<
|
|
>
|
>
|
|
|
|
|
<
<
<
|
<
<
<
<
<
<
|
|
<

|

|
|
<
|
|
<
<
|
<
<
<
<
<
<
<
<
|
|
>
>
|
>
>
>
|
>
>
>
>


|
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42




43
44
45
46

47
48
49
50
51
52
53
54
55
56



57






58
59

60
61
62
63
64

65
66


67








68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# encoding: UTF-8
# api: streamtuner2
# title: radiolist.net
# description: Station list by categories
# url: http://radiolist.net/
# version: 0.7
# type: channel
# category: radio
# priority: optional
# png:
#   iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAFVBMVEVKb61qibyDnMegs9S6yeDV4O37/vyx66abAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMB
#   AJqcGAAAAAd0SU1FB+ECDBAgLJqgZW4AAADoSURBVBjTNdBNj4MgEAbgqdLeZdo9C5NwFmo5Y7Wedauc1y/+/09YdLskkDwJmZl3IOxnON4A8frQhdc/7mG2cv3gx29X
#   rdUfZuVHQ3JHEzZ7GSuNXxFV/FYYwryO6MOiZqEdnQPUC/fsXZaMuxa6MFfOVYN7kIWpHZClyJGLFjbbC617KaRUEJ4r4fU7IqNYrW5f2kgU5gZInG6MZ086eejcyIvO
#   1KwoLayoJjqnuWO5giW8msxVmBQXD5PttSlRm8TG2fDNZS3rRO/opeSCMnPa82xSmNgkfRxJ5yZxlPrPDmLu+7GqX4lERq4G0UEyAAAAAElFTkSuQmCC
# extraction-method: json
#
# ⚠ Requires a [Channel → Reload category tree] after updating.
#
# Radio station list, now categorized. And actually got an API.
# Search would be possible now, but isn't enabled.


import re, json, html
import action
import ahttp
from config import *
from channels import *


# radiolist.net
#
# · Only fetches titles/urls.
#
class radiolist (ChannelPlugin):

    # module attributes
    listformat = "pls"
    has_search = False
    categories = ['russian', 'metalcore', 'mappila', 'sindhi', '10s', 'business', 'deep house', 'indian', 'italian', 'tech house', 'afrikaans', 'bengali', 'kashmiri', 'gujarati', 'alternative rock', 'devotional', 'kannada', 'lain', 'talk pop', 'pop. rock. folk', 'multilingual', 'frace', 'swing jazz', 'tamil pop', 'student radio', '60s 70s 80s 90s 00s', 'paranormal talk', 'newage', 'pop teen', 'Ecology', 'top hits', 'sex education', 'sertaneja religious', 'saundtrack', 'fusion', 'smooth jazz', '00s', 'instrumental', 'reggae', 'minimal', 'information', 'balada', 'progressive rock', 'love songs', 'Dance Hits', 'trop rock', 'u2', 'modern rock', 'Guitar', 'air traffic', 'Poetry &amp; Prose', 'Experimental', 'merenge', 'railroad', 'Europe', 'arabic', 'african', 'islamic', 'chanson', 'r&amp;#39', 'n&amp;#39', 'b', 'politics', 'country', 'classic', 'Nutrition', 'odlies', 'polish', 'hardstyle', 'top40 pop', 'Electro', 'foul', 'zouk', 'acid house', 'Scanner', 'drum&amp;#39', '90s.pop', 'synthpop', 'charts', 'vocal', 'psy trance', 'bluegrass', 'roc', 'hind', 'deep techno', 'electric', 'Chamber Music', 'elvis presley', 'kollywood', 'Italo Disco', 'variaty', 'laika', 'Cinematic', 'raggaeton', 'polotik', 'r &amp;#39', 'Holistic health', 'lifestyle', 'rock\u0431r&amp;#39', 'video game', 'german', 'albanian', 'christianl', 'hits', 'popular', 'dis\u0441o', 'nes', 'entertaintment', 'srorts', 'love song', 'Doo Wop', 'soft pop', 'cuambia', 'games music', 'synth pop', 'trap', 'reggeaton', 'techno. folk', 'comedy', 'new wave', 'classic rock', 'rumba', 'india', 'Southern Rock', 'folk pop rock', 'gits', 'hardr rock', 'n&amp;#34', 'corelli', 'choir', 'instreumental', 'entrtainment', 'pop dance', 'deathcore', 'women', 'Steel Pan', 'Hanukkah', 'Singer-Songwriter', 'Sertanejo', 'vallenato', 'Gabber', 'malayalam', 'electro rock', 'urd', 'pop70s', 'banda', 'groove', 'johnny hallyday', 'frank sinatra', 'electro trance', 'sammy davis', 'dean martin', 'tech', 'Kwaito music', 'progressive trance', 'electro house', 'news', 'retro', '\u30cb\u30e5\u30fc\u30b9 (News)', 'pop', 'top40', 'adult contemporary', 'Adult', 'Contemporary Classical', 'Praise &amp; Worship', 'Public Access', 'Shopping', 'Bandanejo', 'Gay', 'Radio Reading Service', 'vietnamese', 'french', 'filipino', 'regueton', 'nits', 'tropics', 'dance pop', 'rock &amp;amp', 'Cars', 'jazz piano', 'romanian', 'serbian', 'glam', 'rock pop', 'manele', 'chr', 'thrash metal', 'Kpop', 'prayer', 'international', 'latin pop', 'gurbani', 'Flashback', 'Bhakti', 'hot adult contemporary', 'christian talk', 'traffic', 'black metal', 'zen', 'thrash', 'speed', 'drama', 'caribbean', 'motown', 'breakbeat', 'talk.top40', 'indie-pop', 'indie-folk', 'music', 'Postpunk', 'Holidays', 'queen', 'AAA', 'b.oldies', 'led zeppelin', 'rock`n roll', 'eletro', 'public', 'bob marley', 'oldies.top40', 'base', 'drum&amp;amp', 'rock.oldies', 'dark metal', 'gauchesca', 'info trafic', 'malayalam music', 'pop.60s', 'African Gospel', 'Old Time Radio', 'dacnce', 'club', 'trip-hop', 'dancec', 'latin\u043e', 'football', 'croatian', 'ethnic', 'ndian', 'anime', 'weather', 'power rock', 'military', 'eurodance', 'italodance', 'old', 'classik rock', 'tak', 'trip', 'schlagers', 'alternative metal', 'entretainment', 'christian rock', 'clasical rock', 'nature', 'setanejo', 'downtempo', 'spiritual', 'religion', 'soundtrack', 'pop ingles', 'elecreo', 'melodic rock', 'fisco', 'metal core', 'dutch', 'reggateon', 'ekectro', 'rock\u2018n\u2018roll', 'Big Band', 'contemporary jazz', 'talk.adult contemporary', 'mariachi', 'kumbia', 'beethoven', 'mantra', 'Tribute', 'ukrainian', 'talk', 'techno', 'progressive', 'dance', 'Dreampop', 'oldies', 'jazz', 'blues', 'house', 'electronic', 'piraten', 'popo', 'sikh', 'afropop', 'Schlager', 'love sungs', 'world music', 'rockabilly', 'bhangra', 'turkish', 'hip-hop r&amp;#39', 'various', 'cantonese', 'adult contemprory', 'oldis', 'astrology', 'marathi', 'pop-rock', 'kompa', 'movie news', 'bass', 'jungle', 'national news', 'Arabesk', 'death metal', 'folk rock', 'progressive metal', 'power metal', 'fock', 'Ballad', 'Drum and Bass', 'Electronica', 'Breaks', 'adult contemporar', 'konpa', 'interview podcasts', 'Classic Hits', 'reagge', 'Gospel Pop', 'postrock', 'dance l', 'today', 'calypso', 'top0', 'yesterday', 'Financial', 'tropic', 'rock. rock&amp;#39', 'History', 'Krautrock', 'j-metal', 'o dance', 'Konkani', 'Dulpod', 'Masala', 'Mando', 'nu metal', 'mathcore', 'hause', '\u043f\u043e\u043f', 'dsnce', 'disc', 'samba', 'chil out', 'ragga', 'grange', 'classsic', 'dance.trance', 'vocal house', 'bolero', 'soudtrack', 'longe', 'Gumbe', 'Language Learning', 'pagode', '50s', 'new age', 'politic', 'disco', 'relax', 'meditation', 'sertaneja', 'reggaeton', 'tropical', 'easy listening', 'marengue', 'psychill', 'goa', 'religous', 'discofox', 'heavy rock', 'informations', 'britpop', 'aor', 'fox', 'heavy', 'Bongo Flava', 'Standards', 'resque', 'inspirational', 'Laptop Music', 'bossa nova', 'Woman', 'Cartoons', 'hip hp', 'banda.bachata', 'road', 'preaching', 'news.talk', 'reageton', 'golspel', 'poker', 'Kuduro', 'r`n`b', 'countr', 'bach', 'classic metal', 'iindie', 'hard', 'regae', 'traditional', 'chutney', 'korean', 'lgbt', 'tejano', 'cubaton', 'persian', 'iranian', 'nostalgie', 'active rock', 'hawaiian', 'baroque', 'Cabo Love', 'College', 'Native American', 'Movies', 'local news', 'Food', 'spo', 'beatles', 'Pakistani', 'funk. sertanea', 'seraneja', 'dances', 'health', 'soft', '00', 'Positive', 'cat\xf3lica', 'freestyle', '60s 70s 80s', 'enterntainment', 'ska', 'indie', 'opera', 'heavy metal', 'funk', 'punk', 'grunge', 'metal', 'tango', 'schanson', 'indigo', 'slow', 'nu-jazz', 'chill-house', 'economic', 'turkish pop', 'islamik', 'david bowie', 'smooth jazz .lounge . house', 'michael jackson', 'portuguese', 'christian contemporary', 'ambient', 'dj', 'edm', 'roll', 'forr\xf3', 'k-pop', 'rock&amp;#39', 'eletronic', 'j-pop', 'dance rock', 'gothic', 'industrial', 'pink floyd', 'community', 'acoustic', 'asian', 'japanese', 'rawstyle', 'kurdish', 'ebm', 'medieval', 'hands up', 'deutsch', 'handsup', 'tamil', 'spanich', 'pop. news', 'folk. deutsch', 'paranormal', 'mozart', 'smooth rock', 'psytrance', 'hardstep', 'oos', 'kizomba', 'haitian', 'jewish', 'decades', '90s', '80s', 'Swedish', 'Psych', 'entertainment', 'christian', 'trance', 'eclectic', 'folk', 'culture', 'children', 'rock', 'Travel / Tourism', '\u0441hristian', 'Contemporary Christian', 'yoga', 'disco polo', 'crosover', 'crossover. gospel', 'croosover', 'crossover.community', 'reguetoon', 'combia', 'jazz funk', 'c-pop', 'hard core', 'IDM', 'Current Affairs', 'poetry', 'Other', 'Classics', 'hard roock', 'bosnian', 'neo-soul', 'b.hip-hop', 'cabaret', 'amateur radio', 'rail', 'judaism', 'polka', 'Kids', 'Sufi', 'lnew age', 'depeche mode', 'celtic', 'baseball', 'Odia', 'Fashion', 'Mehfil', 'cool jazz', 'latinvariety', 'dance hall', 'pop indie', 'maori', 'Rural', 'pop. 90s', 'Garbage', 'sports \u0431 entertainment', 'Soundtracks', 'Rapso', 'Afrobeat', 'swamp pop', 'travel', 'dub techno', 'doom', 'uplifting trance', 'deep electronic', 'hard-rave', 'tech trance', 'rave', 'japan', 'technology', 'transe', 'danse', 'pop.talk', 'oldies.pop', 'regeaton', 'news. sport', 'c', 'indi', 'disco. oldies', 'movie', 'ppop', 'live shows', 'odies', 'Recommended', '40s', 'brazilian pop', 'moroccan', 'elecrto', 'brazilian', 'classico', 'american', 'hard rock', 'drum\xb4n bass', 'elrctro', 'limp bizkit', 'synthie pop', 'rocknews', 'oldie', 'classsic rock', 'sartanejo', 'jpop', 'jrock', 'varietes', 'rn&amp;#39', 'balcan', 'tubes', 'reggeae', 'soul.r&amp;#39', 'israeli', 'Mediterranean', 'Art', 'Classical', 'Bulgarian', 'cumbia', 'spanish', 'to40', 'romantic', 'armenian', '60s', 'alternative', 'variety', 'azerbaijani', 'latin', 'urban', 'Family', 'http://visiondeselus.com', 'Shoegaze', 'Childrens Family', 'crossover', 'gospel jazz', 'cajun', 'telug', 'punk rock', 'marimba', 'Gaming', 'chill-out', 'lounge', '70s', 'dubstep', 'rap', 'sports', 'gospel', 'garage', 'Ham Radio', 'hip-hop', 'Teen Pop', 'mexican', '20s', 'classic jazz', 'acid jazz', 'l', 'raggae', 'pop.top40', 'Emergency &amp; Public Safety', 'Government', 'Documentaries', 'Tourism/Travel', 'Carnatic', 'Cooking', 'Emo', 'Thai', 'taalk', 'catolic', 'Lite Pop', 'live', 'flamenco', 'beyonce', 'christmas', 'nu-soul', 'symphonic', 'greece', 'italan', 'rok', 'progressive house', 'soul', 'swing', 'education', 'soft rock', 'religious', 'salsa', 'merengue', 'bachata', 'Ghetto', 'underground', 'Ballroom', 'rock news', 'oldies rock', 'chritian', 'reaggaeton', 'post-rock', 'rturkish', 'Fado', 'bolivian', 'new', 'grupera', 'ranchera', 'muslim', 'Youth', 'top-40', 'police', 'hit', 'hits 60s', 'pop.80s', 'spanish rock', 'hits\u0431 80s', 'latin jazz', 'public safety', 'electro-pop', 'irish', 'indie rock', 'urban contemporary', 'local', 'psychedelic', 'Balkan', 'Science', 'Americana', 'japanesse', 'Airport', 'Air Traffic Control', 'Liquid Funk', 'Festival', 'soca', 'Middle Eastern', 'Chillout', 'Catholic', 'colombian', 'reggeton', 'symphonic metal', 'boogie', '50', 'reading', 'Austrian', 'regaeton', 'golpel', 'halloween', 'desi', 'flash back', 'hinduism', 'rescue', 'mix', 'Chansons Fran\xe7aises', 'Slowjam', 'Animation', 'kirtan', 'Hebrew', 'Hindi', 'n\u2019b', 'reggaton', 'catalan', 'Zydeco', 'talk.news', 'valse', 'Seasons', 'smooth', 'milonga', 'Psy', 'southern gospel', 'Gospel Rock', 'General', 'top', 'world', 'Lithuanian', 'Campeira', 'punjabi', 'remix', 'chinese', 'pundjabi', 'christian pop', 'hardcore', 'dancehall', 'emergency', 'bangladeshi', 'party', 'pop.talk.news', 'old school', 'greek', 'roots', 'bollywood', '30s', 'english', 'tribal', 'buddhist', 'Soukous']
    catmap = {'folk rock': '455', 'power metal': '457', 'rok': '426', 'Singer-Songwriter': '5180', 'chinese': '487', 'ragga': '753', 'dance': '246', 'Shoegaze': '1092', 'roc': '447', 'gauchesca': '409', 'foul': '521', 'laika': '906', 'swamp pop': '678', 'n&amp;#39': '275', 'disc': '867', 'asian': '388', 'heavy metal': '311', '50': '721', 'meditation': '327', 'hard roock': '630', 'n&amp;#34': '857', 'children': '254', 'classic rock': '332', 'alternative rock': '349', 'Dreampop': '4624', 'Ballroom': '5125', 'vietnamese': '612', 'regae': '695', '\u043f\u043e\u043f': '862', 'hinduism': '601', 'r &amp;#39': '908', 'dancehall': '482', 'entertaintment': '433', 'rescue': '600', 'marimba': '672', 'Hanukkah': '13162', 'dutch': '929', 'Standards': '1041', 'Air Traffic Control': '7648', 'odlies': '524', 'edm': '365', 'Emergency &amp; Public Safety': '1416', 'Experimental': '1080', 'Kpop': '1578', 'acid house': '523', 'rturkish': '840', 'judaism': '465', 'news.talk': '664', 'Sufi': '7693', 'bob marley': '400', 'r&amp;#39': '274', 'reggeton': '725', 'croatian': '826', 'spiritual': '394', 'deutsch': '782', 'Festival': '1483', 'Language Learning': '1614', 'lgbt': '543', 'lnew age': '461', 'tamil pop': '711', 'raggaeton': '904', 'Konkani': '3881', '10s': '346', 'folk': '256', '90s': '258', 'c-pop': '736', 'telug': '670', 'drum\xb4n bass': '803', 'marathi': '627', 'resque': '686', 'gujarati': '814', 'indian': '341', 'reaggaeton': '843', 'international': '688', 'public': '401', 'nu-soul': '916', 'oldis': '621', 'christian': '253', 'latinvariety': '965', 'oldies': '240', 'reggeae': '767', 'muslim': '484', 'french': '613', 'hip hp': '669', 'sertaneja religious': '424', 'slow': '833', 'baseball': '608', 'saundtrack': '427', 'elvis presley': '902', 'trip-hop': '829', 'golpel': '729', 'classik rock': '700', 'turkish': '515', 'student radio': '710', 'techno': '244', 'rock. rock&amp;#39': '659', 'military': '709', 'Flashback': '1479', 'video game': '645', 'symphonic': '425', 'jazz funk': '508', 'Radio Reading Service': '1174', 'Middle Eastern': '1188', 'clasical rock': '390', 'Big Band': '1650', 'Hindi': '2583', 'Europe': '1125', 'air traffic': '594', 'Balkan': '1032', 'dance hall': '966', 'Mehfil': '6480', 'devotional': '816', 'soul.r&amp;#39': '764', 'chr': '943', 'Psy': '1110', 'music': '493', 'Positive': '2790', 'christian pop': '485', 'today': '652', 'j-metal': '869', 'Cooking': '4206', 'hard core': '739', 'turkish pop': '834', 'relax': '326', 'club': '378', 'halloween': '605', 'rocknews': '807', 'schlagers': '703', 'instrumental': '297', 'crossover. gospel': '730', 'classic jazz': '535', 'world music': '510', 'glam': '944', 'Sertanejo': '1625', 'doom': '879', 'synthie pop': '800', 'women': '822', 'christmas': '423', 'Financial': '1508', 'Americana': '1590', 'Family': '1090', 'pop. news': '788', 'r`n`b': '692', 'oldies rock': '846', 'soul': '309', 'pop.talk.news': '472', 'fock': '595', 'psy trance': '441', 'pop. rock. folk': '717', 'metalcore': '453', 'games music': '335', 'balcan': '760', 'indie': '313', 'top40 pop': '527', 'spo': '414', 'india': '823', 'folk. deutsch': '789', 'drum&amp;#39': '449', 'Schlager': '1699', 'beatles': '415', 'cantonese': '623', 'Soukous': '6232', 'dj': '364', 'dean martin': '556', 'flamenco': '421', 'power rock': '708', 'sikh': '519', 'tak': '701', 'information': '292', 'Chansons Fran\xe7aises': '1163', 'travel': '641', 'poetry': '502', 'lounge': '262', 'Seasons': '2400', 'desi': '604', 'comedy': '330', 'Steel Pan': '8908', 'sammy davis': '557', 'poker': '661', 'jazz': '243', 'interview podcasts': '596', 'b.hip-hop': '634', 'balada': '293', 'pop dance': '858', 'pink floyd': '385', 'soundtrack': '398', 'islamic': '272', 'aor': '772', 'Chillout': '1022', 'ethnic': '375', 'islamik': '838', 'Travel / Tourism': '2569', 'amateur radio': '636', 'psychedelic': '567', 'kashmiri': '813', 'reggaton': '959', 'reagge': '656', 'alternative metal': '393', 'love song': '431', 'greek': '470', 'Gabber': '5227', 'valse': '953', 'jungle': '451', 'african': '271', 'american': '351', 'combia': '734', 'talk': '245', 'bossa nova': '359', 'Catholic': '1187', 'mexican': '537', 'Mando': '3882', 'tropics': '617', 'zen': '459', 'danse': '891', 'national news': '629', 'religious': '304', 'talk.news': '950', 'progressive metal': '456', 'active rock': '545', 'urd': '743', 'japan': '871', 'soudtrack': '889', 'hip-hop': '268', 'astrology': '620', 'rock news': '827', 'Classics': '1035', 'police': '568', 'nostalgie': '544', 'crosover': '731', 'beyonce': '420', 'Documentaries': '1320', 'pop70s': '744', '\u0441hristian': '406', 'polotik': '905', 'IDM': '1033', 'ekectro': '799', 'decades': '574', 'pop teen': '422', 'enterntainment': '319', 'Classic Hits': '978', 'elecrto': '808', 'Youth': '1981', 'eclectic': '251', 'hard-rave': '874', 'top40': '236', 'talk pop': '718', 'hot adult contemporary': '680', 'taalk': '429', 'rock&amp;#39': '361', 'talk.adult contemporary': '587', 'regueton': '611', 'opera': '312', 'top hits': '911', 'choir': '851', 'rawstyle': '784', 'thrash metal': '941', '40s': '357', 'trap': '337', 'rock': '255', 'acoustic': '387', 'heavy': '778', 'salsa': '305', 'grupera': '539', 'house': '249', 'hard': '694', 'punk rock': '671', 'persian': '546', 'dubstep': '260', 'tribal': '478', 'preaching': '665', 'talk.top40': '490', 'piraten': '924', 'blues': '242', 'disco': '321', 'nits': '616', 'metal core': '791', 'gurbani': '687', 'entertainment': '252', 'culture': '257', 'goa': '774', 'health': '412', 'oldies.top40': '933', 'lain': '719', 'Carnatic': '6457', 'Chamber Music': '1545', 'pop. 90s': '935', 'bass': '450', 'led zeppelin': '938', 'dsnce': '865', '70s': '261', 'base': '932', 'Cartoons': '4302', 'Holistic health': '1537', 'odies': '673', 'baroque': '549', 'pop indie': '961', 'punk': '317', 'Current Affairs': '1031', 'spanish rock': '737', '90s.pop': '448', 'Doo Wop': '2616', 'swing': '300', 'hardcore': '462', 'nu metal': '861', 'informations': '770', 'industrial': '384', 'adult contemporar': '971', 'entrtainment': '853', 'tango': '314', 'spanish': '288', 'Praise &amp; Worship': '1193', 'hard rock': '350', 'electronic': '248', 'deathcore': '859', 'chanson': '273', 'hardr rock': '856', 'top': '466', 'k-pop': '360', 'Postpunk': '1832', 'Adult': '1191', 'cuambia': '338', 'acid jazz': '534', 'Old Time Radio': '1958', 'malayalam': '815', 'reggaeton': '325', 'kurdish': '785', 'http://visiondeselus.com': '679', 'Guitar': '1083', 'History': '2620', 'electro-pop': '759', 'christian rock': '391', 'b': '276', 'Classical': '1076', 'mantra': '580', 'death metal': '454', 'vocal': '442', 'kollywood': '821', 'eurodance': '704', 'ndian': '820', 'cat\xf3lica': '418', 'j-pop': '381', 'rock\u2018n\u2018roll': '798', '20s': '536', 'AAA': '1340', 'urban': '286', 'dance.trance': '886', 'crossover': '674', 'hits\u0431 80s': '755', 'Other': '1034', 'indie-pop': '491', 'Electro': '1018', 'Fado': '5082', 'Kwaito music': '3633', 'cool jazz': '907', 'Italo Disco': '4428', 'britpop': '773', 'iindie': '697', 'Food': '7439', 'trance': '250', 'news. sport': '438', 'mix': '603', 'reggeaton': '336', 'dis\u0441o': '435', 'Science': '1596', 'sindhi': '819', 'korean': '542', 'jpop': '768', 'handsup': '783', 'Ghetto': '1936', 'hip-hop r&amp;#39': '514', 'electric': '444', 'ukrainian': '589', 'eletronic': '380', 'multilingual': '714', 'israeli': '765', 'Rural': '1105', 'hands up': '781', 'electro rock': '740', 'Arabesk': '2456', 'indie rock': '564', 'n\u2019b': '635', 'rock`n roll': '403', 'punjabi': '489', 'metal': '315', 'Cabo Love': '5149', 'traditional': '698', 'cumbia': '289', 'tech': '551', 'movie': '646', 'indi': '897', 'Breaks': '972', 'latin jazz': '560', 'bangladeshi': '480', 'psychill': '775', 'boogie': '720', 'Bandanejo': '5929', 'german': '647', 'techno. folk': '331', 'queen': '407', 'popo': '419', 'moroccan': '809', 'love songs': '291', 'black metal': '458', 'japanesse': '738', 'seraneja': '410', 'Drum and Bass': '976', 'pop.talk': '892', 'Bulgarian': '1077', 'Woman': '1687', 'Tourism/Travel': '1329', 'dance rock': '382', 'romanian': '946', 'Southern Rock': '2865', 'trop rock': '590', 'dacnce': '379', 'Dance Hits': '1087', 'deep house': '340', 'Native American': '7563', 'Lite Pop': '1255', 'tropic': '658', 'local': '566', 'post-rock': '841', 'banda.bachata': '668', 'religous': '777', 'pop-rock': '626', 'indie-folk': '492', 'folk pop rock': '854', '60s 70s 80s 90s 00s': '915', 'variaty': '901', 'new': '374', 'breakbeat': '497', 'regaeton': '728', 'chutney': '699', 'afropop': '518', 'Ecology': '2316', 'progressive': '247', 'Hebrew': '1200', 'iranian': '547', 'Mediterranean': '4568', 'nes': '432', 'hardstyle': '526', 'southern gospel': '639', 'elecreo': '797', 'Austrian': '1741', 'instreumental': '852', 'bachata': '307', 'paranormal talk': '606', 'beethoven': '582', 'ebm': '787', 'tech trance': '875', 'uplifting trance': '876', 'new wave': '333', 'Recommended': '1609', 'Bongo Flava': '2972', 'greece': '910', 'croosover': '733', 'Ballad': '1082', '00': '920', 'Gospel Pop': '1503', 'Shopping': '1755', 'tejano': '540', 'crossover.community': '732', 'speed': '499', 'motown': '496', 'Cinematic': '2043', 'various': '516', 'roots': '476', 'Thai': '15023', 'reading': '501', 'entretainment': '392', 'ppop': '436', 'cajun': '677', 'latin': '287', 'nature': '397', 'chill-out': '263', 'zouk': '522', 'Laptop Music': '1341', 'funk. sertanea': '417', 'Liquid Funk': '1025', 'bolivian': '849', 'pagode': '355', 'armenian': '280', 'news': '238', 'Public Access': '2349', 'schanson': '866', 'hits': '241', 'countr': '690', 'reageton': '663', 'Contemporary Classical': '1190', 'country': '278', 'mariachi': '584', 'b.oldies': '405', 'top-40': '745', 'gospel': '265', 'melodic rock': '796', 'disco polo': '939', 'oldie': '806', 'disco. oldies': '899', 'flash back': '372', 'dancec': '828', 'regeaton': '894', 'discofox': '776', 'paranormal': '579', 'pop': '235', 'eletro': '402', 'colombian': '724', 'love sungs': '511', 'ranchera': '538', 'drum&amp;amp': '931', 'rave': '873', 'classic metal': '696', 'easy listening': '329', 'chritian': '844', 'michael jackson': '368', 'frace': '713', 'corelli': '850', 'African Gospel': '1951', 'setanejo': '396', 'Kuduro': '5102', 'reggateon': '416', 'public safety': '561', 'Lithuanian': '1711', 'polka': '464', 'charts': '443', 'konpa': '657', 'johnny hallyday': '747', 'local news': '563', 'pop.top40': '437', 'mappila': '818', 'classsic rock': '805', 'Teen Pop': '1550', 'Emo': '8526', 'c': '896', 'soft rock': '302', 'Soundtracks': '1108', 'Zydeco': '6047', 'tamil': '469', 'funk': '310', 'raggae': '530', 'merengue': '306', 'hits 60s': '751', 'sartanejo': '358', 'General': '1294', 'Animation': '1207', 'College': '1319', 'kirtan': '609', 'sertaneja': '324', 'thrash': '498', 'Childrens Family': '1093', '50s': '322', 'bolero': '569', 'milonga': '954', 'underground': '370', 'rap': '267', 'rock\u0431r&amp;#39': '643', 'bluegrass': '440', 'top0': '650', '00s': '296', 'swing jazz': '712', 'gothic': '383', 'ambient': '367', 'arabic': '270', 'technology': '597', 'neo-soul': '633', 'marengue': '562', 'buddhist': '479', 'electro house': '552', 'synthpop': '345', 'Bhakti': '8769', 'longe': '888', 'azerbaijani': '284', '80s': '259', 'party': '790', 'Contemporary Christian': '1583', 'brazilian pop': '356', 'psytrance': '900', 'kizomba': '577', 'rail': '637', 'yesterday': '651', 'Movies': '2044', 'Airport': '7649', 'rockabilly': '513', '60s 70s 80s': '926', 'christian contemporary': '366', 'o dance': '868', 'celtic': '463', 'Gospel Rock': '1561', 'contemporary jazz': '586', 'sports': '266', 'synth pop': '334', 'Psych': '4635', 'hardstep': '571', 'inspirational': '681', 'english': '475', '\u30cb\u30e5\u30fc\u30b9 (News)': '3064', 'malayalam music': '628', 'rock pop': '945', 'indigo': '832', 'frank sinatra': '555', 'postrock': '654', 'italan': '913', 'world': '591', 'polish': '525', 'alternative': '282', 'christian talk': '683', 'deep techno': '445', 'Gaming': '1152', 'bhangra': '512', 'samba': '354', 'Gay': '1750', 'bollywood': '477', 'heavy rock': '771', 'Holidays': '1834', 'ska': '318', 'emergency': '481', 'Campeira': '8009', 'varietes': '762', 'catalan': '958', 'fusion': '298', 'traffic': '682', 'community': '386', 'tech house': '343', 'tropical': '328', 'info trafic': '934', 'Art': '1079', 'railroad': '598', 'banda': '558', 'symphonic metal': '500', 'manele': '942', 'cubaton': '541', 'calypso': '653', 'Fashion': '5551', 'oos': '570', 'Scanner': '2263', 'jazz piano': '948', 'chil out': '883', 'dances': '411', 'latin pop': '685', 'garage': '264', 'elrctro': '802', 'serbian': '947', 'popular': '434', 'urban contemporary': '565', 'soft': '413', 'italian': '342', 'Swedish': '2194', 'portuguese': '369', 'old': '707', 'electro trance': '554', 'reggae': '294', 'gits': '855', 'bach': '691', 'l': '531', 'japanese': '389', 'economic': '837', 'smooth jazz .lounge . house': '922', 'dark metal': '936', 'nu-jazz': '830', 'Masala': '3883', 'Tribute': '4255', 'progressive rock': '290', 'vallenato': '348', 'rock.oldies': '930', 'movie news': '624', 'caribbean': '495', 'modern rock': '592', 'fox': '779', 'reguetoon': '735', 'transe': '890', 'religion': '399', 'Odia': '6489', 'retro': '239', 'limp bizkit': '801', 'hind': '446', 'minimal': '295', 'sex education': '619', 'medieval': '780', 'business': '347', 'gospel jazz': '676', 'kumbia': '585', 'pop.60s': '758', 'Poetry &amp; Prose': '1081', 'progressive trance': '553', 'deep electronic': '877', 'afrikaans': '810', 'downtempo': '395', 'cabaret': '468', 'classsic': '887', 'lifestyle': '640', 'Ham Radio': '3646', 'filipino': '610', 'classico': '352', 'albanian': '439', 'catolic': '428', 'drama': '494', 'Kids': '1128', 'old school': '473', 'anime': '377', 'Cars': '8799', 'oldies.pop': '893', 'sports \u0431 entertainment': '408', 'road': '667', 'pop.80s': '757', 'rn&amp;#39': '763', '30s': '474', 'smooth jazz': '299', 'Afrobeat': '2637', 'chill-house': '831', 'weather': '376', 'adult contemprory': '622', 'progressive house': '308', 'pop ingles': '895', 'Pakistani': '4609', 'Nutrition': '2546', 'adult contemporary': '237', 'soca': '505', 'depeche mode': '460', 'live': '918', 'u2': '593', 'grange': '880', 'brazilian': '353', 'dub techno': '878', 'newage': '917', 'maori': '968', 'grunge': '316', 'hawaiian': '548', 'jewish': '575', 'bosnian': '632', 'golspel': '662', 'bengali': '812', 'russian': '452', 'haitian': '576', 'italodance': '705', 'romantic': '281', 'jrock': '769', 'kompa': '625', 'smooth': '955', 'rumba': '559', 'Gumbe': '13065', 'politic': '320', 'Slowjam': '4246', 'hause': '863', 'groove': '746', 'irish': '509', 'classic': '279', 'Electronica': '973', 'kannada': '817', 'mathcore': '860', 'prayer': '689', 'politics': '277', 'education': '301', 'trip': '702', 'hit': '752', 'forr\xf3': '363', 'Dulpod': '3880', 'pundjabi': '486', 'yoga': '602', 'variety': '285', 'rock &amp;amp': '615', 'Rapso': '4088', 'new age': '323', 'freestyle': '925', 'to40': '572', 'roll': '362', 'christianl': '649', 'live shows': '648', 'david bowie': '839', '60s': '283', 'spanich': '903', 'Krautrock': '7359', 'football': '373', 'smooth rock': '573', 'vocal house': '885', 'fisco': '795', 'srorts': '430', 'remix': '488', 'Garbage': '8581', 'mozart': '578', 'tubes': '761', 'latin\u043e': '824', 'Government': '1417', 'soft pop': '339', 'dance pop': '614', 'merenge': '599', 'dance l': '655'}
    titles = dict( genre="Genre", title="Station", playing="Location", bitrate="Bitrate", listeners=False )





    # just a static list for now
    def update_categories(self):
        c = []
        rx_sel = re.compile(r"""data-genres='(\{.+?\})'""")

        doc = ahttp.get("https://radiolist.net/radio-stations")
        doc = re.findall(rx_sel, doc)[0]
        try:
            doc = html.unescape(html.unescape(doc))
        except:
            pass
        map = json.loads(doc)
        self.categories = sorted(map.values())
        self.catmap = dict(zip(map.values(), map.keys()))
        print(self.categories)



        print(self.catmap)






        


    # extract stream urls
    def update_streams(self, cat, search=None):
        entries = []
        catid = self.catmap.get(cat, "")
        for i in range(1, int(int(conf.max_streams)/100)+1):

            j = json.loads(ahttp.get(
                "https://radiolist.net/wp-json/wp-radio/v1/station?paginate={}&keyword={}&country=&genre={}&sort=asc&perpage=50&_locale=user".format(i, search or "", catid)


            ))








            for e in j["data"]["items"]:
                entries.append({
                    "id": e["id"],
                    "title": e["title"],
                    "favicon": e["thumbnail"],
                    "url": e["stream"],
                    "homepage": e["website"],
                    "playing": e["slogan"],
                    "genre": " ".join([g["name"] for g in e["genres"]]),
                    #"country": e["locations"]["country"]["name"],
                })
            if i >= j["data"]["total"]:
                break
        return entries