gslimp3

Check-in [c8a43a3030]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:initial import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | descendants | trunk
Files: files | file ages | folders
SHA3-256: c8a43a303026547cefe72805953b78c9f8671545a57dd97bd2424aa3b34b97ad
User & Date: jef@foutaise.org 2015-11-15 17:24:44
Context
2015-11-15
17:44
Update README.md check-in: c2e11dca91 user: jef@foutaise.org tags: trunk
17:24
initial import check-in: c8a43a3030 user: jef@foutaise.org tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace

Added INSTALL.md.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# INSTALLING gslimp3

## Requirements

* python
* python-gtk2
* python-glade2
* madplay (or another MPEG player)
* an up and running SlimServer accessible on your network. SlimServer is
  downloadable from the Slim Devices web site:
  http://www.slimdevices.com/

## Install

```
$ su -c "make install"
```

## Run

```
$ gslimp3
```

Added Makefile.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
VERSION=0.6
PREFIX=/usr/local
BUILD_DIR=$(DESTDIR)/$(PREFIX)
BIN_DIR=$(BUILD_DIR)/bin
MAN_DIR=$(BUILD_DIR)/share/man/man1
SHARE_DIR=$(BUILD_DIR)/share/gslimp3
FINAL_SHARE_DIR=$(PREFIX)/share/gslimp3

all:

install:
	python setup.py install --prefix=$(BUILD_DIR)
	
	install -d $(BIN_DIR)
	install -d $(MAN_DIR)
	install -d $(SHARE_DIR)
	
	sed -e 's#@SHARE_DIR@#$(FINAL_SHARE_DIR)#' gslimp3 > gslimp3.tmp
	install -m 755 gslimp3.tmp $(BIN_DIR)/gslimp3
	\rm gslimp3.tmp

	sed -e 's/@VERSION@/$(VERSION)/' gslimp3.glade > gslimp3.glade.tmp
	install -m 644 gslimp3.glade.tmp $(SHARE_DIR)/gslimp3.glade
	\rm gslimp3.glade.tmp
	
	install -m 644 lcd_chars.txt $(SHARE_DIR)/lcd_chars.txt
	
	sed -e 's/@VERSION@/$(VERSION)/' gslimp3.1 | gzip -c9 - > gslimp3.1.gz.tmp
	install -m 644 gslimp3.1.gz.tmp $(MAN_DIR)/gslimp3.1.gz
	\rm gslimp3.1.gz.tmp

clean:
	\rm -f *.pyc
	\rm -rf build

.PHONY: all install clean

Added README.md.











>
>
>
>
>
1
2
3
4
5
# gslimp3

gslimp3 is a SLIMP3 player emulator. For instructions how to install read
the 'INSTALL' file.

Added gslimp3.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
#!/usr/bin/python
# -*- coding: latin1 -*-
#
# Copyright (C) 2005 Gerome Fournier <jef(at)foutaise.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"SLIMP3 player emulator written in python"

import os
import gobject
import gtk
import gtk.glade
import sys
import signal
import slimp3
import struct
import socket
import ConfigParser
import time

_CHARS_FILENAME = "@SHARE_DIR@/lcd_chars.txt"
_GLADE_FILENAME = "@SHARE_DIR@/gslimp3.glade"

_KEY_MAPPING = {
	"0": '0',
	"1": '1',
	"2": '2',
	"3": '3',
	"4": '4',
	"5": '5',
	"6": '6',
	"7": '7',
	"8": '8',
	"9": '9',
	"KP_0": '0',
	"KP_1": '1',
	"KP_2": '2',
	"KP_3": '3',
	"KP_4": '4',
	"KP_5": '5',
	"KP_6": '6',
	"KP_7": '7',
	"KP_8": '8',
	"KP_9": '9',
	"UP": 'UP',
	"RIGHT": 'RIGHT',
	"LEFT": 'LEFT',
	"DOWN": 'DOWN',
	"PAGE_UP": 'VOLUP',
	"PAGE_DOWN": 'VOLDOWN',
	"HOME": 'NOW_PLAYING',
	"RETURN": 'PLAY',
	"KP_ENTER": 'PLAY',
	"SPACE": 'PAUSE',
	"BRACKETLEFT": 'REW',
	"BRACKETRIGHT": 'FWD',
	"PLUS": 'ADD',
	"KP_ADD": 'ADD',
	"SLASH": 'SEARCH',
	"KP_DIVIDE": 'SEARCH',
	"A": 'SLEEP',
	"B": 'BRIGHTNESS',
	"F": 'SIZE',
	"R": 'REPEAT',
	"S": 'SHUFFLE',
}

class LCDWidget:
	"GTK+ LCD Widget"

	def __init__(self, widget, rows, cols):
		"Instantiate a LCD widget"
		self.rows = rows
		self.cols = cols
		self._area = widget
		self._pix = None
		self._table = {}
		self._area.connect("configure-event", self._configure_cb)
		self._area.connect("expose-event", self._expose_cb)

	def set_zoom_factor(self, factor):
		"Set the zoom factor"
		self._factor = factor
		self._border = 5
		self._cborder = 3*factor
		self._cwidth = 9*factor
		self._cheight = 13*factor
		self._width = 2*self._border + \
				(self._cwidth+self._cborder)*self.cols + self._cborder
		self._height = 2*self._border + \
				(self._cheight+self._cborder)*self.rows + self._cborder
		self._area.set_size_request(self._width, self._height)


	def refresh(self):
		"Refresh the LCD widget"
		self._area.queue_draw_area(0, 0, self._width, self._height)

	def draw_char(self, row, col, charindex):
		"""Draw the character stored at position 'charindex' in the internal
		   character definition table, on the LCD widget
		"""
		if not self._pix:
			return
		x = col * (self._cwidth+self._cborder) + self._border + self._cborder
		y = row * (self._cheight+self._cborder) + self._border + self._cborder
		self._pix.draw_drawable(self._back, self._table[charindex], \
				0, 0, x, y, self._cwidth, self._cheight)

	def set_brightness_percentage(self, percentage):
		fg_colors = {
			100: "#00ff96",
			75: "#00d980",
			50: "#00b269",
			25: "#008c53",
			0: "#303030"
		}
		if percentage not in fg_colors.keys():
			return
		if hasattr(self, "_brightness_percentage") \
			and self._brightness_percentage == percentage:
			return
		self._brightness_percentage = percentage
		self._set_colors(["#000000", "#303030", fg_colors[percentage]])
		self._load_font_definition()

	def clear(self):
		"Clear the LCD display"
		for row in range(self.rows):
			for col in range(self.cols):
				self.draw_char(row, col, 32)
		self.refresh()

	def set_button_press_event_cb(self, cb):
		"Setup a callback when a mouse button is pressed on the LCD display"
		self._area.add_events(gtk.gdk.BUTTON_PRESS_MASK)
		self._area.connect("button_press_event", cb)

	def set_scroll_event_cb(self, cb):
		"Setup a callback when wheel mouse is used on the LCD display"
		self._area.connect("scroll_event", cb)

	def create_char(self, charindex, shape):
		"""Insert a new char in the character table definition,
		   at position 'charindex', based on 'shape'
		"""
		pix = gtk.gdk.Pixmap(self._area.window, self._cwidth, self._cheight)
		pix.draw_rectangle(self._back, True, 0, 0, self._cwidth, self._cheight)
		for x in range(5):
			for y in range(7):
				pix.draw_rectangle(self._charbg, True, \
					x*2*self._factor, y*2*self._factor, \
					self._factor, self._factor)
		for index in range(35):
			if shape[index] == "1":
				row = index / 5
				col = index - row*5
				pix.draw_rectangle(self._charfg, True, \
					col*2*self._factor, row*2*self._factor, \
					self._factor, self._factor)
		self._table[charindex] = pix

	def print_line(self, string):
		"Print a single line on the LCD display"
		self.clear()
		for i in range(len(string[:self.cols])):
			self.draw_char(0, i, ord(string[i]))
		self.refresh()

	def _configure_cb(self, widget, event):
		x, y, width, height = widget.get_allocation()
		self._pix = gtk.gdk.Pixmap(widget.window, width, height)
		self.set_brightness_percentage(100)
		self._pix.draw_rectangle(self._back, True, 0, 0, width, height)
		self._load_font_definition()
		self.clear()
		return True

	def _expose_cb(self, widget, event):
		if self._pix:
			widget.window.draw_drawable(self._back, self._pix, 0, 0, 0, 0, \
					self._width, self._height)
		return False

	def _set_colors(self, colors):
		for widget, color in zip(["_back", "_charbg", "_charfg"], colors):
			exec "self.%s = gtk.gdk.GC(self._pix)" % widget
			exec "self.%s.set_rgb_fg_color(gtk.gdk.color_parse('%s'))" \
				% (widget, color)

	def _load_font_definition(self):
		try:
			file = open(_CHARS_FILENAME)
		except IOError:
			print >>sys.stderr, "Unable to open font characters definition '%s'" \
					% _CHARS_FILENAME
			sys.exit(1)
		index = 1
		shape = ""
		for line in file.readlines():
			line = line.rstrip()
			if not line or line[0] == "#":
				continue
			if index == 1:
				char_index = int(line, 16)
			else:
				shape = ''.join([shape, line])
			index += 1
			if index == 9:
				self.create_char(char_index, shape)
				index = 1
				shape = ""

