Stable: 2.5.2
Development: 2.6-alpha3
I would like to know how to permanently delete lousy music that has made its way into my collection :-) This topic seems to come up pretty often in the forums but is there really no built-in solution?
A new user who discovered moc through ubuntu's repositories.
jcf
Wed, 2011-04-27 23:47
Permalink
Help Is On The Way
Certainly this is a worthy function to have, and I have
been using it in my development MOC for several years now.
But it relies on new MOC functionality which still requires
a reasonable amount of work and hasn't made it into the
repository as yet.
zoubidoo
Sat, 2011-04-30 16:15
Permalink
Looking forward to this
Looking forward to this upgrade! In the meantime what is the best way to delete files?
I created ~/.moc/config with
ExecCommand1 = "rm %f"
After restarting moc I tried deleting with F1 but get the gnome terminal manual instead.
With
ExecCommand2 = "rm %f"
and F2 it now seems to work ok.
PS The links to scripts mentioned in this thread http://moc.daper.net/node/175 are broken. Does anyone still have them?
moc 2.5.0-alpha4 Build: Jan 19 2010 23:11:56
Compiled with: OSS ALSA JACK DEBUG internet streams resample
Ubuntu 10.04 LTS
zoubidoo
Sun, 2011-05-01 12:33
Permalink
I'm still having a problem
I'm still having a problem deleting: ExecCommand2 = "rm %f" doesn't work when deleting tracks in the playlist, but works fine on tracks in the directory side. It seems that spaces in the filename are not being escaped on the playlist side but they are being escaped on the directory side. Any suggestions much appreciated!
jcf
Sun, 2011-05-01 21:57
Permalink
Really Broken?
My tests show that this problem does not exist in the
latest revision (r2307), and nor does the code suggest
that filenames from the main menu and playlist were ever
treated differently.
Are you sure this is what you're seeing?
lxs
Sat, 2012-06-09 05:43
Permalink
First, my English is not
First, my English is not good, so the sentence may be less fluent.
For the Moc-2.4.4, I wrote a patch, is to realize this feature, you must first select the songs you want to delete with the cursor, then press the 'D' key, the file will disappear on your hard disk and playlists (must have certain permissions), and so I back to send the patch up.
lxs
Sat, 2012-06-09 07:59
Permalink
[PATCH]
--- moc-2.4.4/keys.c 2006-07-02 22:41:14.000000000 +0800
+++ ../software/moc-2.4.4/keys.c 2012-06-09 15:38:20.000000000 +0800
@@ -727,7 +727,15 @@
CON_MENU,
{ 'P', -1 },
1
- }
+ },
+ {
+ KEY_CMD_DEL_FILE,
+ "del file",
+ "Delete file (root)",
+ CON_MENU,
+ { 'D', -1},
+ 1
+ }
};
static struct special_keys
--- moc-2.4.4/keys.h 2006-07-02 22:41:14.000000000 +0800
+++ ../software/moc-2.4.4/keys.h 2012-06-09 15:37:46.000000000 +0800
@@ -87,7 +87,8 @@
KEY_CMD_EXEC9,
KEY_CMD_EXEC10,
KEY_CMD_TOGGLE_PLAYLIST_FULL_PATHS,
- KEY_CMD_WRONG
+ KEY_CMD_WRONG,
+ KEY_CMD_DEL_FILE
};
/* Key context is the place where the user presses a key. A key can have
--- moc-2.4.4/interface.c 2007-07-30 22:58:57.000000000 +0800
+++ ../software/moc-2.4.4/interface.c 2012-06-09 15:39:00.000000000 +0800
@@ -58,7 +58,6 @@
#include "themes.h"
#define INTERFACE_LOG "mocp_client_log"
-
/* Socket of the server connection. */
static int srv_sock = -1;
@@ -1600,6 +1599,18 @@
free (file);
}
+static void del_file(void)
+{
+ char *file = iface_get_curr_file();
+
+ if (remove(file))
+ error("File delete failed");
+ else
+ go_to_dir(NULL, 0); /* refresh playlist */
+
+ free(file);
+}
+
/* pause/unpause */
static void switch_pause ()
{
@@ -3169,6 +3180,9 @@
case KEY_CMD_EXEC10:
exec_custom_command ("ExecCommand10");
break;
+ case KEY_CMD_DEL_FILE:
+ del_file();
+ break;
default:
abort ();
}