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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [900a5ca1af]

Overview
Comment:Remove MusciGoal plugin, API seems gone.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 900a5ca1af2059abbd96791aafb1a814d7cae7ef
User & Date: mario on 2015-03-24 21:09:50
Other Links: manifest | tags
Context
2015-03-24
21:10
Recent logo Inkscape remake. check-in: f81ad7cdb5 user: mario tags: trunk
21:09
Remove MusciGoal plugin, API seems gone. check-in: 900a5ca1af user: mario tags: trunk
21:09
Updated key. check-in: 0db0cbed82 user: mario tags: trunk
Changes

Deleted channels/musicgoal.png version [3272744a4f].

cannot compute difference between binary files

Deleted channels/musicgoal.py version [9694d3b314].

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
99
100
101
102
103
#
# api: streamtuner2
# title: MUSICGOAL
# description: Broad list of radio stations and podcasts. Provides a sane API, but only 5 results each.
# type: channel
# category: radio
# version: 0.1
# priority: optional
# status: experimental
#
# Musicgoal.com is a radio and podcast directory. This plugin tries to use
# the new API for accessing listing data.
#
#



# st2 modules
from config import conf
from mygtk import mygtk
import ahttp as http
from channels import *

# python modules
import re
import json



          
# I wonder what that is for                                             ---------------------------------------
class musicgoal (ChannelPlugin):

        # desc
        module = "musicgoal"
        title = "MUSICGOAL"
        homepage = "http://www.musicgoal.com/"
        base_url = homepage
        listformat = "url/direct"

        # settings
        config = [
        ]
        api_podcast = "http://www.musicgoal.com/api/?todo=export&todo2=%s&cat=%s&format=json&id=1000259223&user=streamtuner&pass=tralilala"
        api_radio = "http://www.musicgoal.com/api/?todo=playlist&format=json&genre=%s&id=1000259223&user=streamtuner&pass=tralilala"

        # categories are hardcoded
        podcast = ["Arts", "Management", "Recreation", "Knowledge", "Nutrition", "Books", "Movies & TV", "Music", "News", "Business", "Poetry", "Politic", "Radio", "Science", "Science Fiction", "Religion", "Sport", "Technic", "Travel", "Health", "New"]
        radio = ["Top radios", "Newcomer", "Alternative", "House", "Jazz", "Classic", "Metal", "Oldies", "Pop", "Rock", "Techno", "Country", "Funk", "Hip hop", "R&B", "Reggae", "Soul", "Indian", "Top40", "60s", "70s", "80s", "90s", "Sport", "Various", "Radio", "Party", "Christmas", "Firewall", "Auto DJ", "Audio-aacp", "Audio-ogg", "Video", "MyTop", "New", "World", "Full"]
        categories = ["podcasts/", podcast, "radios/", radio]
        #catmap = {"podcast": dict((i+1,v) for enumerate(self.podcast)), "radio": dict((i+1,v) for enumerate(self.radio))}
        


        # nop
        def update_categories(self):
            pass


        # request json API
        def update_streams(self, cat):

            # category type: podcast or radio
            if cat in self.podcast:
                grp = "podcast"
                url = self.api_podcast % (grp, self.podcast.index(cat)+1)
            elif cat in self.radio:
                grp = "radio"
                url = self.api_radio % cat.lower().replace(" ","").replace("&","")
            else:
                return []
                
            # retrieve API data
            data = http.get(url, params=None, ajax=1)
            data = json.loads(data)
                
            # tranform datasets            
            if grp == "podcast":
                return [{
                    "genre": cat,
                    "title": row["titel"],
                    "homepage": row["url"],
                    "playing": str(row["typ"]),
                    #"id": row["id"],
                    #"listeners": int(row["2"]),
                    #"listformat": "text/html",
                    "url": "",
                } for row in data]
            else:
                return [{
                    "format": self.mime_fmt(row["ctype"]),
                    "genre": row["genre"] or cat,
                    "url": "http://%s:%s/%s" % (row["host"], row["port"], row["pfad"]),
                    "listformat": "url/direct",
                    "id": row["id"],
                    "title": row["name"],
                    "playing": row["song"],
                    "homepage": row.get("homepage") or row.get("url"),
                } for row in data]




<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<