class Slimp3LCD(LCDWidget):
	"An LCD display abble to parse Slimp3 LCD display packets"
	_CODE_DELAY = 0
	_CODE_CMD = 2
	_CODE_DATA = 3

	_CMD_CLEAR = 0
	_CMD_HOME = 1
	_CMD_MODE = 2
	_CMD_DISPLAY = 3
	_CMD_SHIFT = 4
	_CMD_FUNC_SET = 5
	_CMD_CG_ADDR = 6
	_CMD_DD_ADDR = 7
	
	def parse_lcd_packet(self, lcd_packet):
		"Parse a SLIMP3 LCD packet"
		self.addr = 0
		self.shift = 1
		i = 0
		while i < len(lcd_packet)/2:
			chunk = socket.ntohs(struct.unpack("H", lcd_packet[i*2:i*2+2])[0])
			code = (chunk & 0xFF00) >> 8
			cmd = chunk & 0x00FF
			if code == self._CODE_DELAY:
				pass
			elif code == self._CODE_CMD:
				i += self._handle_command(cmd, lcd_packet[i*2:])
			elif code == self._CODE_DATA:
				row = self.addr / self.cols
				col = self.addr - self.cols*row
				self.draw_char(row, col, cmd)
				self._move_cursor(self.shift)
			i += 1
		self.refresh()

	def _handle_command(self, cmd, string):
		"Handle LCD commands"
		if cmd >> self._CMD_CLEAR == 1:
			self.clear()
			self.addr = 0
			self.shift = 1
		elif cmd >> self._CMD_HOME == 1:
			self.addr = 0
		elif cmd >> self._CMD_MODE == 1:
			if cmd & 2 != 0:
				self.shift = 1
			else:
				self.shift = -1
		elif cmd >> self._CMD_DISPLAY == 1:
			pass
		elif cmd >> self._CMD_SHIFT == 1:
			if cmd & 0x04:
				self.move_cursor(-1)
			else:
				self.move_cursor(1)
		elif cmd >> self._CMD_FUNC_SET == 1:
			return self._handle_function_set(cmd, string[2:4])
		elif cmd >> self._CMD_CG_ADDR == 1:
			return self._handle_char_definition(cmd, string[2:16])
		elif cmd >> self._CMD_DD_ADDR == 1:
			pass
		return 0

	def _handle_function_set(self, cmd, string):
		"Handle Brightness stuff"
		if ord(string[0]) == 3:
			self.set_brightness_percentage(100 - 25 * ord(string[1]))
			return 1
		else:
			return 0
		
	def _handle_char_definition(self, char, string):
		"Create a char as defined by 'string'"
		if len(string) != 14:
			print >>sys.stderr, "Character definition has a wrong size!"
			return 0
		shape = [' '] * 35
		index = (0x3f & char) >> 3;
		for i in range(7):
			line = ord(string[2*i + 1])
			for j in range(5):
				if 1 & (line >> (4 - j)):
					shape[i*5+j] = "1"
		self.create_char(index, shape)
		# defining a new char consume 7 extra command codes
		return 7

	def _move_cursor(self, shift):
		self.addr += shift
		if self.addr < 0:
			self.addr = 0
		elif self.addr > self.rows * self.cols - 1:
			self.addr = self.rows * self.cols - 1

class Window:
	"Base class to deal with glade based windows"

	def __init__(self, windowname):
		"Instantiate a window from the glade file"
		self._wTree = gtk.glade.XML(_GLADE_FILENAME, windowname)
		self._window = self._wTree.get_widget(windowname)
		self._setup_callbacks()
	
	def _setup_callbacks():
		pass

class Slimp3Gui(Window):
	"Main GUI"

	def __init__(self):
		"Instantiate the application"
		Window.__init__(self, "gslimp3")
		self._window.hide()
		self._setup_widgets()

		self._prefs = Preferences()
		self._prefs.load()
		self._prefs.set_modified_server_cb(self._modified_server_cb)
		self._prefs.set_modified_player_cb(self._modified_player_cb)
		self._prefs.set_modified_volume_control_cb(self._modified_volume_control_cb)
		self._set_zoom_factor(self._prefs.zoom_factor)

		self._slimp3 = slimp3.Slimp3Client()
		self._slimp3.set_player(self._prefs.player_cmdline)
		self._slimp3.set_volume_control(self._prefs.volume_control)
		if self._prefs.use_broadcast:
			self._slimp3.set_server('255.255.255.255')
		else:
			self._slimp3.set_server(self._prefs.server_hostname)
		self._slimp3.set_server_port(self._prefs.server_port)
		gobject.io_add_watch(self._slimp3.lcddata_fd, gobject.IO_IN,
				self._handle_lcddata)

	def run(self):
		"Start the application"
		try:
			signal.signal(signal.SIGINT, self._quit)
			signal.signal(signal.SIGTERM, self._quit)
			self._window.show()
			if self._prefs.use_broadcast:
				self.lcd_display.print_line("Broadcasting...")
			else:
				self.lcd_display.print_line("Contacting server...")
			self._slimp3.connect()
			gtk.main()
		except KeyboardInterrupt:
			raise
		except:
			raise

	def _modified_player_cb(self, player_cmdline):
		self._slimp3.disconnect()
		self._slimp3.set_player(player_cmdline)
		self._slimp3.connect()

	def _modified_server_cb(self, use_broadcast, server_hostname, server_port):
		self._slimp3.disconnect()
		if use_broadcast:
			self.lcd_display.print_line("Broadcasting...")
			self._slimp3.set_server('255.255.255.255')
		else:
			self.lcd_display.print_line("Contacting server...")
			self._slimp3.set_server(server_hostname)
		self._slimp3.set_server_port(server_port)
		self._slimp3.connect()

	def _modified_volume_control_cb(self, volume_control):
		self._slimp3.disconnect()
		self._slimp3.set_volume_control(volume_control)
		self._slimp3.connect()

	def _quit(self, *args):
		self._slimp3.disconnect()
		gtk.main_quit()

	def _on_about(self, *args):
		About()

	def _on_preferences(self, *args):
		self._prefs.show()

	for _cmd in ["play", "pause", "fwd", "rew", "power"]:
		exec "def _on_%s(self, *args):\n\
				self._slimp3.cmd_%s()" % (_cmd, _cmd)

	def _on_zoom_in(self, *args):
		self._set_zoom_factor(2)

	def _on_zoom_out(self, *args):
		self._set_zoom_factor(1)

	def _key_pressed(self, widget, event):
		keyname = gtk.gdk.keyval_name(event.keyval)
		if not keyname:
			return
		else:
			keyname = keyname.upper()
		code = _KEY_MAPPING.get(keyname, False)
		if code:
			exec "self._slimp3.cmd_%s()" % code.lower()
			return True
		else:
			return False

	def _handle_lcddata(self, lcddata_fd, condition):
		str = os.read(lcddata_fd, struct.calcsize("i"))
		data_length = struct.unpack("i", str)[0]
		data = os.read(lcddata_fd, data_length)
		self.lcd_display.parse_lcd_packet(data)
		return True

	def _setup_widgets(self):
		widget = self._wTree.get_widget('lcddisplay')
		self._menu_edit_zoom_in = self._wTree.get_widget('zoom_in')
		self._menu_edit_zoom_out = self._wTree.get_widget('zoom_out')
		self.lcd_display = Slimp3LCD(widget, 2, 40)
		def button_press_cb(widget, event):
			self._slimp3.cmd_now_playing()
			return True
		def scroll_event_cb(widget, event):
			if event.direction == gtk.gdk.SCROLL_UP:
				self._slimp3.cmd_volup()
			elif event.direction == gtk.gdk.SCROLL_DOWN:
				self._slimp3.cmd_voldown()
			return True
		self.lcd_display.set_button_press_event_cb(button_press_cb)
		self.lcd_display.set_scroll_event_cb(scroll_event_cb)

	def _setup_callbacks(self):
		HANDLERS_AND_METHODS = {
			"gtk_main_quit": self._quit,
			"on_about": self._on_about,
			"on_preferences": self._on_preferences,
			"on_play": self._on_play,
			"on_pause": self._on_pause,
			"on_fwd": self._on_fwd,
			"on_rew": self._on_rew,
			"on_power": self._on_power,
			"on_zoom_in": self._on_zoom_in,
			"on_zoom_out": self._on_zoom_out,
		}
		self._wTree.signal_autoconnect(HANDLERS_AND_METHODS)
		self._window.connect("key_press_event", self._key_pressed)

	def _set_zoom_factor(self, factor):
		if factor not in [1, 2]:
			return
		self.lcd_display.set_zoom_factor(factor)
		self._prefs.save_zoom_factor(factor)
		if factor == 1:
			self._menu_edit_zoom_in.set_sensitive(True)
			self._menu_edit_zoom_out.set_sensitive(False)
		else:
			self._menu_edit_zoom_in.set_sensitive(False)
			self._menu_edit_zoom_out.set_sensitive(True)

class About(Window):
	"About Window"

	def __init__(self):
		"Instantiate the window"
		Window.__init__(self, "about")

	def on_close(self, *args):
		"Close the window"
		self._window.destroy()

	def _setup_callbacks(self):
		HANDLERS_AND_METHODS = {
			"on_close": self.on_close,
		}
		self._wTree.signal_autoconnect(HANDLERS_AND_METHODS)

