Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions cplay
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class RootWindow(Window):
def command_quit(self):
app.do_input_hook = self.do_quit
app.start_input(_("Quit? (y/N)"))

def do_quit(self, ch):
if chr(ch) == 'y': app.quit()
app.stop_input()
Expand Down Expand Up @@ -518,14 +518,15 @@ class HelpWindow(ListWindow):
------ u, U : untag current/regex
Up, Down, k, j, C-p, C-n, Sp, i : invert current/all
PgUp, PgDn, K, J, !, , : shell, macro
Home, End, g, G : movement
Home, End, g, G : movement % : delete playing track from filesytem
and go next
Enter : chdir or play Filelist
Tab : filelist/playlist --------
n, p : next/prev track a : add (tagged) to playlist
z, x : toggle pause/stop s : recursive search
BS, o : goto parent/specified dir
Left, Right, m, ' : set/get bookmark
C-f, C-b : seek forward/backward
C-f, C-b : seek forward/backward
C-a, C-e : restart/end track Playlist
C-s, C-r, / : isearch --------
C-g, Esc : cancel d, D : delete (tagged) tracks/playlist
Expand Down Expand Up @@ -741,7 +742,7 @@ class FilelistWindow(TagListWindow):
def command_set_bookmark(self):
app.do_input_hook = self.do_set_bookmark
app.start_input(_("set bookmark"))

def do_set_bookmark(self, ch):
app.input_string = ch
self.bookmarks[ch] = [self.cwd, self.bufptr]
Expand Down Expand Up @@ -891,6 +892,7 @@ class PlaylistWindow(TagListWindow):
self.stop = 0
self.keymap.bind(['\n', curses.KEY_ENTER],
self.command_play, ())
self.keymap.bind('%', self.command_remove_from_fs, ())
self.keymap.bind('d', self.command_delete, ())
self.keymap.bind('D', self.command_delete_all, ())
self.keymap.bind('m', self.command_move, (1,))
Expand Down Expand Up @@ -953,7 +955,7 @@ class PlaylistWindow(TagListWindow):
file = open(pathname)
map(f, map(string.strip, file.readlines()))
file.close()

def add(self, pathname, quiet=0):
try:
if os.path.isdir(pathname):
Expand Down Expand Up @@ -1048,6 +1050,20 @@ class PlaylistWindow(TagListWindow):
self.random_left = self.not_tagged(self.random_left)
self.update()

def command_remove_from_fs(self):
"""Delete file from filesystem"""
entry = self.get_active_entry()
if not entry: return
self.bufptr = self.buffer.index(entry)
if os.path.isfile(entry.pathname):
fd = open('/tmp/cplay-mylog.log', "a+")
fd.write("%s\n" % entry.pathname)
fd.close()
os.remove(entry.pathname)
# print entry.pathname
self.command_delete()
app.next_song()

def command_delete_all(self):
self.buffer = []
self.random_prev = []
Expand Down