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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [5d4406f73d]:

To Artifact [099fb4d0ad]:


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
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






-
-
+
+





+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+








-
-
+
+

-
+
-
-
-
-
+







#!/usr/bin/env python
# encoding: UTF-8
# api: python
# type: application
# title: streamtuner2
# description: Directory browser for internet radio / audio streams
# depends: pygtk | pygi, threading, pyquery, kronos, requests
# version: 2.1.3
# depends: pygtk | pygi, threading, pyquery, python-lxml, requests
# version: 2.1.3-3
# author: mario salzer
# license: public domain
# url: http://freshcode.club/projects/streamtuner2
# config: <env name="http_proxy" value="" description="proxy for HTTP access" />  <env name="XDG_CONFIG_HOME" description="relocates user .config subdirectory" />
# category: multimedia
# id: streamtuner2
# 
# pack:
#   gtk*.xml,
#   *.py,
#   st2.py=/usr/bin/streamtuner2,
#   channels/__init__.py,
#   bundle,
#   streamtuner2.desktop=/usr/share/applications/,
#   README=/usr/share/doc/streamtuner2/,
#   help/streamtuner2.1=/usr/share/man/man1/,
#   help=/usr/share/doc/streamtuner2/,
#   streamtuner2.png,
#   logo.png=/usr/share/pixmaps/streamtuner2.png,
# epoch:
# architecture: all
#
#
# Streamtuner2 is a GUI browser for internet radio directories. Various
# providers can be added, and streaming stations are usually grouped into
# music genres or categories. It starts external audio players for stream
# playing and streamripper for recording broadcasts.
#
# It's an independent rewrite of streamtuner1 in a scripting language. So
# it can be more easily extended and fixed. The use of PyQuery for HTML
# parsing makes this simpler and more robust.
# it can be more easily extended and fixed. The mix of JSON APIs, regex
# or PyQuery extraction simplifies processing many sources.
#
# Stream lists are stored in JSON cache files.
# Primarily radio stations are displayed, some channels however are music
#
#
#

# collections. Commercial and sign-up services are not the target purpose.

""" project status """
#
# The application runs mostly stable. The GUI interfaces are workable.
# It's supposed to run on Gtk2 and Gtk3. Python3 support is still WIP.
# There haven't been any optimizations regarding memory usage and
# performance. The current internal API is vastly undocumented.
54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
69
70
65
66
67
68
69
70
71

72


73
74
75
76
77
78
79







-
+
-
-







#   - MEDIUM: little integrity checking for .pls / .m3u references and files
#   - minimal XML/SGML entity decoding (-> faulty data)
#   - MEDIUM: if system json module is not available, pseudo-json uses eval()
#     to read the config data -> limited risk, since it's only local files
#   - HIGH RISK: no verification of downloaded favicon image files (ico/png),
#     as they are passed to gtk.gdk.Pixbuf (OTOH data pre-filtered by Google)
#   - MEDIUM: audio players / decoders are easily affected by buffer overflows
#     from corrupt mp3/stream data, and streamtuner2 executes them
#     from corrupt mp3/stream data, and streamtuner2 just passes them on
#      - but since that's the purpose -> no workaround
#



# standard modules
import sys
import os, os.path
import re
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115







-
+







import ahttp
import action  # needs workaround... (action.main=main)
import channels
from channels import *
import favicon


__version__ = "2.1.3"
__version__ = "2.1.3-3"


# this represents the main window
# and also contains most application behaviour
main = None
class StreamTunerTwo(gtk.Builder):