summaryrefslogtreecommitdiff
path: root/play.py
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-10-27 02:30:21 (GMT)
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-10-27 02:30:21 (GMT)
commit2e12502e19c3f4f6f944250c0975549e00230eb0 (patch)
treea9caecb275fdb1d86beb5499bcc5aa36e8635455 /play.py
parent076eefa784697e496914ed662aeac0b458721150 (diff)
downloadplay-2e12502e19c3f4f6f944250c0975549e00230eb0.tar.xz
play: removed gettext fallback
Diffstat (limited to 'play.py')
-rwxr-xr-xplay.py113
1 files changed, 55 insertions, 58 deletions
diff --git a/play.py b/play.py
index 9f6a376..61494cc 100755
--- a/play.py
+++ b/play.py
@@ -45,9 +45,6 @@ try: import locale; locale.setlocale(locale.LC_ALL, "")
except: pass
# ------------------------------------------
-def _(s): return s # Removed gettext support
-
-# ------------------------------------------
XTERM = re.search("rxvt|xterm", os.environ["TERM"])
CONTROL_FIFO = "%s/play-control-%s" % (os.environ.get("TMPDIR", "/tmp"), os.environ["USER"])
@@ -257,8 +254,8 @@ class CounterWindow(Window):
def toggle_mode(self):
self.mode = not self.mode
- tmp = [_("elapsed"), _("remaining")][self.mode]
- app.status(_("Counting %s time") % tmp, 1)
+ tmp = ["elapsed", "remaining"][self.mode]
+ app.status("Counting %s time" % tmp, 1)
self.update()
# ------------------------------------------
@@ -291,7 +288,7 @@ class RootWindow(Window):
def command_quit(self):
app.do_input_hook = self.do_quit
- app.start_input(_("Quit? (y/N)"))
+ app.start_input("Quit? (y/N)")
def do_quit(self, ch):
if chr(ch) == 'y': app.quit()
@@ -378,9 +375,9 @@ class ListWindow(Window):
self.keymap.bind(['g', curses.KEY_HOME], self.cursor_home, ())
self.keymap.bind(['G', curses.KEY_END], self.cursor_end, ())
self.keymap.bind(['?', 18], self.start_search,
- (_("backward-isearch"), -1))
+ ("backward-isearch", -1))
self.keymap.bind(['/', 19], self.start_search,
- (_("forward-isearch"), 1))
+ ("forward-isearch", 1))
self.keymap.bind(['>'], self.hscroll, (8,))
self.keymap.bind(['<'], self.hscroll, (-8,))
@@ -473,7 +470,7 @@ class ListWindow(Window):
def stop_search(self):
self.last_search = app.input_string
- app.status(_("ok"), 1)
+ app.status("ok", 1)
def do_search(self, ch = None, advance = 0):
if ch in [8, 127]: app.input_string = app.input_string[:-1]
@@ -482,7 +479,7 @@ class ListWindow(Window):
index = self.bufptr + advance
while 1:
if not 0 <= index < len(self.buffer):
- app.status(_("Not found: %s ") % app.input_string)
+ app.status("Not found: %s " % app.input_string)
self.not_found = 1
break
line = string.lower(str(self.buffer[index]))
@@ -494,7 +491,7 @@ class ListWindow(Window):
self.not_found = 0
break
if self.not_found:
- app.status(_("Not found: %s ") % app.input_string)
+ app.status("Not found: %s " % app.input_string)
break
index = index + self.search_direction
@@ -506,9 +503,9 @@ class ListWindow(Window):
class HelpWindow(ListWindow):
def __init__(self, parent):
ListWindow.__init__(self, parent)
- self.name = _("Help")
+ self.name = "Help"
self.keymap.bind('q', self.parent.help, ())
- self.buffer = string.split(_("""\
+ self.buffer = string.split("""\
Global t, T : tag current/regex
------ u, U : untag current/regex
Up, Down, k, j, C-p, C-n, Sp, i : invert current/all
@@ -529,7 +526,7 @@ class HelpWindow(ListWindow):
<, > : horizontal scrolling s, S : shuffle/Sort playlist
C-l, l : refresh, list mode w, @ : write playlist, jump to active
h, q, Q : help, quit?, Quit! X : stop playlist after each track
-"""), "\n")
+""", "\n")
# ------------------------------------------
class ListEntry:
@@ -558,8 +555,8 @@ class ListEntry:
def vp_pathname(self):
return self.pathname
- vps = [[_("filename"), vp_filename],
- [_("pathname"), vp_pathname]]
+ vps = [["filename", vp_filename],
+ ["pathname", vp_pathname]]
# ------------------------------------------
class PlaylistEntry(ListEntry):
@@ -581,7 +578,7 @@ class PlaylistEntry(ListEntry):
self.metadata = get_tag(self.pathname)
return self.metadata
- vps = ListEntry.vps[:] + [[_("metadata"), vp_metadata]]
+ vps = ListEntry.vps[:] + [["metadata", vp_metadata]]
# ------------------------------------------
class TagListWindow(ListWindow):
@@ -600,7 +597,7 @@ class TagListWindow(ListWindow):
if app.restricted: return
app.stop_input_hook = self.stop_shell
app.complete_input_hook = self.complete_shell
- app.start_input(_("shell$ "), colon=0)
+ app.start_input("shell$ ", colon=0)
def stop_shell(self):
s = app.input_string
@@ -651,7 +648,7 @@ class TagListWindow(ListWindow):
def command_change_viewpoint(self, klass=ListEntry):
klass.vps.append(klass.vps.pop(0))
- app.status(_("Listing %s") % klass.vps[0][0], 1)
+ app.status("Listing %s" % klass.vps[0][0], 1)
app.player.update_status()
self.update()
@@ -674,7 +671,7 @@ class TagListWindow(ListWindow):
def command_tag_regexp(self, value):
self.tag_value = value
app.stop_input_hook = self.stop_tag_regexp
- app.start_input(value and _("Tag regexp") or _("Untag regexp"))
+ app.start_input(value and "Tag regexp" or "Untag regexp")
def stop_tag_regexp(self):
try:
@@ -683,7 +680,7 @@ class TagListWindow(ListWindow):
if r.search(str(entry)):
entry.set_tagged(self.tag_value)
self.update()
- app.status(_("ok"), 1)
+ app.status("ok", 1)
except re.error, e:
app.status(e, 2)
@@ -716,7 +713,7 @@ class FilelistWindow(TagListWindow):
def command_get_bookmark(self):
app.do_input_hook = self.do_get_bookmark
- app.start_input(_("bookmark"))
+ app.start_input("bookmark")
def do_get_bookmark(self, ch):
app.input_string = ch
@@ -728,30 +725,30 @@ class FilelistWindow(TagListWindow):
self.listdir()
self.bufptr = pos
self.update()
- app.status(_("ok"), 1)
+ app.status("ok", 1)
else:
- app.status(_("Not found!"), 1)
+ app.status("Not found!", 1)
app.stop_input()
def command_set_bookmark(self):
app.do_input_hook = self.do_set_bookmark
- app.start_input(_("set bookmark"))
+ app.start_input("set bookmark")
def do_set_bookmark(self, ch):
app.input_string = ch
self.bookmarks[ch] = [self.cwd, self.bufptr]
- ch and app.status(_("ok"), 1) or app.stop_input()
+ ch and app.status("ok", 1) or app.stop_input()
def command_search_recursively(self):
app.stop_input_hook = self.stop_search_recursively
- app.start_input(_("search"))
+ app.start_input("search")
def stop_search_recursively(self):
try: re_tmp = re.compile(app.input_string, re.I)
except re.error, e:
app.status(e, 2)
return
- app.status(_("Searching..."))
+ app.status("Searching...")
results = []
for entry in self.buffer:
if entry.filename == "..":
@@ -762,7 +759,7 @@ class FilelistWindow(TagListWindow):
try: self.search_recursively(re_tmp, entry.pathname, results)
except: pass
if not self.search_mode:
- self.chdir(os.path.join(self.cwd,_("search results")))
+ self.chdir(os.path.join(self.cwd, "search results"))
self.search_mode = 1
self.buffer = results
self.bufptr = 0
@@ -782,7 +779,7 @@ class FilelistWindow(TagListWindow):
self.search_recursively(re_tmp, pathname, results)
def get_title(self):
- self.name = _("Filelist: ")
+ self.name = "Filelist: "
return ListWindow.get_title(self, re.sub("/?$", "/", self.cwd))
def listdir_maybe(self, now=0):
@@ -793,7 +790,7 @@ class FilelistWindow(TagListWindow):
except os.error: pass
def listdir(self, quiet=0, prevdir=None):
- quiet or app.status(_("Reading directory..."))
+ quiet or app.status("Reading directory...")
self.search_mode = 0
dirs = []
files = []
@@ -850,13 +847,13 @@ class FilelistWindow(TagListWindow):
if app.restricted: return
app.stop_input_hook = self.stop_goto
app.complete_input_hook = self.complete_generic
- app.start_input(_("goto"))
+ app.start_input("goto")
def stop_goto(self):
dir = os.path.expanduser(app.input_string)
if dir[0] != '/': dir = os.path.join(self.cwd, dir)
if not os.path.isdir(dir):
- app.status(_("Not a directory!"), 1)
+ app.status("Not a directory!", 1)
return
self.chdir(dir)
self.listdir()
@@ -867,7 +864,7 @@ class FilelistWindow(TagListWindow):
app.win_playlist.add(self.current().pathname)
self.cursor_move(1)
return
- app.status(_("Adding tagged files"), 1)
+ app.status("Adding tagged files", 1)
for entry in l:
app.win_playlist.add(entry.pathname, quiet=1)
entry.set_tagged(0)
@@ -903,10 +900,10 @@ class PlaylistWindow(TagListWindow):
def get_title(self):
space_out = lambda value, s: value and s or " "*len(s)
- self.name = _("Playlist %s %s %s") % (
- space_out(self.repeat, _("[repeat]")),
- space_out(self.random, _("[random]")),
- space_out(self.stop, _("[stop]")))
+ self.name = "Playlist %s %s %s" % (
+ space_out(self.repeat, "[repeat]"),
+ space_out(self.random, "[random]"),
+ space_out(self.stop, "[stop]"))
return ListWindow.get_title(self)
def append(self, item):
@@ -952,7 +949,7 @@ class PlaylistWindow(TagListWindow):
def add(self, pathname, quiet=0):
try:
if os.path.isdir(pathname):
- app.status(_("Working..."), 10)
+ app.status("Working...", 10)
self.add_dir(pathname)
elif VALID_PLAYLIST(pathname):
self.add_playlist(pathname)
@@ -962,7 +959,7 @@ class PlaylistWindow(TagListWindow):
# todo - refactor
filename = os.path.basename(pathname) or pathname
quiet or self.update()
- quiet or app.status(_("Added: %s") % filename, 1)
+ quiet or app.status("Added: %s" % filename, 1)
except Exception, e:
app.status(e, 2)
@@ -1049,7 +1046,7 @@ class PlaylistWindow(TagListWindow):
self.random_prev = []
self.random_next = []
self.random_left = []
- app.status(_("Deleted playlist"), 1)
+ app.status("Deleted playlist", 1)
self.update()
def command_move(self, after):
@@ -1073,37 +1070,37 @@ class PlaylistWindow(TagListWindow):
self.buffer = l
self.bufptr = 0
self.update()
- app.status(_("Shuffled playlist... Oops?"), 1)
+ app.status("Shuffled playlist... Oops?", 1)
def command_sort(self):
- app.status(_("Working..."))
+ app.status("Working...")
self.buffer.sort(lambda x, y: x.vp() > y.vp() or -1)
self.bufptr = 0
self.update()
- app.status(_("Sorted playlist"), 1)
+ app.status("Sorted playlist", 1)
def command_toggle_repeat(self):
- self.toggle("repeat", _("Repeat: %s"))
+ self.toggle("repeat", "Repeat: %s")
def command_toggle_random(self):
- self.toggle("random", _("Random: %s"))
+ self.toggle("random", "Random: %s")
self.random_prev = []
self.random_next = []
self.random_left = self.buffer[:]
def command_toggle_stop(self):
- self.toggle("stop", _("Stop playlist: %s"))
+ self.toggle("stop", "Stop playlist: %s")
def toggle(self, attr, format):
setattr(self, attr, not getattr(self, attr))
- app.status(format % (getattr(self, attr) and _("on") or _("off")), 1)
+ app.status(format % (getattr(self, attr) and "on" or "off"), 1)
self.parent.update_title()
def command_save_playlist(self):
if app.restricted: return
default = self.pathname or "%s/" % app.win_filelist.cwd
app.stop_input_hook = self.stop_save_playlist
- app.start_input(_("Save playlist"), default)
+ app.start_input("Save playlist", default)
def stop_save_playlist(self):
pathname = app.input_string
@@ -1117,7 +1114,7 @@ class PlaylistWindow(TagListWindow):
file.write("%s\n" % entry.pathname)
file.close()
self.pathname = pathname
- app.status(_("ok"), 1)
+ app.status("ok", 1)
except IOError, e:
app.status(e, 2)
@@ -1267,11 +1264,11 @@ class Player:
if not self.entry:
app.set_default_status("")
elif self.stopped:
- app.set_default_status(_("Stopped: %s") % self.entry.vp())
+ app.set_default_status("Stopped: %s" % self.entry.vp())
elif self.paused:
- app.set_default_status(_("Paused: %s") % self.entry.vp())
+ app.set_default_status("Paused: %s" % self.entry.vp())
else:
- app.set_default_status(_("Playing: %s") % self.entry.vp())
+ app.set_default_status("Playing: %s" % self.entry.vp())
# ------------------------------------------
class FrameOffsetPlayer(Player):
@@ -1408,7 +1405,7 @@ class Application:
def command_macro(self):
app.do_input_hook = self.do_macro
- app.start_input(_("macro"))
+ app.start_input("macro")
def do_macro(self, ch):
app.stop_input()
@@ -1518,7 +1515,7 @@ class Application:
if self.player.re_files.search(entry.pathname):
if self.player.setup(entry, offset): break
else:
- app.status(_("Player not found!"), 1)
+ app.status("Player not found!", 1)
self.player.stopped = 0 # keep going
return
self.player.play()
@@ -1573,7 +1570,7 @@ class Application:
name, channel = self.channels[0]
if cmd == "cue": arg = min(100, max(0, get(channel)[0] + arg))
if cmd in ["set", "cue"]: set(channel, (arg, arg))
- app.status(_("%s volume %s%%") % (name, get(channel)[0]), 1)
+ app.status("%s volume %s%%" % (name, get(channel)[0]), 1)
mixer.close()
def show_input(self):
@@ -1610,7 +1607,7 @@ class Application:
self.cursor(0)
app.keymapstack.pop()
if not self.input_string:
- app.status(_("cancel"), 1)
+ app.status("cancel", 1)
elif self.stop_input_hook:
self.stop_input_hook(*args)
self.do_input_hook = None
@@ -1646,7 +1643,7 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "nrRv")
except:
- usage = _("Usage: %s [-nrRv] [ file | dir | playlist ] ...\n")
+ usage = "Usage: %s [-nrRv] [ file | dir | playlist ] ...\n"
sys.stderr.write(usage % sys.argv[0])
sys.exit(1)