aboutsummaryrefslogtreecommitdiff
path: root/pydora
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2014-01-04 22:29:59 -0500
committerMike Crute <mcrute@gmail.com>2014-01-04 22:39:04 -0500
commit88e9484a98c8e57d91d68d181fd17ce7e2132417 (patch)
treeadd11e99fba0b8736b7e40fce832f15ace5c7274 /pydora
parent598c9987e62c757ee297ff11869dbb841f7278f9 (diff)
downloadpydora-88e9484a98c8e57d91d68d181fd17ce7e2132417.tar.bz2
pydora-88e9484a98c8e57d91d68d181fd17ce7e2132417.tar.xz
pydora-88e9484a98c8e57d91d68d181fd17ce7e2132417.zip
Python 3 compatabilityrelease-0.2.0
Diffstat (limited to 'pydora')
-rw-r--r--pydora/mpg123.py4
-rw-r--r--pydora/utils.py15
2 files changed, 11 insertions, 8 deletions
diff --git a/pydora/mpg123.py b/pydora/mpg123.py
index bb2e76a..12bc109 100644
--- a/pydora/mpg123.py
+++ b/pydora/mpg123.py
@@ -89,7 +89,7 @@ class Player(object):
89 def _send_cmd(self, cmd): 89 def _send_cmd(self, cmd):
90 """Write command to remote mpg123 process 90 """Write command to remote mpg123 process
91 """ 91 """
92 self._process.stdin.write("{}\n".format(cmd)) 92 self._process.stdin.write("{}\n".format(cmd).encode("utf-8"))
93 self._process.stdin.flush() 93 self._process.stdin.flush()
94 94
95 def stop(self): 95 def stop(self):
@@ -105,7 +105,7 @@ class Player(object):
105 def _player_stopped(self, value): 105 def _player_stopped(self, value):
106 """Determine if player has stopped 106 """Determine if player has stopped
107 """ 107 """
108 return value.startswith("@P") and value[3] == "0" 108 return value.startswith(b"@P") and value.decode('utf-8')[3] == "0"
109 109
110 def play(self, song): 110 def play(self, song):
111 """Play a new song from a Pandora model 111 """Play a new song from a Pandora model
diff --git a/pydora/utils.py b/pydora/utils.py
index 7a86d7a..53cc89f 100644
--- a/pydora/utils.py
+++ b/pydora/utils.py
@@ -4,6 +4,14 @@ import sys
4import termios 4import termios
5 5
6 6
7def input(prompt):
8 try:
9 return raw_input(prompt)
10 except NameError:
11 import builtins
12 return builtins.input(prompt)
13
14
7class Colors: 15class Colors:
8 16
9 def __wrap_with(code): 17 def __wrap_with(code):
@@ -60,14 +68,9 @@ class Screen:
60 Will keep trying till the user enters an interger or until they ^C the 68 Will keep trying till the user enters an interger or until they ^C the
61 program. 69 program.
62 """ 70 """
63 try:
64 raw_input
65 except NameError:
66 raw_input = input
67
68 while True: 71 while True:
69 try: 72 try:
70 return int(raw_input(prompt).strip()) 73 return int(input(prompt).strip())
71 except ValueError: 74 except ValueError:
72 print(Colors.red('Invaid Input!')) 75 print(Colors.red('Invaid Input!'))
73 76