You are not logged in.

#1 2017-09-10 02:16:51

ap
Member
Registered: 2017-08-09
Posts: 47

[SOLVED] mocp play a song by double click

Hi All,
using mocp I would like to be able to double click a song in my file manager and the song starts playing in mocp which gets displayed in terminal.

Any hints on how to do that? By now I have created a .desktop file for mocp and I have

Exec=urxvt -e mocp

this opens mocp when I double click a song in my music folder, but the song that I selected with the double click doesn't start automatically and I need to press enter once in mocp.

I know it sounds a simple question, but although I have done my great deal of search I couldn't find a solution...also, I am a new mocp user.
Thanks in advance!

Last edited by ap (2017-09-10 07:57:15)

Offline

#2 2017-09-10 02:41:37

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 4,671
Website

Re: [SOLVED] mocp play a song by double click

Off the top of my head, try

Exec=urxvt -e mocp %F

John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#3 2017-09-10 03:20:33

ap
Member
Registered: 2017-08-09
Posts: 47

Re: [SOLVED] mocp play a song by double click

Hi johnraff,

thanks for the hint, I also tried this before but this just opens mocp but doesn't autostart the song I double clicked

Offline

#4 2017-09-10 04:45:12

Sector11
Tpyo Knig
From: 77345 ¡#
Registered: 2015-08-20
Posts: 5,149

Re: [SOLVED] mocp play a song by double click

Why not try the same as a Custom Action in Thunar?


BunsenLabs Forum Rules ---== I'm a Conky 1.9'er ==---
System:    Host: s12 Kernel: 3.16.0-4-amd64 x86_64 (64 bit gcc: 4.8.4)
Desktop: Openbox 3.5.2 dm: (startx) Distro: Debian GNU/Linux 8

Offline

#5 2017-09-10 05:11:28

ap
Member
Registered: 2017-08-09
Posts: 47

Re: [SOLVED] mocp play a song by double click

Hi Sector11,
the command used for the custom action I believe should be the same as the one for the .desktop file...then yes, I can use either the .desktop file or the custom action, but before I need to figure the right command smile thanks!

Offline

#6 2017-09-10 06:55:55

ohnonot
...again
Registered: 2015-09-29
Posts: 3,191
Website

Re: [SOLVED] mocp play a song by double click

ap, unfortunately mocp doesn't lend itself easily to this sort of action, but it is possible.

first of all, you don't need to use a terminal window.
all commands can be issued without opening moc's user interface.

you need a wrapper script that will be called from the .desktop file:

#!/bin/sh

mocp -S
mocp -s
mocp -c
mocp -q "$1"
mocp -p
#~ urxvt -e mocp # if you so desire you can add this at the end

and the desktop file:

[Desktop Entry]
Name=mocp-playnow
Icon=
Exec=/home/ap/bin/mocp-playnow %f
Terminal=false
StartupNotify=false
Type=Application
Categories=AudioVideo;Player;

caveat:
the current playlist will be cleared so that the song can start playing immediately.
otherwise it would just be appended to the end of the playlist.
i know of no other way to accomplish this with MOC.

Last edited by ohnonot (2017-09-10 06:56:27)

Offline

#7 2017-09-10 07:56:59

ap
Member
Registered: 2017-08-09
Posts: 47

Re: [SOLVED] mocp play a song by double click

Awesome, works exactly as requested! smile Thanks for the detailed and clear response, I'll mark it as solved :-D

Offline

#8 2017-09-10 09:05:42

ohnonot
...again
Registered: 2015-09-29
Posts: 3,191
Website

Re: [SOLVED] mocp play a song by double click

you're welcome :-)

Offline

Board footer

Powered by FluxBB