Hey, I know there are a lot of Linux users here, so… Can anyone help me? Please, assume I know nothing about this stuff. =D
I’ve read that the new version of Juk (KDE 3.5) sends out a dcop signal when the song that’s playing switches to a new one. However, I have no idea how to use this signal. I have a small program written in Perl that outputs the current song to my LED display. Now, remember, I am not a programmer, nor do I really know much about Linux. So my program basically is a continuous loop that compares the song value (from a “juk player playingString()” call) to the stored song value, and either updates the stored (if it’s different), or does nothing and goes through the loop again.
I know, I know… You can laugh all you want. It gets the job done, okay?
Then I came across this:
Wow. If I could only harness the power of this Juk-emitted signal, I could eliminate all my continuous endless loopness from the program!
However, that’s where I hit a dead end. Google searches are, for the most part, fruitless. The only other mention I’ve seen is this script written in Ruby, and understand it even less than my own Perl script!
Yeah, I found that PDF a long time ago, but it pre-dates the “trackChanged” dcop signal. It was actually pretty useful when I first created the script, but not so much now that I’m trying to utilize the “trackChanged” signal.
Oh, I also checked in Kdcop, but it didn’t have anything about “trackChanged” listed. Probably because it’s not a call you can make, but something that Juk itself sends out.
Like I said, I’m way over my head here, and google simply isn’t helping me at all this time.
[size=75](And I’m not sure that there’s anything you can do about the loopyness–I’m fairly loopy naturally. ;D Hehe.)[/size]
Ah, OK. So far I have not even found the trackChanged signal. However, I have figured out how to control juk from the command line! So, I am making some progress. I have not even seen the trackChanged propery/signal listed anywhere by the dcop command. I have tried using
dcop --user dalew juk Player
which lists the items you can access for the player part of juk. No listing I have tried shows the trackChanged signal though.
I have been able to get the various track properties, such as track number, track title, etc. into variables from the command line. So far, I am not finding a way to access that trackChanged property though, but I will continue looking.
I am starting to wonder if the trackChanged signal just has not been incorporated into the dcop program yet.
Eh, that’s really odd, since both the Wiki and the Ruby script I linked to mention or use it. (Did you check out the Ruby script? I can’t make heads or tails of it.)
Yeah, I can get that, too. I use the “QString playingString()” property something like
variable = `juk Player playingString()`
to get the current information, formatted like this: “Artist - Song Title”. But I don’t know how to use any of the dcop information that starts with “void”, like “void play()” or, the one I really care about, “void Player::trackChanged()”.
Ok, stupid question. Two stupid questions, actually. What do you mean by the dcop program? And just making sure, but you have KDE 3.5, right? Because the “void Player::trackChanged()” thing was implemented in 3.5, according to the documentation in the wiki I linked earlier.
I did look at the Ruby script, and even downloaded and tried to run it. However, I have to install the korundum module, or whatever it’s called, which I apparently need to build from sources. Debian doesn’t have a package for that module. I can’t learn a new language right now.
In most cases where you see something like “void play()”, you can just use the function name for the operation to perform. This: “dcop juk Player play” would work. I’ll work on this some more when my head isn’t hurting.
Yes, I am running the latest KDE 3.5.5 or whatever the latest actually is.
The dcop program is a command line interface to the whole DCOP mechanism. If you do just the “dcop” command alone, it will show you the things you can access using the DCOP mechanism. Then you can use “dcop juk” to see what parts of juk you can control via DCOP, and just drill down from there until you get “dcop juk Player” and finally “dcop juk Player play” to start juk playing. It’s really quite nice program to know how to use from the command line.
I can do:
dalew@intrepid:~$ tracktitle=`dcop juk Player trackProperty Title`
dalew@intrepid:~$ echo $tracktitle
Take a Chance on Me
which gets me the track title of the song currently playing into the shell variable tracktitle. I can then process the nformation anyway I might need to. The tildes are significant in the above commands.
BTW, the only stupid question is the one you DO NOT ask…
Unfortunately, it is again a mere mention of this supposed dcop signal, with no further information available.
I’ve decided to go about trying to find information on generic dcop signals, in the hope that perhaps I can glean enough knowledge to apply toward Juk’s signal.
Looks like there might be some useful information there toward the bottom, but I’m not well-versed enough with either Linux or programming in general to really know for sure. =D
I also dug around in Kdcop, but I couldn’t find anything there, either.
There is KDE Forum, but I have not found anything real useful about DCOP there yet. I really think this is so new to JuK that it just hasn’t been documented yet, or at least not anywhere but in code. When I get back into Linux next, I will see if I can find something useful in the JuK code.
Oh, thanks! That’ll be extremely helpful. I think I’m going to take a slight breather from this project, as I can’t find any information on my own. I’m getting frustrated with the lack of information on the web. So please let me know what you find when you have a chance to get your codin’ hands dirty, eh?
Of course, although I say I’m taking a break, I’ll still be searching for the Holy Grail of dcop information. If I can just figure out this whole signal thing, it should be easy… Maybe I’m just going to have to break down and learn Ruby so that I can utilize that script I linked to earlier.
C’mon, I’ve taken C++ classes. It can’t be that different… Can it?
Well, I think I’m about to call the Juk-DCOP-signal-thing quits. I just can’t actually find any useful information, and from what I’ve read about DCOP signals in general, your program still has to loop and check for the signal anyway, which isn’t really what I wanted.
Ideally, I could tell Juk to run a script every time a song is played, or somehow hook a script into Juk itself which would do the same thing. Unfortunately, I’ve no idea how I’d go about doing this, so I suppose I’ll have to make do with my loopy script.