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

⌈⌋ branch:  streamtuner2


Check-in [0edaf9402f]

Overview
Comment:New mime/app configuration screen in an editable ListStore. Players, recording hook and browser are now mixed up in conf.play{}
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0edaf9402f680d128b95730e0b082f30494e867d
User & Date: mario on 2014-05-14 23:44:07
Other Links: manifest | tags
Context
2014-05-15
19:45
and conf.pyquery default, so it's not forgotten by config_dialog.save_config check-in: bc473dc5da user: mario tags: trunk
2014-05-14
23:44
New mime/app configuration screen in an editable ListStore. Players, recording hook and browser are now mixed up in conf.play{} check-in: 0edaf9402f user: mario tags: trunk
2014-05-13
23:55
narrower options in settings dialog check-in: d6fb6f5d65 user: mario tags: trunk
Changes

Modified action.py from [5d3890f993] to [9506eb9e76].

43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
        # media formats
        mf = {"mp3":"audio/mpeg", "ogg":"audio/ogg", "aac":"audio/aac"}
        
        
        # web
        @staticmethod
        def browser(url):

            __print__( dbg.CONF, conf.browser )
            action.run(conf.browser + " " + action.quote(url))


            
        # os shell cmd escaping
        @staticmethod
        def quote(s):
            if conf.windows:







>
|
|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        # media formats
        mf = {"mp3":"audio/mpeg", "ogg":"audio/ogg", "aac":"audio/aac"}
        
        
        # web
        @staticmethod
        def browser(url):
            bin = conf.play.get("url/http", "sensible-browser")
            __print__( dbg.CONF, bin )
            action.run(bin + " " + action.quote(url))


            
        # os shell cmd escaping
        @staticmethod
        def quote(s):
            if conf.windows:
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                os.system(cmd + " &")


        # streamripper
        @staticmethod
        def record(url, audioformat="audio/mpeg", listformat="text/x-href", append="", row={}):
            __print__( dbg.PROC, "record", url )
            cmd = conf.record.get(audioformat, conf.record.get("*/*", None))
            try: action.run( action.interpol(cmd, url, row) + append )
            except: pass


        # save as .m3u
        @staticmethod
        def save(row, fn, listformat="audio/x-scpls"):







|







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
                os.system(cmd + " &")


        # streamripper
        @staticmethod
        def record(url, audioformat="audio/mpeg", listformat="text/x-href", append="", row={}):
            __print__( dbg.PROC, "record", url )
            cmd = conf.record.get(audioformat, conf.play.get("record", None))
            try: action.run( action.interpol(cmd, url, row) + append )
            except: pass


        # save as .m3u
        @staticmethod
        def save(row, fn, listformat="audio/x-scpls"):

