Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    16

    Problems with controlling my squeezeboces via my homepage?!

    Hi,

    I'm trying to control my Squeezeboxes via my homepage. Both, apache-server and LMS, are running on an RPi in the same network.

    The way I do it till now, looks like this:

    Code:
    .... see second post... can't post it here, because I don't habe enough posts.

    The problem with this is, that it will open a new window, everytime I click on this image. How to avoid things like this. Or is there another/ better way to control the lms via a homepage?

    I have to admit, that I#m new to webdesign and the http-acces of the lms.

  2. #2
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Code:
    <a href="<?echo $LMSUrl;?>status.html?p0=play&player=00%3A04%3A20%3A1e%3Ae1%3A11">
    	<img id="togglePlay" src="graphics/mediaplayer/play.png" width="48px">
    </a>
    <a href="http://LMSUrl:9000/status.html?p0=button&p1=volume_down&player=MACAdress" target="_blank" >
    	<img id="volumeminus" src="graphics/mediaplayer/volume-minus.png" width="24px">
    </a>

  3. #3
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,629

    Problems with controlling my squeezeboces via myhomepage?!

    > The problem with this is, that it will open a new window, everytime I
    > click on this image. How to avoid things like this. Or is there another/
    > better way to control the lms via a homepage?


    What you've created is a link to a different URL. When you click a link,
    it will open the document referred to by the URL. That's just normal
    HTML behaviour. If you don't want this, then you'll have to get a little
    more involved, and use JavaScript etc.

    --

    Michael

  4. #4
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    hi Michael,

    do you have an advice what I have to search for? Because all I found, were the normal link behavior and not the "hidden" link behavior.

  5. #5
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,629

    Problems with controlling my squeezeboces via myhomepage?!

    > do you have an advice what I have to search for? Because all I found,
    > were the normal link behavior and not the "hidden" link behavior.


    If you want to control LMS from a web page you publish using Apache or
    other you're going to face several potential issues:

    - the simple link as you've been using it is not the user experience you
    want

    - you could use an iframe on your web page, pointing your links to that
    iframe. The linked document would then be opened in that frame instead
    of in your window directly. If you make the iframe small, this might be
    the kind of "hidden" link you want. But tbh. I'm not sure this is
    allowed in all browsers. You'd have to test this.

    - The JavaScript solution probably won't work due to its "cross-site
    scripting" nature: you usually can't access a different server than
    where you loaded the script from, as this is a potential security breach.

    Now the question is: do you really need to serve up that page from
    Apache? You could use LMS' built-in web server to provide that page instead.

    --

    Michael

  6. #6
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Good Morning,

    If you want to control LMS from a web page you publish using Apache or
    other you're going to face several potential issues:

    - the simple link as you've been using it is not the user experience you
    want

    - you could use an iframe on your web page, pointing your links to that
    iframe. The linked document would then be opened in that frame instead
    of in your window directly. If you make the iframe small, this might be
    the kind of "hidden" link you want. But tbh. I'm not sure this is
    allowed in all browsers. You'd have to test this.

    - The JavaScript solution probably won't work due to its "cross-site
    scripting" nature: you usually can't access a different server than
    where you loaded the script from, as this is a potential security breach.
    Yes these are the problems I'm faced with.
    The solution with the iframe I already tested, but couldn't open an external URL be it the LMS-Homepage or spiegel.de. Is this a problem of the iframe or ran I into some "Cross Site Request Forgery" (CSRF) problems, so that nothing happens, when I was using the iframe.
    Few days ago I found an article about the CSRF problem, but have to admit, that I don't get, which solution could be the best for my problem. http://tutoriels.domotique-store.fr/...ayer-http.html
    As you realize there are too many unknown techniques for me, so that I can't figure out which will be the best. Perhaps sb. has a better understanding of the CSRF problematic or a link where they explain it.


    Now the question is: do you really need to serve up that page from
    Apache? You could use LMS' built-in web server to provide that page instead.
    No I don't need to serve up the the page from apache, but will the built-in lms webserver provide me with the same functions (php, access to files and MySQL) like apache did? Don't wanna mess with the lms installation.

  7. #7
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,629

    Problems with controlling my squeezeboces via myhomepage?!

    > No I don't need to serve up the the page from apache, but will the
    > built-in lms webserver provide me with the same functions (php, access
    > to files and MySQL) like apache did? Don't wanna mess with the lms
    > installation.


    No, LMS doens't provide php. But what's the goal you want to achieve?
    Maybe we should step back a bit to see what options you have. If you run
    PHP on Apache, you could eg. have Apache talk to LMS, then serve up the
    content to your page etc.

    --

    Michael

  8. #8
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    No, LMS doens't provide php. But what's the goal you want to achieve?
    Maybe we should step back a bit to see what options you have. If you run
    PHP on Apache, you could eg. have Apache talk to LMS, then serve up the
    content to your page etc.
    My main goal is a website, which fits my interest the most.
    One part of this website is the control of my squeezeboxes. The lms website is quite good, but a little bit too "overloaded" for my interests. So I decided to make my own, personal interface, which should be usable with mobile as well.
    What I have in mind till now is the control of the LMS (play/stop/louder/next/add song etc.) and the search/browse of the lms-music-database if possible.

    The first and (easiest?!) solution I found to control the LMS was the HTTP-Access e.g.
    Code:
    http://10.0.1.201:9000/status.suffix?p0=param&p1=param1&p2=param2&p3=param3
    Of course this won't work with the search/browse of the database, but this was a task I would be confronted later.

    So you were mentioning that the apache could talk to LMS. Do you have a tutorial how apache can "talk" to LMS?

    thx, for your patience.

  9. #9
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,629

    Problems with controlling my squeezeboces via myhomepage?!

    > My main goal is a website, which fits my interest the most.
    > One part of this website is the control of my squeezeboxes. The lms
    > website is quite good, but a little bit too "overloaded" for my
    > interests. So I decided to make my own, personal interface, which should
    > be usable with mobile as well.
    > What I have in mind till now is the control of the LMS
    > (play/stop/louder/next/add song etc.) and the search/browse of the
    > lms-music-database if possible.


    There are many ways to achieve this. But you'll have to know either
    client side technologies (JS, HTML etc.) or server side (PHP). Decide
    what method you'd prefer.

    > The first and (easiest?!) solution I found to control the LMS was the
    > HTTP-Access e.g.
    >
    > Code:
    > --------------------
    > http://10.0.1.201:9000/status.suffix...ram2&p3=param3
    > --------------------


    This would work if the page with the link was served by LMS. Now you
    could implement the control in LMS and show it on your page inside an
    iframe. Just one more possibility.

    > So you were mentioning that the apache could talk to LMS. Do you have a
    > tutorial how apache can "talk" to LMS?


    Not apache itself, but whatever server-side programming language you
    plan to use. PHP could use json/rpc interface to communicate with LMS.

    --

    Michael

  10. #10
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Okay, this explanation helps me a lot, what kind of communication with the LMS is feasible.

    So my preferred website would look like this.

    Representation of the control and database on the client via Javascript.
    Communication of the website via Ajax to a php-file on the server.
    Communication with the LMS via the php-file, e.g. json/rpc interface.

    For the first two points I will find the solution on the internet and it is not really correlated with the LMS-problematic. But could you please send me a link/tutorial/something to read, for the last point, how the json/rpc interface works.

    Thx in advance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •