Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    I got some "workaround" which seems to meet the purpose of the LMS-WebServer...
    Now the content of the specific files is shown in a html-page. I read the file content into that page and get the content there...

    As always, I now have another issue:
    The new page is opened in a new windows/browser frame, which seems feasible as the file content might be needed to adjust/control the settings.
    In that new windows/browser frame I do not get all frames anymore. I thought of the same behaviour as simply loading a new plugin-settings-page into the LMS GUI, but all menu items, css-styles, params etc. are lost...
    I only see my file content plus very very scarse LMS-layout elements...

    Do you maybe now what I have to source or where I have to look to get around that issue?
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

  2. #12
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    15,388
    Quote Originally Posted by chincheta0815 View Post
    I got some "workaround" which seems to meet the purpose of the LMS-WebServer...
    Now the content of the specific files is shown in a html-page. I read the file content into that page and get the content there...

    As always, I now have another issue:
    The new page is opened in a new windows/browser frame, which seems feasible as the file content might be needed to adjust/control the settings.
    In that new windows/browser frame I do not get all frames anymore. I thought of the same behaviour as simply loading a new plugin-settings-page into the LMS GUI, but all menu items, css-styles, params etc. are lost...
    I only see my file content plus very very scarse LMS-layout elements...

    Do you maybe now what I have to source or where I have to look to get around that issue?
    I don't know what you are trying to do ?
    First it looked like you were serving up JSON data , then a text file - now you want a html page ?

    To get LMS style etc - usually will need to go thro the templates and let LMS post process your HTML templates.

    It would be best to describe what you want to do ?
    Open a panel (LHS or RHS) when playing ?
    Open a new tab in Settings page ?
    Open a new entry in a drop down of existingf Settings?

    Your implementation should also consider whether you need an equivalent on Squeezeplay as that will affect design ?

    If you describe what you want to achieve functionally (not how you think it will/should be implemented) - then I might be able to point you to an existing similar implementation

  3. #13
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    Quote Originally Posted by bpa View Post
    I don't know what you are trying to do ?
    First it looked like you were serving up JSON data , then a text file - now you want a html page ?

    To get LMS style etc - usually will need to go thro the templates and let LMS post process your HTML templates.

    It would be best to describe what you want to do ?
    You are totally right: I shoud tell what I want to do...

    I am working on a plugin similar to the ones of philippe_44 (the LMS-to-X series).
    Based on philippe's framework I am working on a bridge that received audio from LMS and converts it to Light/Disco action using a Philips Hue.
    So far this binary is growing and improving... (see: https://github.com/chincheta0815/LMS-to-Hue/)

    Of course, I also need a plugin part for LMS.
    LMS shall be used for discovering and connecting to the hue (it needs a connect routine for a username) and for doing some settings.
    Then I also want to have some link buttons showing the logfile of the binary (contains plain text), a binary config (xml formatted) and a statefile from the hue (json formatted).
    All three files shall just be displayed (not parsed to get the elements into arrays or something...).

    The first issue was that I thought of simply using the same filename ason the system (huebridge.state) which contained json.
    The respective handler did not work as I wrote.
    Now the thing is tat I use a html-template that is filled with the content of the state-file, which basically works.
    This state-file is hue-bound meaning a bridge has one of those files identified by the mac-address in the file name.
    So I have to send that filename from the GUI to the handler (Michael showed me a trick using a for-loop to get the triggered device).
    The respective filename is stored in a $params->{'stateFileToShow'} parameter that is returned to the default-handler and shall then processed (see https://github.com/chincheta0815/LMS...ttings.pm#L163).

    There are some issues with that:
    1. I can access the $params->{'stateFileToShow'} value only in the the default handler of the Settings.pm (https://github.com/chincheta0815/LMS...ettings.pm#L51). An ajax request asks for showing new discovered hue systems and I wrote a handler for that (https://github.com/chincheta0815/LMS...ttings.pm#L188), inside the template of that handle the submit button for the display page of the stte finle can be found. In another custom-handler I wrote for filling the template of the state-file-display (https://github.com/chincheta0815/LMS...ze2Hue.pm#L449). I do not how to get the value in a LMS-perl conform way to that handder for making the link work correctly.
    2. (Since 1. does not work I hardcoded the filename and then...) When using a <a href> I do not get the new page open nor the handler executed. Using a onClick=window.open on the submit button I get a new window with the handler working. Only thing then: There is no LMS layout simply the plain inner frame.

    So there are two issues which might be connected... I am a little bit lost now (as always when woring with plugins in LMS) since there are so many different things working together (ajax, javascript, perl, html...). Getteing the error seems quite hard to me...

    I hoipe this showed you a little bit of my problems/project...
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

  4. #14
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    15,388
    I have a bit better idea but it's still not clear in my head. Using settings for a step by step process is never easy. It might have been easier to take over a LHS pane from a menu.

    I'll reread this later and look at the plugin to see if I understand the issues any better.

  5. #15
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    Quote Originally Posted by bpa View Post
    I have a bit better idea but it's still not clear in my head. Using settings for a step by step process is never easy. It might have been easier to take over a LHS pane from a menu.

    I'll reread this later and look at the plugin to see if I understand the issues any better.
    Thanks a lot!
    There is also a further evolved version I have not yet uploaded I will do that later.
    I contains the latest ideas where I used a internal function instead of the $params... But that is not working well also (layout problem, link only works after the second hit onto the button) and maybe not in the sense of LMS.
    The plain principle is implemented.
    I will notify you when I updated it.

    Concerning the step-by-step process maybe to clarify: There are simple function executing things. Only this params-handling seems to be an issue (maybe due to having those handlers and maybe due to my bad knowledge about perl hashes and references...).
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

  6. #16
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    Quote Originally Posted by chincheta0815 View Post
    Thanks a lot!
    There is also a further evolved version I have not yet uploaded I will do that later.
    I contains the latest ideas where I used a internal function instead of the $params... But that is not working well also (layout problem, link only works after the second hit onto the button) and maybe not in the sense of LMS.
    The plain principle is implemented.
    I will notify you when I updated it.

    Concerning the step-by-step process maybe to clarify: There are simple function executing things. Only this params-handling seems to be an issue (maybe due to having those handlers and maybe due to my bad knowledge about perl hashes and references...).
    I just pushed the latest changes into my github-repo. The mentioned code lines should be more or less the same (some lines up or down).
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

  7. #17
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    Quote Originally Posted by chincheta0815 View Post
    I just pushed the latest changes into my github-repo. The mentioned code lines should be more or less the same (some lines up or down).
    I now got some workaround...
    Since the content was always set after a second click, I did a "helping handler" that is loaded after the page was built up... This show the file content in a browser window. It is not elegant, but works... (If you have a better idea I would appreciate that).

    The layout problem still remains and I still have no clue on how to solve that...
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

  8. #18
    Senior Member
    Join Date
    Jan 2011
    Location
    Germany
    Posts
    244
    Got it solved.
    It took really a while, but now I am again impressed about the possibilities one get when using LMS.

    The page handler now has the ending .html, otherwise it won't work.
    Sending variables to the called web page can be done via the url and then in the handler one can user $params->('url_query').
    Getting the "default" handler params for the LMS GUI, was harder: I simply passed the default handler params around in a variable...
    LMS-7.9@solaris. 2x Radio, 2x Duet, 1x Chromecast v1, ShairTunes, 1x Philips Hue System

Posting Permissions

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