Build an iTunes Remote Control
Subject:   Doesn't work
Date:   2005-03-19 13:47:11
From:   ptwobrussell
Response to: Doesn't work

So when you type http://localhost:81/cgi-bin/ into your web browser (for the simple perl file I pasted in earlier that simply printed a line of text, you get a download option instead of getting a simple webpage? This is expected because the content type is specified to be "Content-type: text/vnd.wap.wml"--which your browser on your computer can't understand (but your phone or a WAP emulator can understand; see page one of the article). Try replacing that line with "Content-type: text/html\n\n" and your browser should then be able to display it. If this checks out, CGI is working.

So the first step thing to do is to use a wap emulator and get your file to display for you...but based on your comment that "The Page with the links for or to commands does show", this is already happening? (Otherwise, you wouldn't be getting that menu.) If this is the case, the page containing the menu is WAP content served with perl.

Once your server is configured to process the perl scripts and serve you wap content (which it appears to be), you can then start up the background daemon and try to get the iTunes stuff working. Given that the CGI is working, the only other thing that wouldn't be is your background daemon.

You are firing up the background daemon, and have verified that the file it expects to read ( /tmp/iTunesRemoteControl) does exist? If perl is rendering the menu for you, it should also be writing that file to the /tmp directory.

If I've misunderstood anything you've said, clear it up and let's go from there.


Full Threads Oldest First

Showing messages 1 through 8 of 8.

  • Doesn't work
    2005-03-19 14:50:19  Cool6324 [View]

    I am able to see the text in my regular web broswer when I chanhe the content type.

    I am able to see the page with WAP.

    How do I start the backrond daemon? I dropped file into terninmal and the scripts started working, but now it just stoped. I'm not sure what command I used if any to get it to start.

    and tmp/itunesRemoteControl does exist, the file s their.
    • Matthew Russell photo Doesn't work
      2005-03-19 14:59:57  Matthew Russell | O'Reilly AuthorO'Reilly Blogger [View]

      This might be a good time to review the usage header in the daemon script and walk through it once or twice to understand how it does its business. You just start it like any other script only you might find it convenient to end it with an ampersand so it doesn't lock your terminal and so you don't have to keep an extra window open.

      If you type "ps -aux" in a terminal, you'll get a list of everything running, and the daemon should be there if it's running. This is the same technique that the kill script uses to find it and kill it whenever you want to shut it down or restart it. Take a look at the latter part of page 2 in the article and checkout the README file included with the scripts.

      I think you should be up and running now. Thanks for sticking with it.

      • Doesn't work
        2005-03-19 15:15:19  Cool6324 [View]

        It still isn't working. Should I place a command before the file in terinmal before running, I dont see it in the lists of running items.
        • Matthew Russell photo Doesn't work
          2005-03-19 15:22:22  Matthew Russell | O'Reilly AuthorO'Reilly Blogger [View]

          From the header of the daemon script:

          Usage: prompt$./iTunesRemoteControlDaemon.scr &

          So what this assumes is that you're in the same directory as this script (and that you've set it to be executable with "chmod u+x"). Just like any other script, when you type in ./someScriptName, it will execute if it's executable. Placing the ampersand should return your prompt to you. At that point, if you type in "ps -aux | grep iTunesRemoteControlDaemon.scr", you should see it without having to filter through anything.

          Does that work for you?


          • Doesn't work
            2005-03-19 15:31:10  Cool6324 [View]

            Sorry for the noob questions what's ampersand and where should I write that? Do you have AIM? If so mines is AIM: Seanpaul316
            • Matthew Russell photo Doesn't work
              2005-03-19 15:36:44  Matthew Russell | O'Reilly AuthorO'Reilly Blogger [View]

              Ampersand is "&" --the thing that's in the usage line that sets the script to run in the background. It's a standard terminal thing.

              Try skipping the ampersand for now. Just get the script to run. If you run the script and it keeps your prompt, it's running. Open up another terminal window and go about doing other things. When you're satisfied that things are running, you can use the ampersand and have one less window open.

              • Doesn't work
                2005-03-19 15:58:12  Cool6324 [View]

                Works great, I just restarted and it ran script again, works good. Will this automatically work after a restart?

                BTW, I'm using a Motorola i730, Nextel, with basic WAP service. Works nice.

                TIP: When you want to use the same command more than once, ie. Fast Foward it's better to use the reload button.

                And last, THANKZ!!! I also learned alot about the way the terinmal works.