Modified config.py from [c89ffe92b8] to [0b8fb92b93].

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
            else:
                self.save("settings")
                self.firstrun = 1


        # some defaults
        def defaults(self):
            self.browser = "sensible-browser"
            self.play = {
               "audio/mpeg": "audacious ",	# %u for url to .pls, %g for downloaded .m3u
               "audio/ogg": "audacious ",
               "audio/aac": "amarok -l ",
               "audio/x-pn-realaudio": "vlc --one-instance",
               "audio/*": "totem ",
               "*/*": "vlc --one-instance %srv",



            }
            self.record = {
               "*/*": "x-terminal-emulator -e streamripper %srv",
                    #  x-terminal-emulator -e streamripper %srv -d /home/***USERNAME***/Musik
            }
            self.plugins = {
                "bookmarks": 1,  # built-in plugins, cannot be disabled
                "shoutcast": 1,
                "xiph": 1,
                "file": 0,   # disable per default
                "punkcast": 0,   # disable per default







<



<
<

|
>
>
>


<
<







55
56
57
58
59
60
61

62
63
64


65
66
67
68
69
70
71


72
73
74
75
76
77
78
            else:
                self.save("settings")
                self.firstrun = 1


        # some defaults
        def defaults(self):

            self.play = {
               "audio/mpeg": "audacious ",	# %u for url to .pls, %g for downloaded .m3u
               "audio/ogg": "audacious ",


               "audio/*": "totem ",
               "video/*": "vlc --one-instance %srv",
               "record": "x-terminal-emulator -e streamripper %srv",
                    #  x-terminal-emulator -e streamripper %srv -d /home/***USERNAME***/Musik
               "url/http": "sensible-browser",
            }
            self.record = {


            }
            self.plugins = {
                "bookmarks": 1,  # built-in plugins, cannot be disabled
                "shoutcast": 1,
                "xiph": 1,
                "file": 0,   # disable per default
                "punkcast": 0,   # disable per default

Modified gtk2.xml from [722d740b7e] to [286f15081e].

1
2
3
4










5
6
7
8
9
10
11
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk+" version="2.20"/>
  <!-- interface-naming-policy toplevel-contextual -->










  <object class="GtkDialog" id="search_dialog">
    <property name="can_focus">False</property>
    <property name="border_width">5</property>
    <property name="title" translatable="yes">station search</property>
    <property name="window_position">center-on-parent</property>
    <property name="type_hint">dialog</property>
    <property name="deletable">False</property>




>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk+" version="2.20"/>
  <!-- interface-naming-policy toplevel-contextual -->
  <object class="GtkListStore" id="config_play">
    <columns>
      <!-- column-name type -->
      <column type="gchararray"/>
      <!-- column-name app -->
      <column type="gchararray"/>
      <!-- column-name gboolean1 -->
      <column type="gboolean"/>
    </columns>
  </object>
  <object class="GtkDialog" id="search_dialog">
    <property name="can_focus">False</property>
    <property name="border_width">5</property>
    <property name="title" translatable="yes">station search</property>
    <property name="window_position">center-on-parent</property>
    <property name="type_hint">dialog</property>
    <property name="deletable">False</property>
131
132
133
134
135
136
137













































138
139
140
141
142
143
144
                <property name="can_focus">False</property>
                <property name="tooltip_text" translatable="yes">Which channels/directories to look through.</property>
                <property name="n_rows">4</property>
                <property name="n_columns">4</property>
                <property name="column_spacing">5</property>
                <property name="row_spacing">1</property>
                <property name="homogeneous">True</property>













































                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
                <property name="can_focus">False</property>
                <property name="tooltip_text" translatable="yes">Which channels/directories to look through.</property>
                <property name="n_rows">4</property>
                <property name="n_columns">4</property>
                <property name="column_spacing">5</property>
                <property name="row_spacing">1</property>
                <property name="homogeneous">True</property>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
                  <placeholder/>
                </child>
                <child>
986
987
988
989
990
991
992


















993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010



1011
1012
1013
1014
1015
1016
1017
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>


















            <child>
              <object class="GtkEntry" id="timer_value">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="invisible_char">●</property>
                <property name="text" translatable="yes">Fri,Sat 20:00-21:00</property>
                <property name="primary_icon_activatable">False</property>
                <property name="secondary_icon_activatable">False</property>
                <property name="primary_icon_sensitive">True</property>
                <property name="secondary_icon_sensitive">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="right_attach">2</property>
                <property name="top_attach">1</property>
                <property name="bottom_attach">2</property>
              </packing>
            </child>



            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















>
>
>







1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <object class="GtkEntry" id="timer_value">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="invisible_char">●</property>
                <property name="text" translatable="yes">Fri,Sat 20:00-21:00</property>
                <property name="primary_icon_activatable">False</property>
                <property name="secondary_icon_activatable">False</property>
                <property name="primary_icon_sensitive">True</property>
                <property name="secondary_icon_sensitive">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="right_attach">2</property>
                <property name="top_attach">1</property>
                <property name="bottom_attach">2</property>
              </packing>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
              <placeholder/>
            </child>
            <child>
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190

1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255


1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268

1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289

1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301

1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313


1314
1315

1316

1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
                    <child>
                      <object class="GtkViewport" id="viewport2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="border_width">15</property>
                        <property name="shadow_type">none</property>
                        <child>
                          <object class="GtkTable" id="table3">
                            <property name="width_request">350</property>
                            <property name="height_request">471</property>
                            <property name="visible">True</property>
                            <property name="can_focus">False</property>
                            <property name="n_rows">13</property>
                            <property name="n_columns">2</property>
                            <property name="column_spacing">5</property>
                            <property name="row_spacing">5</property>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label6">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/aac</property>
                              </object>
                              <packing>
                                <property name="top_attach">3</property>
                                <property name="bottom_attach">4</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label9">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/x-real</property>

                              </object>
                              <packing>
                                <property name="top_attach">4</property>
                                <property name="bottom_attach">5</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label10">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/*</property>
                              </object>
                              <packing>
                                <property name="top_attach">5</property>
                                <property name="bottom_attach">6</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label14">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/*</property>
                              </object>
                              <packing>
                                <property name="top_attach">9</property>
                                <property name="bottom_attach">10</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label11">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">*/*</property>
                              </object>
                              <packing>
                                <property name="top_attach">6</property>
                                <property name="bottom_attach">7</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_play_audio_aac">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char"></property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">3</property>
                                <property name="bottom_attach">4</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_play_audio_x_pn_realaudio">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>


                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">4</property>
                                <property name="bottom_attach">5</property>
                              </packing>

                            </child>
                            <child>
                              <object class="GtkEntry" id="config_play_audio__">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">5</property>
                                <property name="bottom_attach">6</property>
                              </packing>
                            </child>

                            <child>
                              <object class="GtkEntry" id="config_play____">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>

                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">6</property>
                                <property name="bottom_attach">7</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label15">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>


                                <property name="label" translatable="yes">Shoutcast links are %u or %pls, parsed m3u files
are available with %g or %m3u, while %d or %srv

represent direct URLs to the streaming servers.</property>

                                <property name="wrap">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">7</property>
                                <property name="bottom_attach">8</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label12">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">&lt;b&gt;Recording&lt;/b&gt;</property>
                                <property name="use_markup">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">8</property>
                                <property name="bottom_attach">9</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_record____">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">9</property>
                                <property name="bottom_attach">10</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label22">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">    </property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">10</property>
                                <property name="bottom_attach">11</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label16">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">&lt;b&gt;Web Browser&lt;/b&gt;</property>
                                <property name="use_markup">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">11</property>
                                <property name="bottom_attach">12</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label17">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">url/http</property>
                              </object>
                              <packing>
                                <property name="top_attach">12</property>
                                <property name="bottom_attach">13</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_browser">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">12</property>
                                <property name="bottom_attach">13</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_play_audio_mpeg">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">1</property>
                                <property name="bottom_attach">2</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label7">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/mpeg</property>
                              </object>
                              <packing>
                                <property name="top_attach">1</property>
                                <property name="bottom_attach">2</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkEntry" id="config_play_audio_ogg">
                                <property name="width_request">200</property>
                                <property name="height_request">20</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="invisible_char">●</property>
                                <property name="invisible_char_set">True</property>
                                <property name="primary_icon_activatable">False</property>
                                <property name="secondary_icon_activatable">False</property>
                                <property name="primary_icon_sensitive">True</property>
                                <property name="secondary_icon_sensitive">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                                <property name="top_attach">2</property>
                                <property name="bottom_attach">3</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label59">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">audio/ogg</property>
                              </object>
                              <packing>
                                <property name="top_attach">2</property>
                                <property name="bottom_attach">3</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label8">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">&lt;b&gt;Format&lt;/b&gt;</property>
                                <property name="use_markup">True</property>
                              </object>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label46">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">&lt;b&gt;Audio Player&lt;/b&gt;</property>
                                <property name="use_markup">True</property>
                              </object>
                              <packing>
                                <property name="left_attach">1</property>
                                <property name="right_attach">2</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label124124_placeholder">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">placeholder
&lt;a href="http://fossil.include-once.org/streamtuner2/wiki?name=player"&gt;see help&lt;/a&gt;</property>
                                <property name="use_markup">True</property>
                              </object>
                              <packing>
                                <property name="top_attach">7</property>
                                <property name="bottom_attach">8</property>
                              </packing>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>







|
<
<


<
<
<
<

<
<
<
<
<
<
<
<
<
|


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


<
|
<
<
<
<
|
<
<
<
<
|
<



|

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


|
|
|
<






>
>
|
<
>
|
>



<
<
|
<
<
<
<
<
|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1226
1227
1228
1229
1230
1231
1232
1233


1234
1235




1236









1237
1238
1239



1240







1241
1242
1243
1244

1245




1246




1247

1248
1249
1250
1251
1252
1253



1254
1255


1256
1257











1258
1259
1260
1261
1262
1263
1264





1265
1266
1267
1268


1269
1270
1271
1272
1273
1274
1275
1276
1277





1278

1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293




1294

1295
1296
1297

1298
1299
1300
1301
1302










1303
1304
1305
1306
1307
1308

1309
1310
1311
1312
1313
1314
1315
1316
1317

1318
1319
1320
1321
1322
1323


1324





1325





1326
















































































































































































1327
1328
1329
1330
1331
1332
1333
                    <child>
                      <object class="GtkViewport" id="viewport2">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="border_width">15</property>
                        <property name="shadow_type">none</property>
                        <child>
                          <object class="GtkVBox" id="vbox_cfg_player">


                            <property name="visible">True</property>
                            <property name="can_focus">False</property>




                            <child>









                              <object class="GtkLabel" id="label_player">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>



                                <property name="xalign">0</property>







                                <property name="label" translatable="yes">&lt;b&gt;Audio player&lt;/b&gt; and &lt;b&gt;recording&lt;/b&gt; applications.</property>
                                <property name="use_markup">True</property>
                              </object>
                              <packing>

                                <property name="expand">True</property>




                                <property name="fill">True</property>




                                <property name="position">0</property>

                              </packing>
                            </child>
                            <child>
                              <object class="GtkScrolledWindow" id="scrolledwindow4">
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>



                                <property name="hscrollbar_policy">automatic</property>
                                <property name="vscrollbar_policy">automatic</property>


                                <child>
                                  <object class="GtkTreeView" id="tv_config_player">











                                    <property name="width_request">0</property>
                                    <property name="height_request">200</property>
                                    <property name="visible">True</property>
                                    <property name="can_focus">True</property>
                                    <property name="border_width">5</property>
                                    <property name="model">config_play</property>
                                    <property name="headers_clickable">False</property>





                                    <property name="rules_hint">True</property>
                                    <property name="search_column">0</property>
                                    <property name="level_indentation">8</property>
                                    <property name="enable_grid_lines">both</property>


                                    <child>
                                      <object class="GtkTreeViewColumn" id="tvc_config_player_type">
                                        <property name="spacing">10</property>
                                        <property name="min_width">125</property>
                                        <property name="title" translatable="yes">Format</property>
                                        <property name="sort_indicator">True</property>
                                        <child>
                                          <object class="GtkCellRendererText" id="tvcr_config_player_type">
                                            <signal name="edited" handler="config_player_edited" swapped="no"/>





                                          </object>

                                          <attributes>
                                            <attribute name="editable">2</attribute>
                                            <attribute name="text">0</attribute>
                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                    <child>
                                      <object class="GtkTreeViewColumn" id="tvc_config_player_app">
                                        <property name="spacing">10</property>
                                        <property name="min_width">300</property>
                                        <property name="title" translatable="yes">Application</property>
                                        <child>
                                          <object class="GtkCellRendererText" id="tvcr_config_player_app">
                                            <signal name="edited" handler="config_player_edited_2" swapped="no"/>




                                          </object>

                                          <attributes>
                                            <attribute name="editable">2</attribute>
                                            <attribute name="text">1</attribute>

                                          </attributes>
                                        </child>
                                      </object>
                                    </child>
                                  </object>










                                </child>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">1</property>

                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label15">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="xalign">0.019999999552965164</property>
                                <property name="yalign">0.49000000953674316</property>
                                <property name="label" translatable="yes">Use &lt;a href="http://fossil.include-once.org/streamtuner2/wiki?name=player"&gt;placeholders&lt;/a&gt; such as &lt;b&gt;%pls&lt;/b&gt; for Shoutcast playlists,

or pass &lt;b&gt;%m3u&lt;/b&gt; for players that expect mp3 playlist files,
and &lt;b&gt;%srv&lt;/b&gt; to use direct streaming URLs.</property>
                                <property name="use_markup">True</property>
                                <property name="wrap">True</property>
                              </object>
                              <packing>


                                <property name="expand">True</property>





                                <property name="fill">True</property>





                                <property name="position">2</property>
















































































































































































                              </packing>
                            </child>
                          </object>
                        </child>
                      </object>
                    </child>
                  </object>
2713
2714
2715
2716
2717
2718
2719
2720
2721

2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733

2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
                            <property name="can_focus">False</property>
                            <child>
                              <object class="GtkMenuItem" id="menu_bookmark">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">bookmark</property>
                                <property name="use_underline">True</property>
                                <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                <accelerator key="F8" signal="activate"/>

                                <signal name="activate" handler="bookmark" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="imagemenuitem_saveas">
                                <property name="label">gtk-save-as</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>
                                <accelerator key="F2" signal="activate"/>
                                <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>

                                <signal name="activate" handler="save_as" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="gtk-edit">
                                <property name="label">gtk-edit</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>
                                <accelerator key="F3" signal="activate"/>
                                <accelerator key="space" signal="activate" modifiers="GDK_MOD1_MASK"/>
                                <accelerator key="Return" signal="activate" modifiers="GDK_MOD1_MASK"/>
                                <signal name="activate" handler="streamedit_open" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkMenuItem" id="extensions0">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>







<

>










<

>










|

|







2529
2530
2531
2532
2533
2534
2535

2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547

2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
                            <property name="can_focus">False</property>
                            <child>
                              <object class="GtkMenuItem" id="menu_bookmark">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="label" translatable="yes">bookmark</property>
                                <property name="use_underline">True</property>

                                <accelerator key="F8" signal="activate"/>
                                <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                <signal name="activate" handler="bookmark" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="imagemenuitem_saveas">
                                <property name="label">gtk-save-as</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>

                                <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                <accelerator key="F2" signal="activate"/>
                                <signal name="activate" handler="save_as" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="gtk-edit">
                                <property name="label">gtk-edit</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>
                                <accelerator key="Return" signal="activate" modifiers="GDK_MOD1_MASK"/>
                                <accelerator key="space" signal="activate" modifiers="GDK_MOD1_MASK"/>
                                <accelerator key="F3" signal="activate"/>
                                <signal name="activate" handler="streamedit_open" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkMenuItem" id="extensions0">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
2812
2813
2814
2815
2816
2817
2818
2819
2820

2821
2822
2823
2824
2825
2826
2827
                            <child>
                              <object class="GtkImageMenuItem" id="menuitem_delete">
                                <property name="label">gtk-delete</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>
                                <accelerator key="Delete" signal="activate"/>
                                <accelerator key="x" signal="activate" modifiers="GDK_CONTROL_MASK"/>

                                <signal name="activate" handler="delete_entry" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="imagemenuitem8">
                                <property name="label">gtk-find</property>
                                <property name="visible">True</property>







<

>







2628
2629
2630
2631
2632
2633
2634

2635
2636
2637
2638
2639
2640
2641
2642
2643
                            <child>
                              <object class="GtkImageMenuItem" id="menuitem_delete">
                                <property name="label">gtk-delete</property>
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="use_underline">True</property>
                                <property name="use_stock">True</property>

                                <accelerator key="x" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                                <accelerator key="Delete" signal="activate"/>
                                <signal name="activate" handler="delete_entry" swapped="no"/>
                              </object>
                            </child>
                            <child>
                              <object class="GtkImageMenuItem" id="imagemenuitem8">
                                <property name="label">gtk-find</property>
                                <property name="visible">True</property>

Modified st2.py from [a65b5708f4] to [95ed169041].

181
182
183
184
185
186
187


188
189
190
191
192
193
194
                "menu_toolbar_size_small": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)),
                "menu_toolbar_size_medium": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DND)),
                "menu_toolbar_size_large": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DIALOG)),
                # else
                "menu_properties": config_dialog.open,
                "config_cancel": config_dialog.hide,
                "config_save": config_dialog.save,


                "update_categories": self.update_categories,
                "update_favicons": self.update_favicons,
                "app_state": self.app_state,
                "bookmark": self.bookmark,
                "save_as": self.save_as,
                "menu_about": lambda w: AboutStreamtuner2(),
                "menu_help": action.action.help,







>
>







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
                "menu_toolbar_size_small": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)),
                "menu_toolbar_size_medium": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DND)),
                "menu_toolbar_size_large": lambda w: (self.toolbar.set_icon_size(gtk.ICON_SIZE_DIALOG)),
                # else
                "menu_properties": config_dialog.open,
                "config_cancel": config_dialog.hide,
                "config_save": config_dialog.save,
                "config_player_edited": config_dialog.edited_player_row,
                "config_player_edited_2": config_dialog.edited_player_row_2,
                "update_categories": self.update_categories,
                "update_favicons": self.update_favicons,
                "app_state": self.app_state,
                "bookmark": self.bookmark,
                "save_as": self.save_as,
                "menu_about": lambda w: AboutStreamtuner2(),
                "menu_help": action.action.help,
743
744
745
746
747
748
749
750
751
752
753
754
755
756

757
758
759
760
761
762
763
764
765
766
767
768
769
770
771













772
773


774
775

776
777
778

779
780


781
782

783


784
785





786
787
788
789
790
791
792



# aux win: settings UI
class config_dialog (auxiliary_window):


        # display win_config, pre-fill text fields from global conf. object
        def open(self, widget):
            if self.first_open:
                self.add_plugins()
                self.combobox_theme()
                self.first_open = 0
            self.apply(conf.__dict__, "config_", 0)

            self.win_config.show()
        first_open = 1


        def hide(self, *args):
            self.win_config.hide()
            return True

        
        # set/load values between gtk window and conf. dict
        def apply(self, config, prefix="config_", save=0):
            for key,val in config.items():
                # map non-alphanumeric chars from config{} to underscores in according gtk widget names
                id = re.sub("[^\w]", "_", key)
                w = main.get_widget(prefix + id)













                __print__(dbg.CONF, "config", ("save" if save else "load"), prefix+id, w, val)
                # recurse into dictionaries, transform: conf.play.audio/mpeg => conf.play_audio_mpeg


                if (type(val) == dict):
                    self.apply(val, prefix + id + "_", save)

                # load or set gtk.Entry text field
                elif (w and save and type(w)==gtk.Entry):
                    config[key] = w.get_text()

                elif (w and type(w)==gtk.Entry):
                    w.set_text(str(val))


                elif (w and save):
                    config[key] = w.get_active()

                elif (w):


                    w.set_active(bool(val))
            pass







        # fill combobox
        def combobox_theme(self):
           # self.theme.combo_box_new_text()
            # find themes
            themedirs = (conf.share+"/themes", conf.dir+"/themes", "/usr/share/themes")







|





|
>



|





|
|

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







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771


772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797

798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819



# aux win: settings UI
class config_dialog (auxiliary_window):


        # Display win_config, pre-fill text fields from global conf. object
        def open(self, widget):
            if self.first_open:
                self.add_plugins()
                self.combobox_theme()
                self.first_open = 0
            self.load_config(conf.__dict__, "config_")
            self.load_config(conf.plugins, "config_plugins_")
            self.win_config.show()
        first_open = 1

        # Hide window
        def hide(self, *args):
            self.win_config.hide()
            return True

        
        # Load values from conf. store into gtk widgets
        def load_config(self, config, prefix="config_"):
            for key,val in config.items():


                w = main.get_widget(prefix + key)
                if w:
                    # input field
                    if type(w) is gtk.Entry:
                        w.set_text(str(val))
                    # checkmark
                    elif type(w) is gtk.CheckButton:
                        w.set_active(bool(val))
                    # list
                    elif type(w) is gtk.ListStore:
                        w.clear()
                        for k,v in val.items():
                            w.append([k, v, True])
                        w.append(["", "", True])
                __print__(dbg.CONF, "config load", prefix+key, val, type(w))

        # Store gtk widget valus back into conf. dict
        def save_config(self, config, prefix="config_", save=0):
            for key,val in config.items():
                w = main.get_widget(prefix + key)
                if w:
                    # text
                    if type(w) is gtk.Entry:
                        config[key] = w.get_text()
                    # boolean
                    elif type(w) is gtk.CheckButton:

                        config[key] = w.get_active()
                    # dict
                    elif type(w) is gtk.ListStore:
                        config[key] = {}
                        for row in w:
                            if row[0] and row[1]:
                                config[key][row[0]] = row[1]
                __print__(dbg.CONF, "config save", prefix+key, val)

        
        # Gtk callback to update ListStore when entries get edited
        def edited_player_row(self, cell, path, new_text, user_data=None, column=0):
            main.config_play[path][column] = new_text
        def edited_player_row_2(self, cell, path, new_text, user_data=None):
            self.edited_player_row(cell, path, new_text, column=1)


        # fill combobox
        def combobox_theme(self):
           # self.theme.combo_box_new_text()
            # find themes
            themedirs = (conf.share+"/themes", conf.dir+"/themes", "/usr/share/themes")
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858

859
860
861
862
863
864
865

866
867
868
869
870
871
872
873
874
875
876

877
878
879
880
881
882
883
                        else:
                            self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"] )

                # spacer 
                self.add_( "filler_pl_"+name, gtk.HSeparator() )


        # put gtk widgets into config dialog notebook
        def add_(self, id, w, label=None, color=""):
            w.set_property("visible", True)
            main.widgets[id] = w
            if label:
                w.set_width_chars(11)
                w = self.hbox(w, self.label(label))
            if color:
                w = mygtk.bg(w, color)
            self.plugin_options.pack_start(w)


        def label(self, label):
            label = gtk.Label(label)
            label.set_property("visible", True)
            label.set_line_wrap(True) 
            label.set_size_request(400, -1)
            return label


        def hbox(self, w1, w2):
            vbox = gtk.HBox(homogeneous=False, spacing=10)
            vbox.set_property("visible", True)
            vbox.pack_start(w1, expand=False, fill=False)
            vbox.pack_start(w2, expand=True, fill=True)
            return vbox

        
        # save config
        def save(self, widget):
            self.apply(conf.__dict__, "config_", 1)

            self.apply_theme()
            conf.save(nice=1)
            self.hide()
                  
config_dialog = config_dialog()
# instantiates itself








|










>







>










|
>







868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
                        else:
                            self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"] )

                # spacer 
                self.add_( "filler_pl_"+name, gtk.HSeparator() )


        # Put config widgets into config dialog notebook
        def add_(self, id, w, label=None, color=""):
            w.set_property("visible", True)
            main.widgets[id] = w
            if label:
                w.set_width_chars(11)
                w = self.hbox(w, self.label(label))
            if color:
                w = mygtk.bg(w, color)
            self.plugin_options.pack_start(w)

        # Create GtkLabel
        def label(self, label):
            label = gtk.Label(label)
            label.set_property("visible", True)
            label.set_line_wrap(True) 
            label.set_size_request(400, -1)
            return label

        # Wrap two widgets in vertical box
        def hbox(self, w1, w2):
            vbox = gtk.HBox(homogeneous=False, spacing=10)
            vbox.set_property("visible", True)
            vbox.pack_start(w1, expand=False, fill=False)
            vbox.pack_start(w2, expand=True, fill=True)
            return vbox

        
        # save config
        def save(self, widget):
            self.save_config(conf.__dict__, "config_")
            self.save_config(conf.plugins, "config_plugins_")
            self.apply_theme()
            conf.save(nice=1)
            self.hide()
                  
config_dialog = config_dialog()
# instantiates itself