View previous topic :: View next topic |
Author |
Message |
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Tue Feb 28, 2006 9:44 pm Post subject: scmpc - (Another) Audioscrobbler client for MPD |
|
|
This is a project I've been working on (off and on) for about a year, but it's finally got to a stage where it looks like it might be suitable for release to the general public. I'm now looking for testers.
I know there are already a few clients out there, but none of them did quite what I wanted. At the time I started writing scmpc, mpdscribble hadn't been written yet, and I picked this as a project to teach myself C programming, mainly. Still, I haven't found a client that has all these features at once:
- scmpc can run as a daemon - it doesn't need to be backgrounded by the shell.
- It works with crossfading enabled.
- It's robust in terms of network connections - it'll keep running even if it can't connect to anything, and it will keep trying to reconnect except in a few fatal cases, such as passwords being rejected.
- It's multi-threaded, so the mpd and audioscrobbler parts can keep operating independently.
- It queues songs if they can't be submitted immediately, and this queue can be saved periodically as well as when the program exits, so it aims to keep track of all the tracks that you play.
You can use this ebuild to install it. You might have to adjust the KEYWORDS line for your architecture - if it works, please tell me and I'll add the arch here.
media-sound/scmpc-0.2.2.ebuild: | # Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils
DESCRIPTION="A multithreaded MPD client for Audioscrobbler"
HOMEPAGE="http://scmpc.berlios.de"
SRC_URI="http://download.berlios.de/${PN}/${P}.tar.bz2"
RESTRICT="primaryuri"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=">=net-misc/curl-7.10.0
dev-libs/libdaemon
dev-libs/confuse
dev-libs/argtable"
RDEPEND=""
src_install() {
make DESTDIR="${D}" install || die "Install failed!"
}
pkg_postinst() {
echo
einfo "You will need to set up your scmpc.conf file before running scmpc"
einfo "for the first time. An example has been installed in"
einfo "${ROOT}usr/share/scmpc/scmpc.conf, which can be copied to"
einfo "${ROOT}etc/scmpc.conf. For more details, please see the scmpc(1)"
einfo "manual page."
echo
} |
If you try it out, please let me know what you think! All feedback is welcomed. _________________ No-one's more important than the earthworm.
Last edited by Maedhros on Sat Dec 02, 2006 9:26 pm; edited 4 times in total |
|
Back to top |
|
|
truc Advocate
Joined: 25 Jul 2005 Posts: 3199
|
Posted: Fri Mar 03, 2006 7:35 pm Post subject: |
|
|
Do I have to run scmpc as root? if not, a few comments:
Code: | scmpc -n
2006-03-03 20:10:59 Cache file (/var/lib/scmpc/scmpc.cache) cannot be opened for writing: No such file or directory
|
I think the ebuild should create this. btw mkdir /var/lib/scmpc/ && chown root:audio /var/lib/scmpc did it (then the file scmpc.cache was created)
same with
Code: | scmpc
The log file (/var/log/scmpc.log) cannot be opened: Permission denied
Daemon failed to start.
|
Again, something has to be done..
sure we can create this file, -rw-rw-r-- 1 root audio 0 mar 3 20:15 scmpc.log but I'm not sure given write acces to the audio group is a good idea. May be creating a scmpc user would be a good idea? (as for mpd)
BTW, after creating it I still can't launch the daemon
Code: | scmpc
Daemon failed to start.
cat scmpc.log
2006-03-03 20:22:34 Could not create PID file (/var/run/scmpc.pid): Permission denied. |
(I know I could use the --pid-file option...)
Now I really do think creating a scmpc user can be a good idea, but I'm not a programmer I can be wrong
Well for now I can't launch the daemon (I don't know how to implement this user)
man scmpc deals with /etc/scmpc.conf but there isn't such a file, is this normal?
Hope this can help:)
EDIT: oh well after creating /var/lib/scmpc/, I can launch scmpc -n but I really don't know what to do with that? How do I add,queue songs and so on? |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Fri Mar 03, 2006 7:55 pm Post subject: |
|
|
truc wrote: | Do I have to run scmpc as root? |
No, but you will have to change the paths in which scmpc looks for files - this is that part of my config file:
Code: | log_file = "/home/jc/.scmpc/scmpc.log"
pid_file = "/home/jc/.scmpc/scmpc.pid"
cache_file = "/home/jc/.scmpc/scmpc.cache" |
truc wrote: | man scmpc deals with /etc/scmpc.conf but there isn't such a file, is this normal? |
There's an example configuration file in /usr/share/scmpc/scmpc.conf... I should have said something about that...
truc wrote: | EDIT: oh well after creating /var/lib/scmpc/, I can launch scmpc -n but I really don't know what to do with that? How do I add,queue songs and so on? |
You can't - it's not a client which will control MPD, it's just one that reads the song that MPD is currently playing and submits it to Audioscrobbler.
truc wrote: | Hope this can help:) |
Thanks a lot for trying it out. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Sat Mar 04, 2006 2:44 pm Post subject: |
|
|
I have tried it out and I must say it works quite well . Just copied that example config file (you should make ebuild do it automatically), changed paths to my ~/.scmpc as you suggested and works without a problem. Guess that I will replace mpdscribble with that, because this one is much smaller and can be run as user Good job and thanks for great client
P.S : ah, no problems also with UTF-8, you can check @ http://www.last.fm/user/werkon/ _________________ Regards,
WerK |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Sat Mar 04, 2006 6:16 pm Post subject: |
|
|
WerK wrote: | Just copied that example config file (you should make ebuild do it automatically) | I could do that, but it would be useless for people who aren't going to run it as root... I think I'll just make a comment somewhere about the package installing an example config file to /usr/share/scmpc.
WerK wrote: | Guess that I will replace mpdscribble with that, because this one is much smaller and can be run as user | Hmm, it's probably smaller because I use more external libraries than mpdscribble. You can run mpdscribble as a user too - the only things I know of that mpdscribble can't do that scmpc can is detect songs with crossfading enabled, and run in the background by itself.
That's good to know. The client doesn't actually do any text processing by itself, so it shouldn't have a problem with anything MPD can cope with, but there's always a chance I could have messed it up somewhere.
WerK wrote: | Good job and thanks for great client | Thankyou! _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Tue Mar 07, 2006 12:58 pm Post subject: |
|
|
I have found a little rather annoying issue with scmpc : when I shut down my comp using halt command everything is OK. But next time I start up my machine the scmpc which is started by my .xsession file complains about :
Code: | Could not create PID file (/home/werk/.scmpc/scmpc.pid): File exists. | I guess that it is something with permissions because my ls -la /home/werk/.scmpc/scmpc.pid returns :
Code: | ---------- 1 werk users 6 Mar 6 14:52 scmpc.pid | So there are no access rights. Removing the pidfile helps, but chmod 755 on pidfile doesn't :
Code: | Process 15644 died: No such process; removing PID file. (/home/werk/.scmpc/scmpc.pid) | and then when starting again :
Code: | Failed to open PID file: Permission denied
Daemon failed to start. |
EDIT : looks like i traced it to the point that 'pkill scmpc' terminates client OK but 'pkill -9 scmpc' creates that issue with pidfile _________________ Regards,
WerK |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Tue Mar 07, 2006 5:13 pm Post subject: |
|
|
Hmm, I've noticed some odd things happening there, too. If you send scmpc the TERM signal, which is the default with kill I think, it shuts down normally and removes the pid file. If you send it a KILL signal though it just dies - that's one of the two signals you can't catch. I'm going to try to add some code to change the permissions on the pid file back to something sensible before opening it, and see if that fixes it. I have no idea why the file gets its permissions changed to 000 though.
As for this message:
Code: | Process 15644 died: No such process; removing PID file. (/home/werk/.scmpc/scmpc.pid) |
I'm going to have to try to find a way of changing this because it's spectacularly unhelpful. What it actually means is that the process that created the pid file is no longer running, so there isn't another daemon running already. and scmpc will start up happily. That's part of some third party code though (libdaemon), so I'm not sure what I can do about it at the moment.
Edit:
Quote: | looks like i traced it to the point that 'pkill scmpc' terminates client OK but 'pkill -9 scmpc' creates that issue with pidfile | Is this reproducible, by the way? It does happen to me occasionally, but not when I want it to so I can find out why. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Tue Mar 07, 2006 7:13 pm Post subject: |
|
|
Maedhros wrote: | Is this reproducible, by the way? It does happen to me occasionally, but not when I want it to so I can find out why. |
I hope that this "session" log will help you
Code: | werk@V1046R .scmpc $ ls -la
total 36
drwxr-xr-x 2 werk users 4096 Mar 7 20:09 .
drwx------ 83 werk users 12288 Mar 7 20:08 ..
-rw-r--r-- 1 werk users 0 Mar 7 20:00 scmpc.cache
-rw-r--r-- 1 werk users 19928 Mar 7 20:09 scmpc.log
werk@V1046R .scmpc $ scmpc
werk@V1046R .scmpc $ ps axu | grep scmpc
werk 21325 0.0 0.2 36520 1252 ? Ssl 20:10 0:00 scmpc
werk 21331 0.0 0.1 2776 644 pts/2 R+ 20:10 0:00 grep scmpc
werk@V1046R .scmpc $ pkill -9 scmpc
werk@V1046R .scmpc $ ls -la
total 40
drwxr-xr-x 2 werk users 4096 Mar 7 20:10 .
drwx------ 83 werk users 12288 Mar 7 20:08 ..
-rw-r--r-- 1 werk users 0 Mar 7 20:10 scmpc.cache
-rw-r--r-- 1 werk users 19928 Mar 7 20:09 scmpc.log
---------- 1 werk users 6 Mar 7 20:10 scmpc.pid
werk@V1046R .scmpc $ scmpc
Failed to open PID file: Permission denied
Daemon failed to start.
werk@V1046R .scmpc $ rm scmpc.pid
rm: remove write-protected regular file `scmpc.pid'? y
werk@V1046R .scmpc $ scmpc
werk@V1046R .scmpc $ ps axu | grep scmpc
werk 21344 0.0 0.2 36516 1248 ? Ssl 20:10 0:00 scmpc
werk 21350 0.0 0.1 2772 640 pts/2 R+ 20:10 0:00 grep scmpc |
Ah, and the permissions on my ~/.scmpc are
Code: | drwxr-xr-x 2 werk users 4096 Mar 7 20:10 .scmpc |
_________________ Regards,
WerK |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Mon Mar 13, 2006 8:30 pm Post subject: |
|
|
Ok, I've released version 0.1.1 which should hopefully solve all this. I'm still not entirely sure why it was happening, but I suspect a 'umask(0777)' in daemon_fork that wasn't described anywhere, so any new files that got created got created with 0 permissions. daemon_pid_create which I used to use changed the umask before and after creating the file, so I'm still not entirely sure why it sometimes ended up with 0 permissions...
Sorry it tooks so long to reply to this, but I've been really swamped by work this week... _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Mon Mar 13, 2006 9:30 pm Post subject: |
|
|
Maedhros wrote: | Ok, I've released version 0.1.1 which should hopefully solve all this. I'm still not entirely sure why it was happening, but I suspect a 'umask(0777)' in daemon_fork that wasn't described anywhere, so any new files that got created got created with 0 permissions. daemon_pid_create which I used to use changed the umask before and after creating the file, so I'm still not entirely sure why it sometimes ended up with 0 permissions...
Sorry it tooks so long to reply to this, but I've been really swamped by work this week... |
Yeah Well done, I quickly checked it, and the PID issue is solved. Just "Old pid file removed." and everything works Thanks _________________ Regards,
WerK |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Mon Mar 13, 2006 9:51 pm Post subject: |
|
|
WerK wrote: | Yeah Well done, I quickly checked it, and the PID issue is solved. Just "Old pid file removed." and everything works Thanks |
Yay, I'm glad it works! Thanks for your help testing it, and your patience. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Fri Mar 24, 2006 8:19 am Post subject: |
|
|
Version 0.2.0 is out!
This has been pretty much completely rewritten, and it should fix a lot of potential bugs. The MPD code in particular was fairly broken before - I think the only reason it actually worked half the time was due to sheer luck.
There are no new features, but that's because so far it does everything I want. If anyone has any feature requests, tell me, and I'll see what can be done. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Sat Mar 25, 2006 9:23 pm Post subject: |
|
|
oops, looks like I have a problem with the most recent version. I noticed that new songs aren't appearing after a update so I ran it in foreground and debug enabled mode and I get this every time a song plays :
Code: | 2006-03-25 22:18:24 New song detected. [Brisk and Ham - Angel Eyes]
2006-03-25 22:20:40 Not submitting song, seeking detected.
2006-03-25 22:20:40 realtime = 136.000000, reported_time = 152.000000 | for example (of course that I'm not seeking in the song, I'm using gmpc or eloquence e17 module to control mpd) _________________ Regards,
WerK |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Sun Mar 26, 2006 8:46 pm Post subject: |
|
|
That's very odd. Have you got crossfade enabled? Does the new song get reported by scmpc instantly when it starts playing? The realtime value is at least consistent with the timing in the log, so it must be something odd about the reported_time value. Does that value make sense for it to be half way through the song? _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
WerK Tux's lil' helper
Joined: 05 Mar 2005 Posts: 96 Location: Prague, Czech Republic
|
Posted: Tue Apr 04, 2006 11:57 am Post subject: |
|
|
It looks like some of mine mp3's are b0rken ... it does that only with some songs and not with others, the problem probably isn't in your program. _________________ Regards,
WerK |
|
Back to top |
|
|
zeppelin_II n00b
Joined: 01 Apr 2006 Posts: 10
|
Posted: Sun Apr 23, 2006 2:31 pm Post subject: |
|
|
do last.fm changed their submission addres ?
Code: | 2006-04-23 16:30:32 Could not connect to the audioscrobbler server: couldn't connect to server |
mpdscribble don't work too, but http://last.fm does. :\ |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Sun Apr 23, 2006 3:06 pm Post subject: |
|
|
No, they've just turned off song submissions for a while: http://www.last.fm/forum/21713/_/51596. _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
zeppelin_II n00b
Joined: 01 Apr 2006 Posts: 10
|
Posted: Mon Apr 24, 2006 7:19 am Post subject: |
|
|
oh, yes missed that, now everything is working fine |
|
Back to top |
|
|
REDONDOS n00b
Joined: 10 Feb 2005 Posts: 13
|
Posted: Sat May 13, 2006 10:29 pm Post subject: |
|
|
Hello. I've been using mpdscribble until someone (rc0) suggested scmpc on the last.fm gentoo forum.
What I like about scmpc is that:
a) It keeps a cache file. I haven't tested it much, but I have the feeling I won't be losing any more submissions.
b) Works with crossfading enabled. I never questioned myself why mpdscribble didn't work with it.
c) It's simpler. I inserted it into my mpd init script, and it hasn't ever given me a problem. Of course, I just installed it.
Here's what I added:
start-stop-daemon --start --quiet --exec /usr/bin/scmpc -- -f /home/redondos/.scmpc/scmpc.conf
start-stop-daemon --stop --quiet --exec /usr/bin/scmpc --oknodo
While this is what I have for mpdscribble, after a while of experimenting with it:
CONF=/home/redondos/.mpdscribble/mpdscribble.conf
start-stop-daemon --start -p /var/run/mpdscribble.pid -b -m --exec /usr/bin/mpdscribble -- --conf $CONF --verbose 1
start-stop-daemon --stop --quiet -p /var/run/mpdscribble.pid -m --exec /usr/bin/mpdscribble || eerror "mpdscribble is not running"
Of course, I am only showing the relevant lines. Just in case anyone needs them!
Thanks, and cheers.
--
redondos |
|
Back to top |
|
|
kesara n00b
Joined: 05 Aug 2004 Posts: 69 Location: Sri Lanka
|
Posted: Fri May 19, 2006 10:22 am Post subject: Nice Program |
|
|
This program works fine on my system.
And as REDONDOS mentioned it is a good idea if you add a scmpc init script.
Right now I'm using my own init script to start scmpc.
Thx Maedhros and Keep up the good work.
BTW This is my scmpc init script..
Code: | #!/sbin/runscript
depend() {
need net mpd
}
start () {
ebegin "Starting scmpc"
start-stop-daemon --start --exec /usr/bin/scmpc
eend $?
}
stop () {
ebegin "Stopping scmpc"
start-stop-daemon --stop --exec /usr/bin/scmpc || eerror "scmpc is not running"
eend $?
}
|
_________________ ---==>K3<==---
kesara.lk |
|
Back to top |
|
|
OgRo Tux's lil' helper
Joined: 04 Jun 2004 Posts: 108 Location: Sampa - SP - Brasil
|
Posted: Sat May 20, 2006 11:35 pm Post subject: |
|
|
nice
it seems to be a great package.
will it ever be in portage? _________________ ---
OgRo
Linux user #297942 |
|
Back to top |
|
|
Maedhros Bodhisattva
Joined: 14 Apr 2004 Posts: 5511 Location: Durham, UK
|
Posted: Mon May 29, 2006 7:09 pm Post subject: |
|
|
I've just released 0.2.1, which is just a bugfix release really. If you find any more bugs, please let me know - and I think I've now setup Berlios to email me when someone files bugs, after I discovered there was one sitting there for nearly a month before I found it.
Thanks for the init script, kesara! OgRo, it probably won't be getting into portage anytime soon as it probably isn't widely used enough, I don't think. By the way, if any of you have any ideas for something else this program should do, please tell me. Perhaps dropping root privileges for when it's being run by an init script? _________________ No-one's more important than the earthworm. |
|
Back to top |
|
|
GentlemanFinn Tux's lil' helper
Joined: 19 Jul 2005 Posts: 85 Location: Denmark
|
Posted: Tue May 30, 2006 2:46 pm Post subject: |
|
|
Maedhros wrote: | I've just released 0.2.1, which is just a bugfix release really. If you find any more bugs, please let me know - and I think I've now setup Berlios to email me when someone files bugs, after I discovered there was one sitting there for nearly a month before I found it.
Thanks for the init script, kesara! OgRo, it probably won't be getting into portage anytime soon as it probably isn't widely used enough, I don't think. By the way, if any of you have any ideas for something else this program should do, please tell me. Perhaps dropping root privileges for when it's being run by an init script? |
Great to hear about a new version of my favorite audioscrobbler client for MPD, just when I came here to file a bug, where scmpc would spame it's log with 'Could not get current song: Connection timed out'.
I'll test the new version and see if it's still there.
Dropping root privileges when run by an init script, would be a feature I'd be lookng forward to, at the moment I'm starting it with '--chuid $USER:user' but I would prefer running it as none root, the same way as MPD
Edit: remember to update the ebuild to reflect the update to 0.2.1 |
|
Back to top |
|
|
bladus Apprentice
Joined: 27 Jul 2005 Posts: 233
|
Posted: Tue May 30, 2006 6:08 pm Post subject: |
|
|
I have a problem with the connection to audioscrobbler.
scmpc reports
Code: | 2006-05-30 21:04:51 No username or password specified. Not connecting to audioscrobbler. |
but i set everything correctly in my config.
Code: | audioscrobbler {
username = "bladus"
password = "***"
} |
Edit: Okay i solved the problem.
scmpc didn't load the config file, i had to pass it with "scmpc -f /usr/share/scmpc/scmpc.conf". I thought this is the standard-path for the config?
It runs very good on my amd64, so you can add the ~amd64 keyword to the next ebuild.
For the next version, it would be cool if scmpc wouldn't overwrite the config after an upgrade.
Keep up the good work!
Edit2: I just read through the man-file and noticed that scmpc doesnt look at /usr/share/scmpc/ for the config file. I think the config-file should be copied at /etc/ when installing scmpc, or there should be at least an info-msg in the ebuild like "An example config is in xxx, ...". |
|
Back to top |
|
|
zedek n00b
Joined: 24 Mar 2006 Posts: 10 Location: Reims, France
|
Posted: Mon Jul 03, 2006 9:19 pm Post subject: It even does not compile here :( |
|
|
i686-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -s -lpthread -largtable2 -lcurl -ldl -lgnutls -lgcrypt -lgpg-error -lz -lconfuse -ldaemon ./src/audioscrobbler.o ./src/libmpd.o ./src/md5.o ./src/misc.o ./src/mpd.o ./src/preferences.o ./src/scmpc.o -o src/scmpc
./src/audioscrobbler.o: In function `cache_thread':
audioscrobbler.c.text+0x591): undefined reference to `pthread_testcancel'
./src/audioscrobbler.o: In function `as_submit_queue':
audioscrobbler.c.text+0x72f): undefined reference to `curl_escape'
audioscrobbler.c.text+0x767): undefined reference to `curl_free'
audioscrobbler.c.text+0x7d9): undefined reference to `curl_escape'
audioscrobbler.c.text+0x7f0): undefined reference to `curl_escape'
audioscrobbler.c.text+0x809): undefined reference to `curl_escape'
audioscrobbler.c.text+0x820): undefined reference to `curl_escape'
audioscrobbler.c.text+0x88c): undefined reference to `curl_free'
audioscrobbler.c.text+0x898): undefined reference to `curl_free'
audioscrobbler.c.text+0x8a0): undefined reference to `curl_free'
audioscrobbler.c.text+0x8a8): undefined reference to `curl_free'
audioscrobbler.c.text+0x98a): undefined reference to `curl_easy_setopt'
audioscrobbler.c.text+0x9a5): undefined reference to `curl_easy_setopt'
audioscrobbler.c.text+0x9c3): undefined reference to `curl_easy_setopt'
audioscrobbler.c.text+0x9d1): undefined reference to `curl_easy_perform'
audioscrobbler.c.text+0xbe9): undefined reference to `curl_easy_strerror'
It is on ~x86 with GCC 4.1.1 |
|
Back to top |
|
|
|