Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.43pre3

  • Loading branch information...
commit 2f4e87d5f3504f01550b1b7b14497dfe8ee9d171 1 parent f7fedc9
Ulf Betlehem authored committed
Showing with 136 additions and 116 deletions.
  1. +13 −9 TODO
  2. +69 −50 cplay
  3. +54 −57 po/de.po
View
22 TODO
@@ -1,8 +1,7 @@
high priority
------------------------------------------
-- splay support
+- shuffle/sort marked tracks?
- seek acceleration based on total_time
-- merge id3 patch
- toggle time done / time left
- scrollbar / position indicator
- hide cursor after SUSP & CONT cycle
@@ -10,30 +9,35 @@ high priority
- better input support (readline?)
- dynamic help page
- new and more vi-friendly keymap
-- a/A = Append mp3/dir
-- i/I = Insert mp3/dir
-- playlist mark regex/pattern
-- reset progress when changing song?
-- userfriendly quit
+- Q = quit, q = userfriendly quit (sure? [Y/n])
- fast Esc
low priority
------------------------------------------
+- merge id3 patch
+- merge cddb patch
+- splay support
- delwin when resizing
-- toggle playlist markings
+- invert playlist markings
- hierarchical playlists?
misc thoughts
------------------------------------------
- delayed play command (play after current song is finished)
+- reset progress when changing song?
- restore xterm title (not possible with aterm, rxvt, etc?)
- mpg123 gives buggy progress info for some mp3 files
- should there be another way to start playing the playlist
from the beginning than "next track"?
- / and ? should search
- n and N should correspond to next and previous
-- f and b should choose next and previous track?
+- f and b could select next and previous track?
+- a/A = Append mp3/dir
+- i/I = Insert mp3/dir
+- Meta-<, Meta-> commands?
- treat .m3u files as directories?
- show progress while streaming?
- Python 1.4 compatibility?
- support slang?
+- icecast/shoutcast support
+- fade in/out mode (a la repeat/random)
View
119 cplay
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# -*- python -*-
-__version__ = "cplay 1.43pre2"
+__version__ = "cplay 1.43pre3"
"""
cplay - A curses front-end for various audio players
-Copyright (C) 1998-2000 Ulf Betlehem <flu@iki.fi>
+Copyright (C) 1998-2001 Ulf Betlehem <flu@iki.fi>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -187,14 +187,14 @@ class HelpWindow(Window):
PgUp, PgDown, g : goto
Home, End : movement Enter : chdir or play
Tab : filelist/playlist Backspace : parent dir
- n,p : next/prev track
- z,x : toggle pause/stop Playlist
+ n, p : next/prev track
+ z, x : toggle pause/stop Playlist
Left, Right, --------
C-b, C-f : seek Enter : play track
- C-s : forward-isearch Space : mark
- C-r : backward-isearch a,c : mark/clear all
- C-g, Esc : cancel m : move marked tracks
- 1..9, +- : volume d : delete marked tracks
+ C-s : forward-isearch Space : toggle mark
+ C-r : backward-isearch a, c : mark/clear all
+ C-g, Esc : cancel A, C : mark/clear regexp
+ 1..9, +/- : volume m, d : move/delete marked tracks
C-l : refresh screen r, R : toggle repeat/Random mode
h : help s, S : shuffle/Sort playlist
q : quit o : save playlist (to .m3u file)
@@ -253,7 +253,7 @@ class StatusWindow(Window):
def update(self):
msg = string.translate(self.current_message, Window.translationTable)
- if len(msg) > self.cols: msg = "<%s" % msg[len(msg)-self.cols+1:]
+ if len(msg) > self.cols: msg = "%s>" % msg[:self.cols-1]
self.move(0, 0)
self.addstr(msg)
self.clrtoeol()
@@ -396,8 +396,8 @@ class ListWindow(Window):
self.search_direction = 0
self.input_mode = 0
- self.input_string = ""
self.input_prompt = ""
+ self.input_string = ""
self.do_input_hook = None
self.stop_input_hook = None
@@ -446,6 +446,12 @@ class ListWindow(Window):
if attr: self.attroff(attr)
if self.visible and refresh: self.refresh()
+ def start_input(self, prompt="", data=""):
+ self.input_mode = 1
+ app.keymapstack.push(self.input_keymap)
+ self.input_prompt = prompt
+ self.input_string = data
+
def do_input(self, *args):
if self.do_input_hook:
return apply(self.do_input_hook, args)
@@ -456,20 +462,13 @@ class ListWindow(Window):
self.input_string = "%s%c" % (self.input_string, ch)
app.status("%s: %s" % (self.input_prompt, self.input_string))
+ ## We have the result in self.input_string
def stop_input(self, *args):
+ self.input_mode = 0
+ app.keymapstack.pop()
if self.stop_input_hook:
return apply(self.stop_input_hook, args)
- self.set_input_mode(0)
- app.status(_("probably not ok"), 1)
- def set_input_mode(self, value):
- self.input_mode = value
- if value == 1: app.keymapstack.push(self.input_keymap)
- if value == 0: app.keymapstack.pop()
-
- def is_input_mode(self):
- return self.input_mode == 1
-
def putstr(self, entry, *pos):
s = string.translate(str(entry), Window.translationTable)
s = "%s%s" % ((len(s) > self.cols) and (s[:self.cols - 1], ">") or (s, ""))
@@ -481,7 +480,7 @@ class ListWindow(Window):
return self.buffer[self.bufptr]
def cursor_move(self, ydiff):
- if self.is_input_mode(): self.stop_input("cancel")
+ if self.input_mode: self.stop_input(_("cancel"))
if not self.buffer: return
self.update_line(refresh = 0)
self.bufptr = (self.bufptr + ydiff) % len(self.buffer)
@@ -511,20 +510,19 @@ class ListWindow(Window):
def start_search(self, type, direction):
if not self.is_searching():
- self.set_input_mode(1)
+ self.start_input()
self.do_input_hook = self.do_search
self.stop_input_hook = self.stop_search
- self.input_string = ""
if self.search_direction != direction:
self.search_direction = direction
self.input_prompt = type
self.do_search()
- else: self.do_search(advance = direction)
+ else:
+ self.do_search(advance = direction)
def stop_search(self, reason = ""):
- self.set_input_mode(0)
self.search_direction = 0
- if reason != None: app.status(reason, 1)
+ app.status(reason, 1)
def do_search(self, ch = None, advance = 0):
direction = self.search_direction
@@ -625,17 +623,13 @@ class FilelistWindow(ListWindow):
self.listdir()
def command_goto(self):
- self.set_input_mode(1)
- self.input_prompt = _("goto")
- self.input_string = ""
+ self.start_input(_("goto"))
self.do_input_hook = None
self.stop_input_hook = self.stop_goto
self.do_input()
- ## We have the result in self.input_string
def stop_goto(self, reason):
- self.set_input_mode(0)
- if reason == "cancel" or not self.input_string:
+ if reason == _("cancel") or not self.input_string:
app.status(_("cancel"), 1)
return
dir = self.input_string
@@ -713,8 +707,6 @@ class PlaylistWindow(ListWindow):
self.random_buffer = []
self.keymap.bind('\n', self.command_play, ())
self.keymap.bind(' ', self.command_mark, ())
- self.keymap.bind('a', self.command_mark_all, ())
- self.keymap.bind('c', self.command_clear_marks, ())
self.keymap.bind('d', self.command_delete, ())
self.keymap.bind('m', self.command_move, ())
self.keymap.bind('s', self.command_shuffle, ())
@@ -722,6 +714,10 @@ class PlaylistWindow(ListWindow):
self.keymap.bind('r', self.command_toggle_repeat, ())
self.keymap.bind('R', self.command_toggle_random, ())
self.keymap.bind('o', self.command_save_playlist, ())
+ self.keymap.bind('a', self.command_mark_all, ())
+ self.keymap.bind('c', self.command_clear_all, ())
+ self.keymap.bind('A', self.command_mark_regexp, ())
+ self.keymap.bind('C', self.command_clear_regexp, ())
def change_name(self):
self.name = _("Playlist %s %s") % (self.repeat and _("[repeat]")
@@ -828,7 +824,7 @@ class PlaylistWindow(ListWindow):
app.status(_("Almost there..."), 1)
self.update(force = 1)
- def command_clear_marks(self):
+ def command_clear_all(self):
for entry in self.buffer:
entry.set_marked(0)
app.status(_("Cleared all marks..."), 1)
@@ -889,18 +885,42 @@ class PlaylistWindow(ListWindow):
self.change_name()
self.parent.update_title()
+ def command_mark_regexp(self):
+ self.mark_value = 1
+ self.start_input(_("Mark regexp"))
+ self.do_input_hook = None
+ self.stop_input_hook = self.stop_mark_regexp
+ self.do_input()
+
+ def command_clear_regexp(self):
+ self.mark_value = 0
+ self.start_input(_("Clear regexp"))
+ self.do_input_hook = None
+ self.stop_input_hook = self.stop_mark_regexp
+ self.do_input()
+
+ def stop_mark_regexp(self, reason):
+ if reason == _("cancel") or not self.input_string:
+ app.status(_("cancel"), 1)
+ return
+ try:
+ r = re.compile(self.input_string)
+ for entry in self.buffer:
+ if r.search(entry.filename):
+ entry.set_marked(self.mark_value)
+ self.update(force = 1)
+ app.status(_("ok"), 1)
+ except re.error, e:
+ app.status(str(e), 2)
+
def command_save_playlist(self):
- self.set_input_mode(1)
- self.input_prompt = _("Save playlist")
- self.input_string = app.win_filelist.cwd
+ self.start_input(_("Save playlist"), app.win_filelist.cwd)
self.do_input_hook = None
self.stop_input_hook = self.stop_save_playlist
self.do_input()
- ## We have the result in self.input_string
def stop_save_playlist(self, reason):
- self.set_input_mode(0)
- if reason == "cancel" or not self.input_string:
+ if reason == _("cancel") or not self.input_string:
app.status(_("cancel"), 1)
return
filename = self.input_string
@@ -920,15 +940,12 @@ class PlaylistWindow(ListWindow):
# ------------------------------------------
class Player:
def __init__(self):
- self.stopped = 0
- self.paused = 0
self.stdout_r, self.stdout_w = os.pipe()
self.stderr_r, self.stderr_w = os.pipe()
self.pathname = None
self.filename = None
- self.seek_step = None
- self.time_done = None
- self.time_left = None
+ self.stopped = 0
+ self.paused = 0
def is_stopped(self):
return self.stopped
@@ -950,6 +967,8 @@ class Player:
self.stopped = 0
self.paused = 0
self.seek_step = None
+ self.time_done = 0
+ self.time_left = 0
def pause(self, quiet=0):
self.paused = 1
@@ -992,7 +1011,7 @@ class Player:
self.show_position()
def show_position(self):
- app.counter(self.time_left) # todo: toggle mode
+ app.counter(self.time_left) # todo - toggle mode
ratio = self.time_done / (self.time_done + self.time_left + 1.0)
app.progress(ratio)
@@ -1023,7 +1042,7 @@ class ProgressPlayer(Player):
# ------------------------------------------
class mpg123_Player(ProgressPlayer):
re_files = re.compile(".*\.mp[123]$", re.I)
- command = "%s -qv -k %d"
+ command = "%s -q -v -k %d"
name = "mpg123"
def setup(self, pathname, offset):
@@ -1049,7 +1068,7 @@ class sox_Player(Player):
# ------------------------------------------
class ogg123_Player(ProgressPlayer):
re_files = re.compile(".*\.ogg$", re.I)
- command = "%s -qv -d oss -k %d"
+ command = "%s -q -v -d oss -k %d"
name = "ogg123"
def setup(self, pathname, offset):
@@ -1159,7 +1178,7 @@ class Application:
if self.player.re_files.match(pathname):
if self.player.setup(pathname, offset): break
else:
- app.status(_("Player not found!"))
+ app.status(_("Player not found!"), 1)
return
self.player.play()
View
111 po/de.po
@@ -10,10 +10,6 @@ msgstr ""
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: cplay:980
-msgid "Unknown file format!"
-msgstr "Unbekanntes Dateiformat!"
-
#: cplay:828
msgid "Almost there..."
msgstr "Fast fertig..."
@@ -26,19 +22,11 @@ msgstr "L
msgid "IOError"
msgstr "I/O-Fehler"
-#: cplay:575
-msgid "Reading directory..."
-msgstr "Lese Verzeichnis..."
-
-#: cplay:982
-msgid "Cannot find player! Please install %s."
-msgstr "Kann Player nicht finden! Bitte installiere %s."
-
-#: cplay:981 cplay:1006
-msgid "Playing: %s"
-msgstr "Spiele: %s"
+#: cplay:882 cplay:888
+msgid "off"
+msgstr "aus"
-#: cplay:917
+#: cplay:918
msgid "Cannot write playlist!"
msgstr "Kann Playliste nicht schreiben!"
@@ -54,31 +42,31 @@ msgstr "Nicht gefunden: %s"
msgid "Playlist %s %s"
msgstr "Playliste %s %s"
-#: cplay:629
-msgid "goto"
-msgstr "Gehzu"
+#: cplay:411
+msgid "backward-isearch"
+msgstr "Rückwärts-isuche"
-#: cplay:1017
-msgid "Stopped: %s"
-msgstr "Gestoppt: %s"
+#: cplay:878
+msgid "Sorted playlist..."
+msgstr "Sortiere Playliste..."
-#: cplay:207
+#: cplay:205
msgid "Help"
msgstr "Hilfe"
-#: cplay:419 cplay:915
+#: cplay:419 cplay:916
msgid "ok"
msgstr "ok"
-#: cplay:1000
+#: cplay:958
msgid "Paused: %s"
msgstr "Pause: %s"
-#: cplay:880
+#: cplay:882
msgid "Repeat %s"
msgstr "Wiederholung %s"
-#: cplay:880 cplay:886
+#: cplay:882 cplay:888
msgid "on"
msgstr "ein"
@@ -90,11 +78,11 @@ msgstr "Hinzugef
msgid "[random]"
msgstr "[zufällig]"
-#: cplay:870
+#: cplay:872
msgid "Shuffled playlist... Oops?"
msgstr "Durchwühle Playliste... Oops?"
-#: cplay:418 cplay:639 cplay:902
+#: cplay:418 cplay:639 cplay:904
msgid "cancel"
msgstr "Abbruch"
@@ -102,43 +90,31 @@ msgstr "Abbruch"
msgid "probably not ok"
msgstr "wahrscheinlich nicht ok"
-#: cplay:876
-msgid "Sorted playlist..."
-msgstr "Sortiere Playliste..."
+#: cplay:575
+msgid "Reading directory..."
+msgstr "Lese Verzeichnis..."
+
+#: cplay:1162
+msgid "Player not found!"
+msgstr "Player nicht gefunden!"
#: cplay:611
msgid "Filelist: "
msgstr "Dateiliste: "
-#: cplay:1210
+#: cplay:1240
msgid "Usage: %s [ filename | playlist.m3u ] ...\n"
msgstr "Verwendung: %s [ datei | playliste.m3u ] ...\n"
-#: cplay:1187
+#: cplay:1217
msgid "Volume %d%%"
msgstr "Lautstärke %d%%"
-#: cplay:880 cplay:886
-msgid "off"
-msgstr "aus"
-
-#: cplay:727 cplay:728
-msgid "[repeat]"
-msgstr "[wiederhole]"
-
-#: cplay:886
-msgid "Random %s"
-msgstr "Zufall %s"
-
-#: cplay:892
-msgid "Save playlist"
-msgstr "Speichere Playliste"
-
-#: cplay:411
-msgid "backward-isearch"
-msgstr "Rückwärts-isuche"
+#: cplay:941 cplay:964
+msgid "Playing: %s"
+msgstr "Spiele: %s"
-#: cplay:183
+#: cplay:181
msgid ""
"\n"
" Global Filelist\n"
@@ -155,7 +131,7 @@ msgid ""
" C-s : forward-isearch Space : mark\n"
" C-r : backward-isearch a,c : mark/clear all\n"
" C-g, Esc : cancel m : move marked tracks\n"
-" 1..9 : volume d : delete marked tracks\n"
+" 1..9, +- : volume d : delete marked tracks\n"
" C-l : refresh screen r, R : toggle repeat/Random mode\n"
" h : help s, S : shuffle/Sort playlist\n"
" q : quit o : save playlist (to .m3u file)\n"
@@ -176,14 +152,34 @@ msgstr ""
" C-s : Vorwärts-isuche Space : markiere\n"
" C-r : Rückwärts-isuche a,c : markiere/lösche alle\n"
" C-g, Esc : Abbruch m : verschiebe markierte Tracks\n"
-" 1..9 : Lautstärke d : lösche markierte Tracks\n"
+" 1..9, +- : Lautstärke d : lösche markierte Tracks\n"
" C-l : stelle Bildschirm her r, R : schalte widerhole/zufällig "
"Modus\n"
" h : Hilfe s, S : durchwühle/ordne Playliste\n"
" q : Ende o : speichere Playliste (als .m3u "
"Datei)\n"
-#: cplay:1189
+#: cplay:727 cplay:728
+msgid "[repeat]"
+msgstr "[wiederhole]"
+
+#: cplay:888
+msgid "Random %s"
+msgstr "Zufall %s"
+
+#: cplay:894
+msgid "Save playlist"
+msgstr "Speichere Playliste"
+
+#: cplay:629
+msgid "goto"
+msgstr "Gehzu"
+
+#: cplay:975
+msgid "Stopped: %s"
+msgstr "Gestoppt: %s"
+
+#: cplay:1209 cplay:1219
msgid "Cannot open mixer device %s"
msgstr "Kann Mixer-Device %s nicht öffnen."
@@ -194,3 +190,4 @@ msgstr "Playliste"
#: cplay:644
msgid "Not a directory!"
msgstr "Kein Verzeichnis!"
+
Please sign in to comment.
Something went wrong with that request. Please try again.