35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
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
|
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
|
More importantly you need the `update_streams()` method to fetch station lists. It receives a `cat` parameter, for instance `"Pop"`. Then do whatever API query or website scraping (regex/pyquery) is necessary to populate a list.
Most plugins will return a list of dicts like:
{title: Radio123, url: http://pls, genre: Pop, playing: Song123}
The title is required, and the streaming URL of course. Other fields are mostly optional. (Received data gets stored internally in a `streams={}` dict.)
The title is required, and the streaming URL of course. Other fields are mostly optional.
* Standard fields are: genre, title, url, playing, homepage, bitrate, listeners, favicon. Internal fields are: state, deleted, favourite.
* Standard fields are:
* <kbd>genre</kbd> - the category name
* <kbd>title</kbd> - station title
* <kbd>url</kbd> - streaming url (to pls or m3u resource)
* <kbd>playing</kbd> - currently playing song, if any
* <kbd>homepage</kbd> - station homepage
* <kbd>bitrate</kbd> - (int) audio bitrate (like 128)
* <kbd>listeners</kbd> - (int) number of listeners
* <kbd>favicon</kbd> - url to favicon, if any
* <kbd>format</kbd> - to set a custom audio format (audio/ogg)
* Internal fields are:
* <kbd>state</kbd> - a gtk icon
* <kbd>deleted</kbd> - strikethrough for deleted entries
* <kbd>favourite</kbd> - add a star for bookmarked stations
* <kbd>search_col</kbd> - search color
* <kbd>search_set</kbd> - search state
* With a `datamap=[]` declaration custom field names could be displayed.
* Often you just want to rename the column titles however per `title=dict(listeners="Whatever")` in the class declaration.
* Often you just want to rename the column titles however - per `title=dict(listeners="Whatever")` in the class declaration.
Received station lists get stored internally in a `streams={"Pop":[...]}` dict, and cached in the `~/.config/streamtuner2/cache/` directory of course.
There's also a `config=[]` list, in case your plugin needs to keep some settings. (For example an API key.)
The `has_search` class flag permits live server searches. If one is issued, the `update_streams()` method will be called with `cat=None` and `search="Find me maybe"` set instead.
* Other class options include `listformat="audio/x-scpls"` for declaring the station URL mime type (here `pls` for example).
* And `audioformat="audio/mpeg"` for the audio mime type.
* While `current=""` and `default="Pop"` can specify which category is visible per default, or currently active. (Both will be retired in later versions. More a clutch for current Gtk handling.)
* Other internal fields are listed in `channels/_generic.py`
|