mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 14:32:55 +01:00
playing much more nicely with unicode
--HG-- extra : convert_revision : svn%3A41726ec3-264d-0410-9c23-a9f1637257cc/trunk%40134
This commit is contained in:
parent
1cdf13ea8d
commit
b9b7508144
3 changed files with 11 additions and 7 deletions
|
|
@ -424,7 +424,7 @@ class Connection(object):
|
|||
out = NEWLINE.join(data) + NEWLINE
|
||||
|
||||
log.debug(out)
|
||||
self.client.sendall(out)
|
||||
self.client.sendall(out.encode('utf-8'))
|
||||
|
||||
line_re = re.compile(r'([^\r\n]*)(?:\r\n|\n\r|\n|\r)')
|
||||
def lines(self):
|
||||
|
|
@ -627,10 +627,10 @@ class BGServer(Server):
|
|||
"""
|
||||
|
||||
def __init__(self, library, host='127.0.0.1', port=DEFAULT_PORT):
|
||||
import beets.player.gstplayer
|
||||
from beets.player.gstplayer import GstPlayer
|
||||
super(BGServer, self).__init__(host, port)
|
||||
self.lib = library
|
||||
self.player = gstplayer.GstPlayer(self.play_finished)
|
||||
self.player = GstPlayer(self.play_finished)
|
||||
|
||||
def run(self):
|
||||
self.player.run()
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class GstPlayer(object):
|
|||
# error
|
||||
self.player.set_state(gst.STATE_NULL)
|
||||
err, debug = message.parse_error()
|
||||
print "Error: " + err
|
||||
print "Error: " + str(err)
|
||||
self.playing = False
|
||||
|
||||
def play_file(self, path):
|
||||
|
|
|
|||
10
bts
10
bts
|
|
@ -2,6 +2,10 @@
|
|||
from optparse import OptionParser
|
||||
from beets import Library
|
||||
|
||||
def _print(txt):
|
||||
"""Print the text encoded using UTF-8."""
|
||||
print txt.encode('utf-8')
|
||||
|
||||
def add(lib, paths):
|
||||
for path in paths:
|
||||
lib.add(path)
|
||||
|
|
@ -12,7 +16,7 @@ def ls(lib, criteria):
|
|||
if not q.strip():
|
||||
q = None # no criteria => match anything
|
||||
for item in lib.get(q):
|
||||
print item.artist + ' - ' + item.album + ' - ' + item.title
|
||||
_print(item.artist + ' - ' + item.album + ' - ' + item.title)
|
||||
|
||||
def imp(lib, paths):
|
||||
for path in paths:
|
||||
|
|
@ -29,7 +33,7 @@ def remove(lib, criteria):
|
|||
if not q.strip():
|
||||
raise ValueError('must provide some criteria for removing')
|
||||
for item in lib.get(q):
|
||||
print "removing " + item.path
|
||||
_print("removing " + item.path)
|
||||
item.remove()
|
||||
lib.save()
|
||||
|
||||
|
|
@ -38,7 +42,7 @@ def delete(lib, criteria):
|
|||
if not q.strip():
|
||||
raise ValueError('must provide some criteria for deleting')
|
||||
for item in lib.get(q):
|
||||
print "deleting " + item.path
|
||||
_print("deleting " + item.path)
|
||||
item.delete()
|
||||
lib.save()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue