Fixed an issue when playing a song in Python 2
This commit is contained in:
parent
53d5a09fb4
commit
8dcee29952
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import sys
|
||||
import random
|
||||
import output
|
||||
import sound_lib
|
||||
@ -43,8 +44,13 @@ class audioPlayer(object):
|
||||
# Make sure that there are no other sounds trying to be played.
|
||||
if self.is_working == False:
|
||||
self.is_working = True
|
||||
# Let's encode the URL as bytes if on Python 3
|
||||
if sys.version[0] == "3":
|
||||
url_ = bytes(url["url"], "utf-8")
|
||||
else:
|
||||
url_ = url["url"]
|
||||
try:
|
||||
self.stream = URLStream(url=bytes(url["url"], "utf-8"))
|
||||
self.stream = URLStream(url=url_)
|
||||
except BassError:
|
||||
log.debug("Error when playing the file %r") % (url,)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user