class Preferences(Window):
	"""Handle user preferences

	Instance attributes:

	  self.use_broadcast: boolean value 
	  self.server_hostname: hostname of the slimp3 server
	  self.server_port: UDP port on which the slimp3 server listens
	  self.player_cmdline: command line of the backend mpeg player
	  self.zoom_factor: zoom factor of the LCD display
	"""

	def __init__(self):
		"Instantiate the window"
		self._modified_server_cb = None
		self._modified_player_cb = None
		self._modified_volume_control_cb = None
		self._cfgfile = os.path.expanduser("~/.gslimp3rc")
		self._cp = ConfigParser.ConfigParser()
		self.use_broadcast = False
		self.server_hostname = ""
		self.server_port = ""
		self.player_cmdline = ""
		self.zoom_factor = 1
		self.volume_control = True

	def load(self):
		"Load the preferences from the preference file"
		try:
			file = open(self._cfgfile)
			self._cp.readfp(file)
			file.close()
			self.use_broadcast = self._cp.getboolean("global", "use_broadcast")
			self.server_hostname = self._cp.get("global", "server_hostname")
			self.server_port = self._cp.getint("global", "server_port")
			self.player_cmdline = self._cp.get("global", "player_cmdline")
			self.zoom_factor = self._cp.getint("global", "zoom_factor")
			self.volume_control = self._cp.getboolean("global", "volume_control")
		except IOError:
			print >>sys.stderr, "Can't open config file '%s'." % self._cfgfile
			print >>sys.stderr, "Use default values"
			self._reset()
			self.load()
		except:
			print >>sys.stderr, "Parsing error while reading config file."
			print >>sys.stderr, "Use default values"
			self._reset()
			self.load()

	def show(self):
		"Show the window"
		Window.__init__(self, "preferences")
		self._radio_use_broadcast = self._wTree.get_widget('radio_use_broadcast')
		self._radio_static = self._wTree.get_widget('radio_static')
		self._entry_player_cmdline = self._wTree.get_widget('entry_player_cmdline')
		self._check_volume_control = self._wTree.get_widget('check_volume_control')
		for prefix in ["label", "entry"]:
			for name in ["server_hostname", "server_port"]:
				exec "self._%s_%s = self._wTree.get_widget('%s_%s')" \
						% (prefix, name, prefix, name)
		self.load()
		if self.use_broadcast:
			self._radio_use_broadcast.set_active(True)
		else:
			self._radio_static.set_active(True)
		self._entry_server_hostname.set_text(self.server_hostname)
		self._entry_server_port.set_text(str(self.server_port))
		self._entry_player_cmdline.set_text(self.player_cmdline)
		self._check_volume_control.set_active(self.volume_control)
		self._update_sensitive()

	def save_zoom_factor(self, factor):
		"Save the zoom factor in the preference file"
		self.load()
		self._cp.set("global", "zoom_factor", "%d" % factor)
		self._save_cfgfile()

	def set_modified_server_cb(self, cb):
		"Setup a callback when the server settings are modified"
		self._modified_server_cb = cb

	def set_modified_player_cb(self, cb):
		"Setup a callback when the backend player is modified"
		self._modified_player_cb = cb

	def set_modified_volume_control_cb(self, cb):
		"Setup a callback when the volume control is modified"
		self._modified_volume_control_cb = cb

	def _setup_callbacks(self):
		HANDLERS_AND_METHODS = {
			"on_toggled": self._on_toggled,
			"on_close": self._on_close,
			"on_cancel": self._on_cancel,
			"on_ok": self._on_ok,
		}
		self._wTree.signal_autoconnect(HANDLERS_AND_METHODS)

	def _on_toggled(self, button):
		self._update_sensitive()

	def _update_sensitive(self):
		sensitive = self._radio_static.get_active()
		for prefix in ["label", "entry"]:
			for name in ["server_hostname", "server_port"]:
				exec "self._%s_%s.set_sensitive(%s)" % (prefix, name, sensitive)

	def _on_close(self, *args):
		self._window.destroy()

	def _on_cancel(self, *args):
		self._window.destroy()

	def _on_ok(self, *args):
		self._save()
		self._window.destroy()

	def _save(self):
		try:
			server_port = int(self._entry_server_port.get_text())
			if server_port < 0 or server_port > 65535:
				raise ValueError
		except ValueError:
			print >>sys.stderr, "Invalid port number: %s" % server_port
			return
		use_broadcast = self._radio_use_broadcast.get_active()
		server_hostname = self._entry_server_hostname.get_text()
		player_cmdline = self._entry_player_cmdline.get_text().rstrip()
		volume_control = self._check_volume_control.get_active()

		if (use_broadcast != self.use_broadcast 
			or server_hostname != self.server_hostname
			or server_port != self.server_port) and self._modified_server_cb:
			self._modified_server_cb(use_broadcast, server_hostname, server_port)

		if player_cmdline != self.player_cmdline and self._modified_player_cb:
			self._modified_player_cb(player_cmdline)

		if volume_control != self.volume_control and self._modified_volume_control_cb:
			self._modified_volume_control_cb(volume_control)

		for field in ["use_broadcast", "server_hostname",
					"server_port", "player_cmdline", "volume_control"]:
			exec "self.%s = %s" % (field, field)
			exec "self._cp.set(\"global\", \"%s\", self.%s)" % (field, field)
		self._save_cfgfile()

	def _save_cfgfile(self):
		try:
			file = open(self._cfgfile, 'w')
			self._cp.write(file)
			file.close()
		except:
			print >>sys.stderr, "Can't save preferences in '%s'." % self._cfgfile

	def _reset(self):
		file = open(self._cfgfile, "w")
		file.write("""\
[global]
use_broadcast = False
server_hostname = localhost
server_port = 3483
player_cmdline = madplay -Q -
zoom_factor = 1
volume_control = 1
""")
		file.close()

if __name__ == "__main__":
	if len(sys.argv) > 1:
		print >>sys.stderr, "Usage: %s\nSlimp3 client written in python." \
				% sys.argv[0]
		sys.exit(1)
	app = Slimp3Gui()
	app.run()

# vim: ts=4 sw=4 noet

Added gslimp3.1.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
.TH GSLIMP3 1 "October 2005" "gslimp3 @VERSION@" "User Commands"
.SH NAME
gslimp3 \- SLIMP3 player emulator
.SH SYNOPSIS
.B gslimp3
.SH DESCRIPTION
.B gslimp3
is a SLIMP3 player emulator, using the SLIMP3 Client Protocol.
.PP
.B gslimp3
needs a MPEG player to play the MPEG stream. This player must be specified
in the application preferences. It will receive the MPEG stream from 
its standard input.
.PP
madplay is a good candidate to fullfill this task:
.IP
madplay -Q -
.PP
If esd is used, then use this instead:
.IP
madplay --output=esd:localhost -Q -
.SH SHORTCUTS
The following shortcuts are used to simulate keys of the Squeezebox
remote controler:
.TS
l l
____
lB l.
Keyboard Key	Squeezebox remote controller key
0	0
1	1
2	2
3	3
4	4
5	5
6	6
7	7
8	8
9	9
UP	Up
RIGHT	Right
DOWN	Down
LEFT	Left
HOME	Now playing
PAGE UP	Volume up
PAGE DOWN	Volume down
ENTER	Play
SPACE	Pause
[	Rew
]	Fwd
+	Add
/	Search
A	Sleep
B	Brightness
F	Size
R	Repeat
S	Shuffle
.TE

