Skip to content

Commit

Permalink
Change format of Track.__str__ and make sure it returns str, not unic…
Browse files Browse the repository at this point in the history
…ode.

This fixes Unicode errors when running with --eventdebug.
  • Loading branch information
sjohannes committed Apr 28, 2017
1 parent 5a591d1 commit 07b9249
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion xl/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def _emit(self, event, exc_callbacks, emit_logmsg, emit_verbose):
logger.exception("Event callback exception caught!")

if emit_logmsg:
logger.debug("Sent '%s' event from '%r' with data '%r'",
logger.debug("Sent '%s' event from %r with data %r",
event.type, event.object, event.data)

def emit_async(self, event):
Expand Down
11 changes: 2 additions & 9 deletions xl/trax/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,8 @@ def __str__(self):
"""
returns a string representing the track
"""
vals = map(self.get_tag_display, ('title', 'album', 'artist'))
rets = []
for v in vals:
if not v:
v = "Unknown"
v = "'" + v + "'"
rets.append(v)
ret = "%s from %s by %s" % tuple(rets)
return ret
vals = map(self.get_tag_display, ('title', 'artist', 'album'))
return "<Track %r by %r from %r>" % tuple(vals)

def _pickles(self):
"""
Expand Down

0 comments on commit 07b9249

Please sign in to comment.