Stable: 2.5.2
Development: 2.6-alpha3
I've installed 2.5.0alpha from Elimar's repository
in config I've got:
OnSongChange = "/home/pawian/.skrypty/moc_now_play %r - %t [%a]"
to show new song via OSD, unfortunately nothing happens when on songs change
script works (tested manually)
hiben
Wed, 2007-03-07 18:59
Permalink
I just tested this and had
I just tested this and had the same problem.
OnSongChange is working but your environment is missing.
Try adding this (adapt to your local setup) in the head of you script :
azhag
Wed, 2007-03-07 20:08
Permalink
thanks, after add those
thanks, after add those exports it really works
---
btw. there's mistake in variables, in example config is
but in practice it is
daper
Wed, 2007-03-07 20:24
Permalink
Thanks, I've fixed
Thanks, I've fixed config.example.
--
Damian Pietras - MOC developer
azhag
Thu, 2007-03-08 18:42
Permalink
Could you add similar
Could you add similar function OnMOCStop?
daper
Fri, 2007-03-09 06:54
Permalink
What would be the use for
What would be the use for that? I'm aware that the current OnSongChange option is not really enough, but with OnMOCStop it's still probably not enough, so I want to know some use cases.
--
Damian Pietras - MOC developer
azhag
Fri, 2007-03-09 08:11
Permalink
I'm using OnSongChange to
I'm using OnSongChange to show current song with osd_cat, with OnMOCStop I'll can view information that player is stopped (not always it is posible to realize - some tracks, often last tracks on album, includes two songs: first "official" song, some time of silence and "hidden" song).
Also it's possible to shutdown system when music is off (I like to listen to some music when I'm falling in sleep), now I need to run two applications: mocp and shutdown -h
I asked if it's possible. If that function needs a lot of work I'll understand and accept when it will not be merged.
But if it's easy to do, I'm sure some people will use that option.
awagner
Mon, 2007-03-26 22:40
Permalink
Cmdline-triggerable ExeCmd
Hi,
I have made a copy of the on_song_change function, provided it with a commandline switch and am using it to xosd-display the current song title on keypress (and not only when the songs change). Coming to think of it, it probably would have been better to jut parse the output of `mocp -i`, but I didn't think of that in time. ;)
I suppose your question was aimed rather at what additional events should get a special role, so you may or may not be inspired by my idea of having a custom command executed per cmdline argument. Anyway, I'll take the opportunity to just thank you a lot for the incredibly fine program that moc is.
With the sparse knowledge I have of things such as these, I have put up a diff file in case you're interested:
http://1t2.us/310
Cheers,
Andreas
daper
Fri, 2007-03-30 20:08
Permalink
Interesting, but using `mocp
Interesting, but using `mocp -i` is really better :)
OT: haven't seen this PasteBin service before, looks very nice.
--
Damian Pietras - MOC developer
maxim.b
Wed, 2007-03-28 18:08
Permalink
Maybe?..
..make OnEvent execution and pass the event name to the script; for example - "play", "pause", "songchange", "stop", "exit" will suite the most needs, I guess.
daper
Fri, 2007-03-30 20:11
Permalink
Sound good, but if there
Sound good, but if there were events that occur often (for example every 1s if such things will be ever needed) it would slow down MOC especially if the script is a perl/java or something that starts up slowly.
--
Damian Pietras - MOC developer
maxim.b
Sat, 2007-03-24 18:00
Permalink
A tricky moment with OnSongChange
It`s a funny thing - just as I wanted to emerge myself in writing a patch for mocp to support script executions on song changes, a new version comes.. It'll make me damn lazy :)
But the moment is, that I want to change my Gajim status on song change. So I write a small script which executes gajim-remote, checks the current status, and sets the status-message.
#!/bin/bash
current_status=$( gajim-remote get_status )
exec gajim-remote change_status $current_status "Listening to: \"$1 [$2] - $3\""
The script works perfecly when I execute it myself, from the shell - but when mocp executes it, gajim-remote is not executed from it.
The problem here is not in mocp at all, but in the gajim-remote, which is a bash script itself, which is calling a python script in sequence. By small testing I found out that in the script which is executed by mocp I can perfectly execute any binary, but not a python script.
Is there a way to fix it? (probably, some environment variables must be set, or something)
---
Thanks for the great work, Damian!
daper
Sat, 2007-03-24 21:27
Permalink
Any error message? Try
Any error message?
Try adding this after
#!/bin/bash
:and see if there are any errors in /tmp/moc_script_debug
--
Damian Pietras - MOC developer
maxim.b
Sun, 2007-03-25 09:37
Permalink
You were right
There're lots of error output from gajim-remote it the stdout.
Seems that gajim-remote can not get the address of DBus session - $DBUS_SESSION_BUS_ADDRESS is empty in the script.
daper
Sun, 2007-03-25 12:56
Permalink
I see the problem, try this
I see the problem, try this patch: ftp://ftp.daper.net/pub/soft/moc/patches/moc-2.5.0-alpha1-onsongchange-env.patch
(apply with patch -p0 < moc-2.5.0-alpha1-onsongchange-env.patch)
On my system the DBUS_SESSION_BUS_ADDRESS variable is set only in X terminals, so probably the MOC server must be started from inside X.
--
Damian Pietras - MOC developer
maxim.b
Sun, 2007-03-25 18:36
Permalink
Great!
Compiled with the patch, it works! Thanks a lot!
eleventhcrane
Sat, 2010-09-11 16:59
Permalink
OnSongChange for repeated song?
To get the ol' dopamine flowing, I often play one song over and over again. OnSongChange, however, doesn't activate every time the song has been played---it only activates after the first (or the last...I'm not positive which it is) play of the song.
I'd imagine there's a good reason for this from a programming standpoint, but when it comes to submitting stuff to last.fm through lastfmsubmitd, it means tracks that I might listen to 15 times in a row are only logged once. Is there any possibility that a future version of moc might have OnSongChange activate when a song is repeated?
Thanks
deki
Fri, 2011-04-08 15:54
Permalink
I would also prefer that
I would also prefer that OnSongChange is executed every time a song is started, even if it is the same song as before (because of scrobbling via lastfmsubmitd).
jcf
Fri, 2011-04-15 20:31
Permalink
FIXED
Resolved by r2269: Added 'RepeatSongChange' option.
deki
Sun, 2011-09-11 13:46
Permalink
When RepeatSongChange is on,
When RepeatSongChange is on, it now also executes the specified command when pausing and resuming a song (even if it is just for a few seconds). That is not the desired behavior imho, as you e.g. want to scrobble the song only if a new song starts (even if it is the same song as before).
jcf
Mon, 2011-10-17 02:50
Permalink
FIXED
You're right, it shouldn't do that.
Fixed and committed to SVN as r2364.