Discussion:
a couple of minor issue
Tony Lapointe
2012-09-06 17:49:01 UTC
Permalink
Hi list!


First, i must say that cmus is a really cool application. Being a
command line guy myself, having an application like cmus around to play
my music is pretty fantastic.

I am trying to build myself a web application to control some cmus
instances around the house and i have stumbled upon something that looks
like a little bug. I am unable to get the content of the playlist over
the network.

If i run locally, having cmus running in a terminal, going over another
terminal and typing :


cmus-remote -C "save -p -"


will give me the content of the playlist.

However, if i start cmus over the network (cmus --listen x.x.x.x and
then set a password), and then try :


cmus-remote --server x.x.x.x --passwd xyz -C "save -p -"


nothing is returned. Passing other commands to cmus over the network
works.


Another thing that find odd is that, if i stop playback in the middle of
a track, and then i clear the playlist, fill the playlist with something
else then start the playback, cmus will start the playback from the song
on which it has stopped, even if the title is no longer in the playlist.


I have done quite some research to try to resolve those issues but did
not find anything. Am i doing something wrong, is there some way to
resolve this by some configuration change on my part? Or, are they
little bugs in cmus?



Thanks and regards,

Tony Lapointe
Gregory Petrosyan
2012-09-07 14:33:39 UTC
Permalink
[please subscribe to cmus-devel since you need to be a subscriber to
be able to post to the list]
Post by Tony Lapointe
First, i must say that cmus is a really cool application. Being a
command line guy myself, having an application like cmus around to play
my music is pretty fantastic.
Nice to hear that! :-)
Post by Tony Lapointe
If i run locally, having cmus running in a terminal, going over another
cmus-remote -C "save -p -"
will give me the content of the playlist.
However, if i start cmus over the network (cmus --listen x.x.x.x and
cmus-remote --server x.x.x.x --passwd xyz -C "save -p -"
nothing is returned. Passing other commands to cmus over the network
works.
"bind", "run", "save", "shell", "source", "w" and "win-remove" are
considered «unsafe» commands — they can only be executed over local
Unix socket, not e.g. TCP one.
Post by Tony Lapointe
Another thing that find odd is that, if i stop playback in the middle of
a track, and then i clear the playlist, fill the playlist with something
else then start the playback, cmus will start the playback from the song
on which it has stopped, even if the title is no longer in the playlist.
You mean pause/resume instead of stop/play ('c' keyboard shortcut)? If
so, this is intended behaviour.

Hope this helps!

Gregory
Tony Lapointe
2012-09-07 22:13:01 UTC
Permalink
Post by Gregory Petrosyan
Post by Tony Lapointe
First, i must say that cmus is a really cool application. Being a
command line guy myself, having an application like cmus around to play
my music is pretty fantastic.
Nice to hear that! :-)
Post by Tony Lapointe
If i run locally, having cmus running in a terminal, going over another
cmus-remote -C "save -p -"
will give me the content of the playlist.
However, if i start cmus over the network (cmus --listen x.x.x.x and
cmus-remote --server x.x.x.x --passwd xyz -C "save -p -"
nothing is returned. Passing other commands to cmus over the network
works.
"bind", "run", "save", "shell", "source", "w" and "win-remove" are
considered «unsafe» commands — they can only be executed over local
Unix socket, not e.g. TCP one.
Thanks for the pointer, i was able to hack the source code and i am now
able to run the save command over the network to get the content of the
playlist.

However, this is probably not the optimal solution (having to change or
patch the code everytime there is a new cmus version).
Gregory Petrosyan
2012-09-11 18:17:50 UTC
Permalink
Post by Gregory Petrosyan
Post by Tony Lapointe
Another thing that find odd is that, if i stop playback in the middle of
a track, and then i clear the playlist, fill the playlist with something
else then start the playback, cmus will start the playback from the song
on which it has stopped, even if the title is no longer in the playlist.
You mean pause/resume instead of stop/play ('c' keyboard shortcut)? If
so, this is intended behaviour.
No, this is not what i am doing. First, i am never using the ui, i just
trow it away in a screen session and forget about it :) What i am doing
cmus-remote /path/to/some/great/stuff.m3u
cmus-remote -p (or cmus-remote -C "player-play")
cmus-remote -s (or cmus-remote -C "player-stop")
cmus-remote -c (or cmus-remote -C "clear -p")
cmus-remote /path/to/some/great/other_stuff.m3u
cmus-remote -p (or cmus-remote -C "player-play")
and then cmus will start at the beginning of the track
of /path/to/some/great/stuff.m3u when i stopped the first time, instead
of the first track of /path/to/some/great/other_stuff.m3u
Well, this is how cmus works. It has a concept of «current» track —
and it does not change when you stop the playback. Workaround is
simple: after loading the new playlist, perform player-next instead of
player-play. This should work :-)

Gregory

g***@gmail.com
2012-09-11 18:10:32 UTC
Permalink
From: Gregory Petrosyan <***@gmail.com>

Reported-by: Tony Lapointe <***@neofreak.org>
Signed-off-by: Gregory Petrosyan <***@gmail.com>
---
command_mode.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/command_mode.c b/command_mode.c
index 45b6eae..dc26d08 100644
--- a/command_mode.c
+++ b/command_mode.c
@@ -2785,9 +2785,11 @@ void run_parsed_command(char *cmd, char *arg)
error_msg("too many arguments\n");
break;
}
- if (run_only_safe_commands && c->flags & CMD_UNSAFE) {
- d_print("trying to execute unsafe command over net\n");
- break;
+ if (run_only_safe_commands && (c->flags & CMD_UNSAFE)) {
+ if (c->func != cmd_save || !is_stdout_filename(arg)) {
+ d_print("trying to execute unsafe command over net\n");
+ break;
+ }
}
c->func(arg);
break;
--
1.7.12
Gregory Petrosyan
2012-09-11 18:13:37 UTC
Permalink
Post by g***@gmail.com
---
command_mode.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Tony — does this patch work for you? If so, I think it should be
merged (If noone will find any new security flaw, of course).

Gregory
Loading...