Some mouse events on the LCD display are also used:
.TS
l l
____
lB l.
Mouse event	Squeezebox remote controller key
Left button pressed	Now playing
Mouse wheel up	Volume up
Mouse wheel down	Volume down
.TE
.SH TODO
Add LIRC support
.SH AUTHOR
Written by Gerome Fournier <jef@foutaise.org>.
.SH COPYRIGHT
Copyright \(co 2005 Gerome Fournier.
.br
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Added gslimp3.glade.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
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
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
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
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
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
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="gslimp3">
  <property name="visible">True</property>
  <property name="title" translatable="yes">gslimp3</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">False</property>
  <property name="destroy_with_parent">True</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_CENTER</property>
  <accessibility>
    <atkproperty name="AtkObject::accessible_name" translatable="yes">window1</atkproperty>
  </accessibility>
  <signal name="destroy" handler="gtk_main_quit" last_modification_time="Wed, 08 Dec 2004 12:36:34 GMT"/>

  <child>
    <widget class="GtkVBox" id="vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child>
	<widget class="GtkMenuBar" id="menubar1">
	  <property name="visible">True</property>

	  <child>
	    <widget class="GtkMenuItem" id="menuitem4">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">_File</property>
	      <property name="use_underline">True</property>

	      <child>
		<widget class="GtkMenu" id="menuitem4_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="quit1">
		      <property name="visible">True</property>
		      <property name="label">gtk-quit</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="gtk_main_quit" last_modification_time="Wed, 08 Dec 2004 10:11:56 GMT"/>
		      <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="edit2">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">_Edit</property>
	      <property name="use_underline">True</property>

	      <child>
		<widget class="GtkMenu" id="edit2_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="zoom_in">
		      <property name="visible">True</property>
		      <property name="label">gtk-zoom-in</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="on_zoom_in" last_modification_time="Mon, 13 Jun 2005 15:50:20 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="zoom_out">
		      <property name="visible">True</property>
		      <property name="label">gtk-zoom-out</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="on_zoom_out" last_modification_time="Mon, 13 Jun 2005 15:50:20 GMT"/>
		    </widget>
		  </child>

		  <child>
		    <widget class="GtkImageMenuItem" id="preferences1">
		      <property name="visible">True</property>
		      <property name="label">gtk-preferences</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="on_preferences" last_modification_time="Mon, 13 Jun 2005 15:50:20 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkMenuItem" id="menuitem7">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">_Help</property>
	      <property name="use_underline">True</property>

	      <child>
		<widget class="GtkMenu" id="menuitem7_menu">

		  <child>
		    <widget class="GtkImageMenuItem" id="about1">
		      <property name="visible">True</property>
		      <property name="label">gtk-about</property>
		      <property name="use_stock">True</property>
		      <signal name="activate" handler="on_about" last_modification_time="Tue, 19 Apr 2005 20:07:29 GMT"/>
		    </widget>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">False</property>
	</packing>
      </child>

      <child>
	<widget class="GtkHBox" id="hbox2">
	  <property name="border_width">5</property>
	  <property name="visible">True</property>
	  <property name="homogeneous">False</property>
	  <property name="spacing">0</property>

	  <child>
	    <widget class="GtkVBox" id="vbox6">
	      <property name="visible">True</property>
	      <property name="homogeneous">False</property>
	      <property name="spacing">2</property>

	      <child>
		<widget class="GtkDrawingArea" id="lcddisplay">
		  <property name="visible">True</property>
		</widget>
		<packing>
		  <property name="padding">0</property>
		  <property name="expand">False</property>
		  <property name="fill">False</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkHBox" id="hbox4">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkButton" id="button4">
		      <property name="visible">True</property>
		      <property name="tooltip" translatable="yes">Previous</property>
		      <property name="can_focus">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="on_rew" last_modification_time="Tue, 17 May 2005 18:24:49 GMT"/>

		      <child>
			<widget class="GtkImage" id="image9">
			  <property name="visible">True</property>
			  <property name="stock">gtk-media-previous</property>
			  <property name="icon_size">4</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button5">
		      <property name="visible">True</property>
		      <property name="tooltip" translatable="yes">Play</property>
		      <property name="can_focus">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="on_play" last_modification_time="Tue, 19 Apr 2005 20:00:45 GMT"/>

		      <child>
			<widget class="GtkImage" id="image5">
			  <property name="visible">True</property>
			  <property name="stock">gtk-media-play</property>
			  <property name="icon_size">4</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button6">
		      <property name="visible">True</property>
		      <property name="tooltip" translatable="yes">Pause</property>
		      <property name="can_focus">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="on_pause" last_modification_time="Tue, 19 Apr 2005 20:01:00 GMT"/>

		      <child>
			<widget class="GtkImage" id="image6">
			  <property name="visible">True</property>
			  <property name="stock">gtk-media-pause</property>
			  <property name="icon_size">4</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button8">
		      <property name="visible">True</property>
		      <property name="tooltip" translatable="yes">Next</property>
		      <property name="can_focus">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="on_fwd" last_modification_time="Tue, 17 May 2005 18:25:02 GMT"/>

		      <child>
			<widget class="GtkImage" id="image8">
			  <property name="visible">True</property>
			  <property name="stock">gtk-media-next</property>
			  <property name="icon_size">4</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkAlignment" id="alignment1">
		      <property name="visible">True</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xscale">1</property>
		      <property name="yscale">1</property>
		      <property name="top_padding">0</property>
		      <property name="bottom_padding">0</property>
		      <property name="left_padding">0</property>
		      <property name="right_padding">0</property>

		      <child>
			<widget class="GtkEventBox" id="eventbox1">
			  <property name="visible">True</property>
			  <property name="visible_window">True</property>
			  <property name="above_child">False</property>

			  <child>
			    <placeholder/>
			  </child>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkButton" id="button9">
		      <property name="visible">True</property>
		      <property name="tooltip" translatable="yes">Power</property>
		      <property name="can_focus">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <signal name="clicked" handler="on_power" last_modification_time="Tue, 17 May 2005 17:54:18 GMT"/>

		      <child>
			<widget class="GtkImage" id="image10">
			  <property name="visible">True</property>
			  <property name="stock">gtk-media-record</property>
			  <property name="icon_size">4</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xpad">0</property>
			  <property name="ypad">0</property>
			</widget>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>
		</widget>
		<packing>
		  <property name="padding">3</property>
		  <property name="expand">False</property>
		  <property name="fill">False</property>
		</packing>
	      </child>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">True</property>
	      <property name="fill">True</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

<widget class="GtkDialog" id="about">
  <property name="visible">True</property>
  <property name="title" translatable="yes">About...</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">True</property>
  <property name="resizable">False</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <property name="has_separator">True</property>
  <accessibility>
    <atkproperty name="AtkObject::accessible_name" translatable="yes">dialog</atkproperty>
  </accessibility>

  <child internal-child="vbox">
    <widget class="GtkVBox" id="dialog-vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child internal-child="action_area">
	<widget class="GtkHButtonBox" id="dialog-action_area1">
	  <property name="visible">True</property>
	  <property name="layout_style">GTK_BUTTONBOX_END</property>

	  <child>
	    <widget class="GtkButton" id="okbutton1">
	      <property name="visible">True</property>
	      <property name="can_default">True</property>
	      <property name="can_focus">True</property>
	      <property name="label">gtk-ok</property>
	      <property name="use_stock">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <property name="response_id">-5</property>
	      <signal name="clicked" handler="on_close" last_modification_time="Wed, 20 Apr 2005 08:37:10 GMT"/>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">True</property>
	  <property name="pack_type">GTK_PACK_END</property>
	</packing>
      </child>

      <child>
	<widget class="GtkHBox" id="hbox1">
	  <property name="visible">True</property>
	  <property name="homogeneous">False</property>
	  <property name="spacing">0</property>

	  <child>
	    <widget class="GtkVBox" id="vbox3">
	      <property name="border_width">5</property>
	      <property name="visible">True</property>
	      <property name="homogeneous">False</property>
	      <property name="spacing">0</property>

	      <child>
		<widget class="GtkNotebook" id="notebook1">
		  <property name="visible">True</property>
		  <property name="can_focus">True</property>
		  <property name="show_tabs">True</property>
		  <property name="show_border">True</property>
		  <property name="tab_pos">GTK_POS_TOP</property>
		  <property name="scrollable">False</property>
		  <property name="enable_popup">False</property>

		  <child>
		    <widget class="GtkLabel" id="label2">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">&lt;span size=&quot;16000&quot;&gt;&lt;b&gt;gslimp3 @VERSION@&lt;/b&gt;&lt;/span&gt;

&lt;small&gt;(C) 2005-2006 Gérôme Fournier&lt;/small&gt;</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">True</property>
		      <property name="justify">GTK_JUSTIFY_CENTER</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">5</property>
		      <property name="ypad">5</property>
		    </widget>
		    <packing>
		      <property name="tab_expand">False</property>
		      <property name="tab_fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkLabel" id="label_about">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">About</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">False</property>
		      <property name="justify">GTK_JUSTIFY_LEFT</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">0</property>
		      <property name="ypad">0</property>
		    </widget>
		    <packing>
		      <property name="type">tab</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkLabel" id="label7">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">&lt;b&gt;Paul Warren&lt;/b&gt;, for his slimp3slave client,
which helped to dig the Slimp3 client 
protocol.

&lt;b&gt;Douglas De Couto&lt;/b&gt;, for his TripleFat client,
which helped to understand how LCD
messages are packed.</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">True</property>
		      <property name="justify">GTK_JUSTIFY_LEFT</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">5</property>
		      <property name="ypad">5</property>
		    </widget>
		    <packing>
		      <property name="tab_expand">False</property>
		      <property name="tab_fill">True</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkLabel" id="label_credits">
		      <property name="visible">True</property>
		      <property name="label" translatable="yes">Credits</property>
		      <property name="use_underline">False</property>
		      <property name="use_markup">False</property>
		      <property name="justify">GTK_JUSTIFY_LEFT</property>
		      <property name="wrap">False</property>
		      <property name="selectable">False</property>
		      <property name="xalign">0.5</property>
		      <property name="yalign">0.5</property>
		      <property name="xpad">0</property>
		      <property name="ypad">0</property>
		    </widget>
		    <packing>
		      <property name="type">tab</property>
		    </packing>
		  </child>
		</widget>
		<packing>
		  <property name="padding">0</property>
		  <property name="expand">False</property>
		  <property name="fill">False</property>
		</packing>
	      </child>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">False</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

<widget class="GtkDialog" id="preferences">
  <property name="visible">True</property>
  <property name="title" translatable="yes">Preferences</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">True</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <property name="has_separator">True</property>

  <child internal-child="vbox">
    <widget class="GtkVBox" id="dialog-vbox2">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child internal-child="action_area">
	<widget class="GtkHButtonBox" id="dialog-action_area2">
	  <property name="visible">True</property>
	  <property name="layout_style">GTK_BUTTONBOX_END</property>

	  <child>
	    <widget class="GtkButton" id="cancelbutton1">
	      <property name="visible">True</property>
	      <property name="can_default">True</property>
	      <property name="can_focus">True</property>
	      <property name="label">gtk-cancel</property>
	      <property name="use_stock">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <property name="response_id">-6</property>
	      <signal name="clicked" handler="on_cancel" last_modification_time="Mon, 23 May 2005 11:41:08 GMT"/>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkButton" id="okbutton2">
	      <property name="visible">True</property>
	      <property name="can_default">True</property>
	      <property name="can_focus">True</property>
	      <property name="label">gtk-ok</property>
	      <property name="use_stock">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <property name="response_id">-5</property>
	      <signal name="clicked" handler="on_ok" last_modification_time="Mon, 23 May 2005 11:41:17 GMT"/>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">True</property>
	  <property name="pack_type">GTK_PACK_END</property>
	</packing>
      </child>

      <child>
	<widget class="GtkFrame" id="Server settings">
	  <property name="border_width">5</property>
	  <property name="visible">True</property>
	  <property name="label_xalign">0</property>
	  <property name="label_yalign">0.5</property>
	  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>

	  <child>
	    <widget class="GtkAlignment" id="alignment2">
	      <property name="visible">True</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xscale">1</property>
	      <property name="yscale">1</property>
	      <property name="top_padding">0</property>
	      <property name="bottom_padding">5</property>
	      <property name="left_padding">12</property>
	      <property name="right_padding">12</property>

	      <child>
		<widget class="GtkVBox" id="vbox7">
		  <property name="visible">True</property>
		  <property name="homogeneous">False</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkRadioButton" id="radio_use_broadcast">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">broadcasting mode</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <property name="active">False</property>
		      <property name="inconsistent">False</property>
		      <property name="draw_indicator">True</property>
		      <signal name="toggled" handler="on_toggled" last_modification_time="Mon, 23 May 2005 12:55:02 GMT"/>
		      <signal name="activate" handler="on_toggled" last_modification_time="Mon, 23 May 2005 13:47:47 GMT"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkRadioButton" id="radio_static">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">use specific server:</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <property name="active">False</property>
		      <property name="inconsistent">False</property>
		      <property name="draw_indicator">True</property>
		      <property name="group">radio_use_broadcast</property>
		      <signal name="toggled" handler="on_toggled" last_modification_time="Mon, 23 May 2005 12:55:15 GMT"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">False</property>
		    </packing>
		  </child>

		  <child>
		    <widget class="GtkTable" id="table1">
		      <property name="visible">True</property>
		      <property name="n_rows">2</property>
		      <property name="n_columns">2</property>
		      <property name="homogeneous">False</property>
		      <property name="row_spacing">2</property>
		      <property name="column_spacing">0</property>

		      <child>
			<widget class="GtkAlignment" id="alignment3">
			  <property name="visible">True</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xscale">1</property>
			  <property name="yscale">1</property>
			  <property name="top_padding">0</property>
			  <property name="bottom_padding">0</property>
			  <property name="left_padding">25</property>
			  <property name="right_padding">0</property>

			  <child>
			    <widget class="GtkLabel" id="label_server_hostname">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes">Hostname:</property>
			      <property name="use_underline">False</property>
			      <property name="use_markup">False</property>
			      <property name="justify">GTK_JUSTIFY_LEFT</property>
			      <property name="wrap">False</property>
			      <property name="selectable">False</property>
			      <property name="xalign">0</property>
			      <property name="yalign">0.5</property>
			      <property name="xpad">0</property>
			      <property name="ypad">0</property>
			    </widget>
			  </child>
			</widget>
			<packing>
			  <property name="left_attach">0</property>
			  <property name="right_attach">1</property>
			  <property name="top_attach">0</property>
			  <property name="bottom_attach">1</property>
			  <property name="y_options">fill</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkAlignment" id="alignment4">
			  <property name="visible">True</property>
			  <property name="xalign">0.5</property>
			  <property name="yalign">0.5</property>
			  <property name="xscale">1</property>
			  <property name="yscale">1</property>
			  <property name="top_padding">0</property>
			  <property name="bottom_padding">0</property>
			  <property name="left_padding">0</property>
			  <property name="right_padding">0</property>

			  <child>
			    <widget class="GtkAlignment" id="alignment5">
			      <property name="visible">True</property>
			      <property name="xalign">0.5</property>
			      <property name="yalign">0.5</property>
			      <property name="xscale">1</property>
			      <property name="yscale">1</property>
			      <property name="top_padding">0</property>
			      <property name="bottom_padding">0</property>
			      <property name="left_padding">25</property>
			      <property name="right_padding">0</property>

			      <child>
				<widget class="GtkLabel" id="label_server_port">
				  <property name="visible">True</property>
				  <property name="label" translatable="yes">Port:</property>
				  <property name="use_underline">False</property>
				  <property name="use_markup">False</property>
				  <property name="justify">GTK_JUSTIFY_LEFT</property>
				  <property name="wrap">False</property>
				  <property name="selectable">False</property>
				  <property name="xalign">0</property>
				  <property name="yalign">0.5</property>
				  <property name="xpad">0</property>
				  <property name="ypad">0</property>
				</widget>
			      </child>
			    </widget>
			  </child>
			</widget>
			<packing>
			  <property name="left_attach">0</property>
			  <property name="right_attach">1</property>
			  <property name="top_attach">1</property>
			  <property name="bottom_attach">2</property>
			  <property name="x_options">fill</property>
			  <property name="y_options">fill</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkEntry" id="entry_server_hostname">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="editable">True</property>
			  <property name="visibility">True</property>
			  <property name="max_length">0</property>
			  <property name="text" translatable="yes"></property>
			  <property name="has_frame">True</property>
			  <property name="invisible_char">*</property>
			  <property name="activates_default">False</property>
			</widget>
			<packing>
			  <property name="left_attach">1</property>
			  <property name="right_attach">2</property>
			  <property name="top_attach">0</property>
			  <property name="bottom_attach">1</property>
			  <property name="y_options"></property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkEntry" id="entry_server_port">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="editable">True</property>
			  <property name="visibility">True</property>
			  <property name="max_length">0</property>
			  <property name="text" translatable="yes"></property>
			  <property name="has_frame">True</property>
			  <property name="invisible_char">*</property>
			  <property name="activates_default">False</property>
			</widget>
			<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>
			  <property name="y_options"></property>
			</packing>
		      </child>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">True</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="label3">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">&lt;b&gt;Server settings&lt;/b&gt;</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">True</property>
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">0</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="type">label_item</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">True</property>
	</packing>
      </child>

      <child>
	<widget class="GtkFrame" id="frame1">
	  <property name="border_width">5</property>
	  <property name="visible">True</property>
	  <property name="label_xalign">0</property>
	  <property name="label_yalign">0.5</property>
	  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>

	  <child>
	    <widget class="GtkAlignment" id="alignment6">
	      <property name="visible">True</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xscale">1</property>
	      <property name="yscale">1</property>
	      <property name="top_padding">5</property>
	      <property name="bottom_padding">5</property>
	      <property name="left_padding">12</property>
	      <property name="right_padding">12</property>

	      <child>
		<widget class="GtkEntry" id="entry_player_cmdline">
		  <property name="visible">True</property>
		  <property name="can_focus">True</property>
		  <property name="editable">True</property>
		  <property name="visibility">True</property>
		  <property name="max_length">0</property>
		  <property name="text" translatable="yes"></property>
		  <property name="has_frame">True</property>
		  <property name="invisible_char">*</property>
		  <property name="activates_default">False</property>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="label4">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">&lt;b&gt;MP3 player command&lt;/b&gt;</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">True</property>
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">0</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="type">label_item</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>

      <child>
	<widget class="GtkFrame" id="Volume control">
	  <property name="border_width">5</property>
	  <property name="visible">True</property>
	  <property name="label_xalign">0</property>
	  <property name="label_yalign">0.5</property>
	  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>

	  <child>
	    <widget class="GtkAlignment" id="alignment7">
	      <property name="visible">True</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xscale">1</property>
	      <property name="yscale">1</property>
	      <property name="top_padding">0</property>
	      <property name="bottom_padding">0</property>
	      <property name="left_padding">12</property>
	      <property name="right_padding">0</property>

	      <child>
		<widget class="GtkHBox" id="hbox5">
		  <property name="visible">True</property>
		  <property name="homogeneous">True</property>
		  <property name="spacing">0</property>

		  <child>
		    <widget class="GtkCheckButton" id="check_volume_control">
		      <property name="visible">True</property>
		      <property name="can_focus">True</property>
		      <property name="label" translatable="yes">gslimp3 handles volume control</property>
		      <property name="use_underline">True</property>
		      <property name="relief">GTK_RELIEF_NORMAL</property>
		      <property name="focus_on_click">True</property>
		      <property name="active">False</property>
		      <property name="inconsistent">False</property>
		      <property name="draw_indicator">True</property>
		      <signal name="toggled" handler="on_volume_control_toggled" last_modification_time="Fri, 15 Sep 2006 19:42:13 GMT"/>
		    </widget>
		    <packing>
		      <property name="padding">0</property>
		      <property name="expand">False</property>
		      <property name="fill">True</property>
		    </packing>
		  </child>
		</widget>
	      </child>
	    </widget>
	  </child>

	  <child>
	    <widget class="GtkLabel" id="label8">
	      <property name="visible">True</property>
	      <property name="label" translatable="yes">&lt;b&gt;Volume control&lt;/b&gt;</property>
	      <property name="use_underline">False</property>
	      <property name="use_markup">True</property>
	      <property name="justify">GTK_JUSTIFY_LEFT</property>
	      <property name="wrap">False</property>
	      <property name="selectable">False</property>
	      <property name="xalign">0.5</property>
	      <property name="yalign">0.5</property>
	      <property name="xpad">0</property>
	      <property name="ypad">0</property>
	    </widget>
	    <packing>
	      <property name="type">label_item</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

Added imgs/gslimp3-preferences.png.

cannot compute difference between binary files

Added imgs/gslimp3.png.

cannot compute difference between binary files

Added lcd_chars.txt.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
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
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
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
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
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
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
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
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
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
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
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
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
# Character set for the Squeezebox display

00
00000
00000
00000
00000
00000
00000
00000

01
00000
00000
00000
00000
00000
00000
00000

02
00000
00000
00000
00000
00000
00000
00000

03
00000
00000
00000
00000
00000
00000
00000

04
00000
00000
00000
00000
00000
00000
00000

05
00000
00000
00000
00000
00000
00000
00000

06
00000
00000
00000
00000
00000
00000
00000

07
00000
00000
00000
00000
00000
00000
00000

08
00000
00000
00000
00000
00000
00000
00000

09
00000
00000
00000
00000
00000
00000
00000

0a
00000
00000
00000
00000
00000
00000
00000

0b
00000
00000
00000
00000
00000
00000
00000

0c
00000
00000
00000
00000
00000
00000
00000

0d
00000
00000
00000
00000
00000
00000
00000

0e
00000
00000
00000
00000
00000
00000
00000

0f
00000
00000
00000
00000
00000
00000
00000

10
10000
10000
10000
10000
10000
10000
10000

11
11000
11000
11000
11000
11000
11000
11000

12
11100
11100
11100
11100
11100
11100
11100

13
11110
11110
11110
11110
11110
11110
11110

14
11111
11111
11111
11111
11111
11111
11111

15
01111
01111
01111
01111
01111
01111
01111

16
00111
00111
00111
00111
00111
00111
00111

17
00011
00011
00011
00011
00011
00011
00011

18
00001
00001
00001
00001
00001
00001
00001

19
00100
00110
00101
00101
01101
11100
01100

1a
11000
11000
00000
00111
01000
01000
00111

1b
11000
11000
00000
01111
01000
01110
01000

1c
00000
00000
11111
01110
00100
00000
00000

1d
00000
01000
01100
01110
01100
01000
00000

1e
00000
00010
00110
01110
00110
00010
00000

1f
00000
00000
00100
01110
11111
00000
00000

20
00000
00000
00000
00000
00000
00000
00000

21
00100
00100
00100
00100
00000
00000
00100

22
01010
01010
01010
00000
00000
00000
00000

23
01010
01010
11111
01010
11111
01010
01010

24
00100
01111
10100
01110
00101
11110
00100

25
11000
11001
00010
00100
01000
10011
00011

26
01100
10010
10100
01000
10101
10010
01101

27
01100
00100
01000
00000
00000
00000
00000

28
00010
00100
01000
01000
01000
00100
00010

29
10000
01000
00100
00100
00100
01000
10000

2a
00000
00100
10101
01110
10101
00100
00000

2b
00000
00100
00100
11111
00100
00100
00000

2c
00000
00000
00000
00000
01100
00100
01000

2d
00000
00000
00000
11111
00000
00000
00000

2e
00000
00000
00000
00000
00000
11000
11000

2f
00000
00001
00010
00100
01000
10000
00000

30
01110
10001
10011
10101
11001
10001
01110

31
00100
01100
00100
00100
00100
00100
01110

32
01110
10001
00001
00010
00100
01000
11111

33
11111
00010
00100
00010
00001
10001
01110

34
00010
00110
01010
10010
11111
00010
00010

35
11111
10000
11110
00001
00001
10001
01110

36
00110
01000
10000
11110
10001
10001
01110

37
11111
00001
00010
00100
01000
01000
01000

38
01110
10001
10001
01110
10001
10001
01110

39
01110
10001
10001
01111
00001
00010
01100

3a
00000
01100
01100
00000
01100
01100
00000

3b
00000
01100
01100
00000
01100
00100
01000

3c
00010
00100
01000
10000
01000
00100
00010

3d
00000
00000
11111
00000
11111
00000
00000

3e
10000
01000
00100
00010
00100
01000
10000

3f
01110
10001
00001
00010
00100
00000
00100

40
01110
10001
00001
01101
10101
10101
01110

41
01110
10001
10001
10001
11111
10001
10001

42
11110
10001
10001
11110
10001
10001
11110

43
01110
10001
10000
10000
10000
10001
01110

44
11100
10010
10001
10001
10001
10010
11100

45
11111
10000
10000
11110
10000
10000
11111

46
11111
10000
10000
11110
10000
10000
10000

47
01110
10001
10000
10111
10001
10001
01111

48
10001
10001
10001
11111
10001
10001
10001

49
01110
00100
00100
00100
00100
00100
01110

4a
00111
00010
00010
00010
00010
10010
01100

4b
10001
10010
10100
11000
10100
10010
10001

4c
10000
10000
10000
10000
10000
10000
11111

4d
10001
11011
10101
10101
10001
10001
10001

4e
10001
10001
11001
10101
10011
10001
10001

4f
01110
10001
10001
10001
10001
10001
01110

50
11110
10001
10001
11110
10000
10000
10000

51
01110
10001
10001
10001
10101
10010
01101

52
11110
10001
10001
11110
10100
10010
10001

53
01111
10000
10000
01110
00001
00001
11110

54
11111
00100
00100
00100
00100
00100
00100

55
10001
10001
10001
10001
10001
10001
01110

56
10001
10001
10001
10001
10001
01010
00100

57
10001
10001
10001
10101
10101
10101
01010

58
10001
10001
01010
00100
01010
10001
10001

59
10001
10001
10001
01010
00100
00100
00100

5a
11111
00001
00010
00100
01000
10000
11111

5b
01110
01000
01000
01000
01000
01000
01110

5c
10001
01010
11111
00100
11111
00100
00100

5d
01110
00010
00010
00010
00010
00010
01110

5e
00100
01010
10001
00000
00000
00000
00000

5f
00000
00000
00000
00000
00000
00000
11111

60
01000
00100
00010
00000
00000
00000
00000

61
00000
00000
01110
00001
01111
10001
01111

62
10000
10000
10000
10110
11001
10001
11110

63
00000
00000
01110
10000
10000
10001
01110

64
00001
00001
00001
01101
10011
10001
01111

65
00000
00000
01110
10001
11111
10000
01110

66
00110
01001
01000
11100
01000
01000
01000

67
00000
01111
10001
10001
01111
00001
01110

68
10000
10000
10110
11001
10001
10001
10001

69
00000
00100
00000
01100
00100
00100
01110

6a
00010
00000
00110
00010
00010
10010
01100

6b
01000
01000
01001
01010
01100
01010
01001

6c
01100
00100
00100
00100
00100
00100
01110

6d
00000
00000
11010
10101
10101
10001
10001

6e
00000
00000
10110
11001
10001
10001
10001

6f
00000
00000
01110
10001
10001
10001
01110

70
00000
00000
11110
10001
11110
10000
10000

71
00000
00000
01101
10011
01111
00001
00001

72
00000
00000
10110
11001
10000
10000
10000

73
00000
00000
01110
10000
01110
00001
11110

74
01000
01000
11100
01000
01000
01001
00110

75
00000
00000
10001
10001
10001
10011
01101

76
00000
00000
10001
10001
10001
01010
00100

77
00000
00000
10001
10001
10001
10101
01010

78
00000
00000
10001
01010
00100
01010
10001

79
00000
00000
10001
10001
01111
00001
01110

7a
00000
00000
11111
00010
00100
01000
11111

7b
00010
00100
00100
10000
00100
00100
00010

7c
00100
00100
00100
00100
00100
00100
00100

7d
01000
00100
00100
00010
00100
00100
01000

7e
00000
00100
00010
11111
00010
00100
00000

7f
00000
00100
01000
11111
01000
00100
00000

80
01010
00000
00100
01010
10001
11111
10001

81
00100
00000
00100
01010
10001
11111
10001

82
00100
01010
00100
01010
10001
11111
10001

83
00010
00100
01110
00001
01111
10001
01111

84
00100
00000
01110
00001
01111
10001
01111

85
11111
11000
11000
11111
11000
11000
11111

86
10001
01110
10001
10001
10001
10001
01110

87
00000
01010
00000
01110
10001
10001
01110

88
00001
01110
10011
10101
11001
01110
10000

89
00000
00010
01110
10101
10101
01110
01000

8a
10001
00000
10001
10001
10001
10001
01110

8b
00000
01010
00000
10001
10001
10011
01101

8c
00000
10000
01000
00100
00010
00001
00000

8d
00001
00010
11111
00100
11111
01000
10000

8e
00000
01000
10101
10101
00010
00000
00000

8f
01111
10000
01110
10001
01110
00001
11110

90
01110
10100
10100
11111
10100
10100
10111

91
00000
00000
11010
00101
11111
10100
01011

92
00110
01001
01000
11110
01000
01000
11111

93
11100
10010
11100
10010
10111
10010
10011

94
00000
01110
11111
11111
11111
01110
00000

95
00000
01110
10001
10001
10001
01110
00000

96
00000
00100
01110
11111
01110
00100
00000

97
00000
00100
01010
10001
01010
00100
00000

98
00100
00100
00100
00000
00100
00100
00100

99
01111
10000
10000
10000
01111
00100
01000

9a
00000
00001
00011
00101
01001
10001
11111

9b
00010
00100
01000
00100
00010
00000
11111

9c
01000
00100
00010
00100
01000
00000
11111

9d
00001
00001
00101
01001
11111
01000
00100

9e
00100
01110
10101
00100
00100
00100
00100

9f
00100
00100
00100
00100
10101
01110
00100

a0
00000
00000
00000
00000
00000
00000
00000

a1
00000
00000
00000
00000
11100
10100
11100

a2
00111
00100
00100
00100
00000
00000
00000

a3
00000
00000
00000
00100
00100
00100
11100

a4
00000
00000
00000
00000
10000
01000
00100

a5
00000
00000
00000
01100
01100
00000
00000

a6
00000
11111
00001
11111
00001
00010
00100

a7
00000
00000
11111
00001
00110
00100
01000

a8
00000
00000
00010
00100
01100
10100
00100

a9
00000
00000
00100
11111
10001
00001
00110

aa
00000
00000
00000
11111
00100
00100
11111

ab
00000
00000
00010
11111
00110
01010
10010

ac
00000
00000
01000
11111
01001
01010
01000

ad
00000
00000
00000
01110
00010
00010
11111

ae
00000
00000
11110
00010
11110
00010
11110

af
00000
00000
00000
10101
101010
00001
00110

b0
00000
00000
00000
11111
00000
00000
00000

b1
11111
00001
00101
00110
00100
00100
01000

b2
00001
00010
00100
01100
10100
00100
00100

b3
00100
11111
10001
10001
00001
00010
00100

b4
00000
11111
00100
00100
00100
00100
11111

b5
00010
11111
00010
00110
01010
10010
00010

b6
01000
11111
01001
01001
01001
01001
10010

b7
00100
11111
00100
11111
00100
00100
00100

b8
00000
01111
01001
10001
00001
00010
01100

b9
01000
01111
10010
00010
00010
00010
00100

ba
00000
11111
00001
00001
00001
00001
11111

bb
01010
11111
01010
01010
00010
00100
01000

bc
00000
11000
00001
11001
00001
00010
11100

bd
00000
11111
00001
00010
00100
01010
10001

be
01000
11111
01001
01010
01000
01000
00111

bf
00000
10001
10001
01001
00001
00010
01100

c0
00000
01111
01001
10101
00011
00010
11000

c1
00010
11100
00100
11111
00100
00100
01000

c2
00000
10101
10101
10101
00001
00010
00100

c3
01110
00000
11111
00100
00100
00100
01000

c4
01000
01000
01000
01100
01010
01000
01000

c5
00100
00100
11111
00100
00100
01000
10000

c6
00000
01110
00000
00000
00000
00000
11111

c7
00000
11111
00001
01010
00100
01010
10000

c8
00100
11111
00010
00100
01110
10101
00100

c9
00010
00010
00010
00010
00010
00100
01000

ca
00000
00100
00010
10001
10001
10001
10001

cb
10000
10000
11111
10000
10000
10000
01111

cc
00000
11111
00001
00001
00001
00010
01100

cd
00000
01000
10100
00010
00001
00001
00000

ce
00100
11111
00100
00100
10101
10101
00100

cf
00000
11111
00001
00001
01010
00100
00010

d0
00000
01110
00000
01110
00000
01110
00000

d1
00000
00100
01000
10000
10001
11111
00001

d2
00000
00001
00001
01010
00100
01010
10000

d3
00000
11111
01000
11111
01000
01000
00111

d4
01000
01000
11111
01001
01010
01000
01000

d5
00000
01110
00010
00010
00010
00010
11111

d6
00000
11111
00001
11111
00001
00001
11111

d7
01110
00000
11111
00001
00001
00010
00100

d8
10010
10010
10010
10010
00010
00100
01000

d9
00000
00100
10100
10100
10101
10101
10110

da
00000
10000
10000
10001
10010
10100
11000

db
00000
11111
10001
10001
10001
10001
11111

dc
00000
11111
10001
10001
00001
00010
00100

dd
00000
11000
00000
00001
00001
00010
11100

de
00100
10010
01000
00000
00000
00000
00000

df
11100
10100
11100
00000
00000
00000
00000

e0
00000
00000
01001
10101
10010
10010
01101

e1
01010
00000
01110
00001
01111
10001
01111

e2
00000
01110
10001
11110
10001
11110
10000

e3
00000
00000
01110
10000
01100
10001
01110

e4
00000
10001
10001
10011
11101
10000
10000

e5
00000
00000
01111
10100
10010
10001
01110

e6
00000
00110
01001
10001
11110
10000
10000

e7
00000
00000
01111
10001
01111
00001
01110

e8
00000
00000
00111
00100
00100
10100
01000

e9
00010
11010
00010
00000
00000
00000
00000

ea
00000
00010
00000
00010
00010
10010
01100

eb
10100
01000
10100
00000
00000
00000
00000

ec
00000
00100
01110
10100
10101
01110
00100

ed
01000
01000
11100
01000
11100
01000
01111

ee
01110
00000
10110
11001
10001
10001
10001

ef
00000
01010
00000
01110
10001
10001
01110

f0
00000
10110
11001
10001
11110
10000
10000

f1
00000
01101
10011
10001
01111
00001
00001

f2
00000
01110
10001
11111
10001
10001
01110

f3
00000
00000
00000
01011
10101
11010
00000

f4
00000
00000
01110
10001
10001
01010
11011

f5
01010
00000
10001
10001
10001
10011
01101

f6
11111
10000
01000
00100
01000
10000
11111

f7
00000
00000
11111
01010
01010
01010
10011

f8
11111
00000
10001
01010
00100
01010
10001

f9
00000
00000
10001
10001
01111
00001
01110

fa
00000
00001
11110
00100
11111
00100
00100

fb
00000
00000
11111
01000
01111
01001
10001

fc
00000
00000
11111
10101
11111
10001
10001

fd
00000
00100
00000
11111
00000
00100
00000

fe
00000
00000
00000
00000
00000
00000
00000

ff
11111
11111
11111
11111
11111
11111
11111

Added setup.py.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/usr/bin/env python
#
# Copyright (C) 2003 Gerome Fournier
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

DESCRIPTION = "Library implementing the SLIMP3 Client protocol"

import sys

from distutils.core import setup
if sys.version < '2.2.3':
    from distutils.dist import DistributionMetadata
    DistributionMetadata.classifiers = None
    DistributionMetadata.download_url = None

setup(
    name = "slimp3",
    version = "0.8.0",
    author = "Gerome Fournier", 
    author_email = "jef(at)foutaise.org",
    url = "http://foutaise.org/code/",
    license = "GPL",
    py_modules = ["slimp3"],
    description = DESCRIPTION,
    platforms = "any",
    classifiers = [
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: GNU General Public License (GPL)',
        'Operating System :: POSIX',
        'Operating System :: MacOS',
        'Topic :: Software Development :: Libraries :: Python Modules',
		'Topic :: Multimedia',
    ]
)

Added slimp3.py.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# -*- coding: latin1 -*-
#
# Copyright (C) 2005 Gerome Fournier <jef(at)foutaise.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""SLIMP3 Client protocol implementation in python

This is a python implementation of the SLIMP3 Client protocol. Here goes a
sample usage of this library:

>>> import slimp3
>>> slimp3_client = slimp3.Slimp3Client()
>>> slimp3_client.set_server("localhost")
>>> slimp3_client.set_player("madplay -Q -")
>>> slimp3_client.connect()
>>> slimp3_client.cmd_play()
>>> slimp3_client.cmd_next()
>>> slimp3_client.cmd_stop()
>>> slimp3_client.disconnect()
"""

import os
import sys
import math
import time
import fcntl
import posix
import signal
import popen2
import socket
import select
import struct
import ossaudiodev
import cStringIO

_CLIENT_PORT = 88888
_RECV_BUF_SIZE = 65536

_IR_CODES = {
	'0': 0x76899867,
	'1': 0x7689f00f,
	'2': 0x768908f7,
	'3': 0x76898877,
	'4': 0x768948b7,
	'5': 0x7689c837,
	'6': 0x768928d7,
	'7': 0x7689a857,
	'8': 0x76896897,
	'9': 0x7689e817,
	'DOWN': 0x7689b04f,
	'LEFT': 0x7689906f,
	'RIGHT': 0x7689d02f,
	'UP': 0x7689e01f,
	'VOLDOWN': 0x768900ff,
	'VOLUP': 0x7689807f,
	'POWER': 0x768940bf,
	'REW': 0x7689c03f,
	'PAUSE': 0x768920df,
	'FWD': 0x7689a05f,
	'ADD': 0x7689609f,
	'PLAY': 0x768910ef,
	'SEARCH': 0x768958a7,
	'SHUFFLE': 0x7689d827,
	'REPEAT': 0x768938c7,
	'SLEEP': 0x7689b847,
	'NOW_PLAYING': 0x76897887,
	'SIZE': 0x7689f807,
	'BRIGHTNESS': 0x768904fb
}

def get_mac_addr(ifname):
	"Return the MAC address of interface 'ifname'" 
	SIOCGIFHWADDR = 0x8927 # magic number
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	ifr = ifname + '\0'*(32-len(ifname))
	try:
		r = fcntl.ioctl(s.fileno(), SIOCGIFHWADDR, ifr)
		addr = [ord(i) for i in r[18:24]]
	except IOError:
		addr = [0] * 6
	return addr

class RingBuffer:
	def __init__(self):
		"""Instantiate a SLIMP3's buffer chip

		Instance attributes:

		  self.rptr: read pointer
		  self.wptr: write pointer
		"""
		self._buf = cStringIO.StringIO()
		self._bufsize = 131072
		self.rptr = 0
		self.wptr = 0

	def reset(self):
		"Reset the buffer"
		self.rptr = 0

	def is_empty(self):
		"Check if the buffer is empty"
		return self.wptr == self.rptr

	def read(self, size):
		"Read 'size' bytes from the buffer"
		if self.wptr == self.rptr:
			return ""
		elif self.wptr > self.rptr:
			available_size = self.wptr - self.rptr
		else:
			available_size = self._bufsize - self.rptr
		self._buf.seek(self.rptr)
		data = self._buf.read(min(size, available_size))
		self.rptr += len(data)
		if self.rptr >= self._bufsize:
			self.rptr -= self._bufsize
		return data

	def write(self, wptr, data):
		"Write 'data' to the buffer at position 'wptr'"
		self._buf.seek(wptr)
		self._buf.write(data)
		self.wptr = wptr

class Player:
	def __init__(self, player_cmd):
		"""Instantiate a MPEG decoder
		
		This class is mainly a wrapper around an external MPEG player,
		which will read the MPEG stream from STDIN
		"""
		self._buffer = RingBuffer()
		self._player_cmd = player_cmd
		self._player_process = None

	def start(self):
		"Start the MPEG decoder"
		if not self._player_cmd or self._is_running():
			return
		try:
			self._player_process = popen2.Popen3(self._player_cmd, False, 0)
			self._player_process.fromchild.close()
		except:
			raise

	def stop(self):
		"Stop the MPEG decoder"
		if self._is_running():
			os.kill(self._player_process.pid, signal.SIGTERM)
			self._player_process.wait()
			self._player_process = None
			self._buffer.reset()

	def reset(self):
		"Reset the MPEG decoder"
		self._buffer.reset()

	def fileno(self):
		"Return the input file descriptor of the MPEG decoder"
		if self._is_running():
			return self._player_process.tochild
		else:
			return None

	def feed(self, wptr, data):
		"Feed the MPEG decoder's buffer with 'data'"
		self._buffer.write(wptr, data)

	def has_something_to_eat(self):
		"Is there any data left for the player?"
		return not self._buffer.is_empty()
	
	def eat(self):
		"Let the MPEG decoder eat a few bytes"
		if self._is_running():
			data = self._buffer.read(1400)
			if data:
				self._player_process.tochild.write(data)
				self._player_process.tochild.flush()

	def wptr(self):
		"Return the internal ring buffer write pointer value"
		return self._buffer.wptr

	def rptr(self):
		"Return the internal ring buffer read pointer value"
		return self._buffer.rptr

	def _is_running(self):
		return self._player_process and self._player_process.poll() == -1


class Packet:
	def __init__(self, string):
		"""Instantiate a Slimp3 packet
		
		Instance attributes:

		  self.header: packet header
		  self.data: packet data
		  self.code: slimp3 code inside the header
		"""
		self.header = string[:18]
		self.data = string[18:]
		self.code = string[0]

class Slimp3Client:

	_CTRL_DECODE = 0
	_CTRL_STOP = 1
	_CTRL_STOP_RESET = 3

	def __init__(self):
		"""Instanciate a Slimp3 client
		
		Instance attributes:
		
		  self.lcddata_fd:
		    file descriptor where LCD datas packets can be fetched. The
			first byte gives the length of the following packet.
		"""
		self._starttime = time.time()
		self._pid_child = None
		self._control = None
		self._mac_addr = get_mac_addr("eth0")
		self.set_server("localhost")
		self.set_server_port(3483)
		self._player = None
		self._volume_control = True
		(self.lcddata_fd, self._write_fd) = os.pipe()

	def set_player(self, player_cmd):
		"""Set the player used to play the mpeg stream
		
		The player should read the stream on STDIN
		"""
		self._player = Player(player_cmd)

	def set_server(self, hostname):
		"""Set the Slimp3 server hostname

		Might raise a socket.gaierror exception if the hostname is not valid
		"""
		try:
			self._server_addr = socket.gethostbyname(hostname)
		except socket.gaierror:
			print >>sys.stderr, "Unable to get address of '%s'" % hostname
			raise

	def set_server_port(self, port):
		"""Set the Slimp3 server port
		
		If the value is not valid, a ValueError exception is raised
		"""
		try:
			port = int(port)
			if port < 0 or port > 65535:
				raise ValueError
			self._server_port = port
		except ValueError:
			print >>sys.stderr, "Invalid port number: %s" % port
			raise

	def connect(self):
		"Connect to the Slimp3 server"
		self._create_socket()
		self._pid_child = os.fork()
		if self._pid_child == 0:
			signal.signal(signal.SIGINT, signal.SIG_DFL)
			signal.signal(signal.SIGTERM, self._sigterm_handler)
			self._mainloop()

	def disconnect(self):
		"Disconnect from the Slimp3 server"
		if self._pid_child:
			os.kill(self._pid_child, signal.SIGTERM)
			os.waitpid(self._pid_child, 0)
		self._pid_child = None

	def set_volume_control(self, bool):
		self._volume_control = bool

	for _key in _IR_CODES.keys():
		exec "def cmd_%s(self):\n\
			\"Send the '%s' IR code to the Slimp3 server\"\n\
			self._send_ir(_IR_CODES['%s'])" % (_key.lower(), _key, _key)

	def _sigterm_handler(self, *args):
		self._player.stop()
		signal.signal(signal.SIGTERM, signal.SIG_DFL)
		os.kill(os.getpid(), signal.SIGTERM)

	def _mainloop(self):
		self._send_discovery_request()
		while 1:
			read = [self._socket.fileno()]
			fileno = self._player.fileno()
			if fileno is not None and self._player.has_something_to_eat():
				write = [fileno]
			else:
				write = []
			try:
				(input, output, e) = select.select(read, write, [])
			except select.error:
				print >>sys.stderr, "Select Error!"
				sys.exit(1)
			except:
				raise
			if input:
				self._read_packet()
			elif output and self._control == self._CTRL_DECODE:
				try:
					self._player.eat()
				except IOError:
					print >>sys.stderr, "Backend player died unexpectedly!"
					self.cmd_pause()

	def _create_socket(self):
		self._socket = socket.socket(socket.AF_INET, \
				socket.SOCK_DGRAM, socket.IPPROTO_UDP)
		self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
		succeed = False
		for port in range(_CLIENT_PORT, _CLIENT_PORT + 10):
			try:
				self._socket.bind(('', port))
				succeed = True
				break
			except socket.error:
				continue
		if not succeed:
			print >>sys.stderr, "Socket creation error!"
			sys.exit(1)

	def _set_volume(self, level):
		if not self._volume_control:
			return
		if level < 0 or level > 100:
			print >>sys.stderr, "Wrong volume level: %d" % level
			return
		try:
			mixer = ossaudiodev.openmixer()
		except IOError, reason:
			print >>sys.stderr, str(reason)
			return
		if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM):
			mixer.set(ossaudiodev.SOUND_MIXER_PCM, (level, level))

	def _send_packet(self, packet):
		try:
			sent = self._socket.sendto(packet, 0, (self._server_addr,
				self._server_port))
		except socket.error, reason:
			print >>sys.stderr, reason[1]

	def _send_ack(self, seq):
		wptr = socket.htons(self._player.wptr() >> 1)
		rptr = socket.htons(self._player.rptr() >> 1)
		args = ['c5B3H6B', 'a'] + [0]*5 + [wptr, rptr, seq] + self._mac_addr
		packet = struct.pack(*args)
		self._send_packet(packet);

	def _send_hello(self):
		args = ['c17B', 'h', 1, 0x11] + [0]*9 + self._mac_addr
		packet = struct.pack(*args)
		self._send_packet(packet);

	def _send_discovery_request(self):
		args = ['c17B', 'd', 0, 1, 0x11] + [0]*8 + self._mac_addr
		packet = struct.pack(*args)
		self._send_packet(packet);

	def _send_ir(self, code):
		elapsed = time.time() - self._starttime
		ticks = long(elapsed * 625000) % 2**32
		packet = 'i\x00' + struct.pack('L', socket.htonl(ticks)) + \
			'\xff\x10' + struct.pack('L', socket.htonl(code)) + \
			''.join(["%c" % i for i in self._mac_addr])
		self._send_packet(packet);

	def _read_packet(self):
		try:
			(string, addr) = self._socket.recvfrom(_RECV_BUF_SIZE, 0)
			packet = Packet(string)
			if self._server_addr == '255.255.255.255':
				self._server_addr = addr[0]
			elif addr[0] != self._server_addr:
				print >>sys.stderr, "Got packet from wrong source: %s" % addr[0]
				return
		except:
			print >>sys.stderr, "Unable to receive datas!"
			raise

		if packet.code in ['D', 'h']:
			self._send_hello()
		elif packet.code == 'l':
			self._handle_lcd_packet(packet)
		elif packet.code == 'm':
			self._handle_mpeg_packet(packet)
		elif packet.code == '2':
			self._handle_i2c_packet(packet)
		elif packet.code == 's':
			pass

	def _handle_lcd_packet(self, packet):
		if self._write_fd:
			str = struct.pack("i", len(packet.data))
			os.write(self._write_fd, "%s%s" %(str, packet.data))

	def _handle_mpeg_packet(self, packet):
		(type, control, res1, wptr, res2, seq, res3) = \
			struct.unpack("cB4sH2sH6s", packet.header)
		if control == self._CTRL_DECODE:
			self._player.start()
		elif control == self._CTRL_STOP:
			self._player.stop()
		elif control == self._CTRL_STOP_RESET:
			self._player.stop()
			self._player.reset()
		self._control = control
		self._player.feed(socket.htons(wptr) << 1, packet.data)
		self._send_ack(seq)

	def _handle_i2c_packet(self, packet):
		# handle i2c requests for volume control
		if packet.data[:7] == "\x73\x77\x3A\x77\x68\x77\xB0":
			value = (ord(packet.data[24]) << 16) + (ord(packet.data[18]) << 8) \
					+ ord(packet.data[20])
			level = int(math.sqrt(value/(0x80000+0.0))*100)
			self._set_volume(level)

# vim: ts=4 sw=4 noet