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

⌈⌋ branch:  streamtuner2


Check-in [6226dc5594]

Overview
Comment:Nicer error message, and compacter plugin comment. Add default config value in init.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6226dc5594a88f0a5f3c8217fd7afcd757c20a48
User & Date: mario on 2015-04-01 15:43:31
Other Links: manifest | tags
Context
2015-04-01
15:44
Fix conf.debug checking. check-in: 4997a22651 user: mario tags: trunk
15:43
Nicer error message, and compacter plugin comment. Add default config value in init. check-in: 6226dc5594 user: mario tags: trunk
15:42
More PixbufLoader workarounds for Gtk3, and get_data() casting for Python 3. check-in: f5d46dca11 user: mario tags: trunk
Changes

Modified channels/global_key.py from [3e28ed6ce5] to [cc1be2e9de].

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
#
# api: streamtuner2
# title: Global keyboard shortcut
# description: Allows switching between bookmarked radios via key press.
# type: feature
# category: ui
# version: 0.2
# config:
#    { name="switch_key", type="text", value="XF86Forward", description="Global key shortcut for switching radio." },
#    { name="switch_channel", type="text", value="bookmarks:favourite", description="Station list and channels to alternate in." },
#    { name="switch_random", type="boolean", value=0, description="Pick random channel, instead of next." },
# priority: extra
# depends: python-keybinder
#
#
# Binds a key to global desktop (F13 = left windows key). On keypress
# it switches the currently playing radio station to another one in
# bookmarks list.
#
# Valid key names are for example F9, <Ctrl>G, <Alt>R, <Super>N
#


import keybinder
from config import conf
import action
import random



# register a key
class global_key(object):

    module = "global_key"
    title = "keyboard shortcut"
    meta = plugin_meta()
    last = 0


    # register
    def __init__(self, parent):
        self.parent = parent

        try:
            for i,keyname in enumerate(conf.switch_key.split(",")):    # allow multiple keys
                keybinder.bind(keyname, self.switch, ((-1 if i else +1)))   # forward +1 or backward -1
        except:
            print("Key could not be registered")
    
        
    # key event
    def switch(self, num, *any):
        
        # bookmarks, favourite
        channel, cat = conf.switch_channel.split(":")
<





|








|
|
|

|
<



|

















>




|








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

# api: streamtuner2
# title: Global keyboard shortcut
# description: Allows switching between bookmarked radios via key press.
# type: feature
# category: ui
# version: 0.3
# config:
#    { name="switch_key", type="text", value="XF86Forward", description="Global key shortcut for switching radio." },
#    { name="switch_channel", type="text", value="bookmarks:favourite", description="Station list and channels to alternate in." },
#    { name="switch_random", type="boolean", value=0, description="Pick random channel, instead of next." },
# priority: extra
# depends: python-keybinder
#
#
# Binds a key to global desktop (F13 = left windows key).
# On keypress switches the currently playing radio station
# to another one from the bookmarks list.
#
# Valid key names are `F9`, `<Ctrl>G`, `<Alt>R` for example.



import keybinder
from config import *
import action
import random



# register a key
class global_key(object):

    module = "global_key"
    title = "keyboard shortcut"
    meta = plugin_meta()
    last = 0


    # register
    def __init__(self, parent):
        self.parent = parent
        conf.add_plugin_defaults(self.meta["config"], self.module)
        try:
            for i,keyname in enumerate(conf.switch_key.split(",")):    # allow multiple keys
                keybinder.bind(keyname, self.switch, ((-1 if i else +1)))   # forward +1 or backward -1
        except:
            __print__(dbg.ERR, "plugin global_key: Key `%s` could not be registered" % conf.switch_key)
    
        
    # key event
    def switch(self, num, *any):
        
        # bookmarks, favourite
        channel, cat = conf.switch_channel.split(":")