INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Modify WebGizmo templates - Webremote  (Read 5312 times)

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Modify WebGizmo templates - Webremote
« on: November 21, 2013, 11:12:28 am »

Hi,

Im trying to adapt the HTML templates for WebGizmo (WebRemote) and as far as layout, translation and formatting concerns i have succeeded ok (lots of things can be done in the CSS file)
however the next step is to add additional tag info onto the playingnow.html, if i add <div id="PlaybackInfo.Genre"></div>, this does not show up in the display, as where simple text is added.  What confuses me the most is that if i add a second time <div id="PlaybackInfo.Album"></div> which is already in the display it shows only once, so the one i added does not show up.
I have not even tried the custom tags now, which i eventually would like to add as well. 
I must be missing something, since as far as i understand the java script it loops through all the tags of the now playing song and stores them, so i should be able to display them as well, no ?

thanks a lot for the help
Raf
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #1 on: November 21, 2013, 02:38:45 pm »

in the meanwhile i'm starting to discover what is going on.
The "tags" that can be retrieved are those that are coming with the mcws command Playback/Info?Zone=-1&Token= which only includes a few basic tags.

so the next question is coming, and this is what i really wanted to do in the end how can i achieve a view comparable to the theatre view in windows (that can be customised at will) in the Mac version.  this through the web remote or in a client of MC itself !!!!

any suggestions

i have a lot of information in my tags and in stead of getting the cd's back out to do some reading i would like to do this on screen !!!!

raf
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42441
  • Shoes gone again!
Re: Modify WebGizmo templates - Webremote
« Reply #2 on: November 21, 2013, 09:07:27 pm »

so the next question is coming, and this is what i really wanted to do in the end how can i achieve a view comparable to the theatre view in windows (that can be customised at will) in the Mac version.  this through the web remote or in a client of MC itself !!!!

You can make any MCWS calls with javascript.  This includes asking about files, etc.

We're not javascript experts, so we can add features to the MCWS engine if you ask, but you'll have to wrestle the javascript side of it if you're trying to build something new.

Good luck, and please share if you come up with anything neat :)
Logged
Matt Ashland, JRiver Media Center

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #3 on: November 22, 2013, 02:58:43 am »

I am not a java script expert either, but have some basic knowledge.

The thing i do not understand is MCWS, i can not find anything in the doc about calling Tags
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Modify WebGizmo templates - Webremote
« Reply #4 on: November 22, 2013, 11:01:53 am »

The thing i do not understand is MCWS, i can not find anything in the doc about calling Tags

Are you asking how to retrieve fields for a track?

If so, take a look at the MCWS REST landing page:

   http://localhost:52199/MCWS/v1/

and see the GetInfo command.  For example:

   http://localhost:52199/MCWS/v1/File/GetInfo?File=6679382&Action=MPL

You can search the forums here for MCWS and GetInfo.  If you just want some fields:

   http://localhost:52199/MCWS/v1/File/GetInfo?File=6679382&Action=MPL&Fields=Name,Album,Artist,Keywords
Logged
The opinions I express represent my own folly.

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #5 on: November 22, 2013, 01:52:41 pm »

This is great info.  and i will get a lot further with it
now figuring out how to retrieve the fields in the script and use them
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #6 on: November 26, 2013, 08:37:41 am »

The issue i am having now is that the MPL is saved to a local file is there anyway i could make it behave like the info command ?

by the way, i suppose that the xml's generated by the other commands are stored somewhere on the "webserver" cna you indicate where this is ?
Logged

rlebrette

  • Guest
Re: Modify WebGizmo templates - Webremote
« Reply #7 on: December 03, 2013, 09:52:12 am »

The issue i am having now is that the MPL is saved to a local file is there anyway i could make it behave like the info command ?

by the way, i suppose that the xml's generated by the other commands are stored somewhere on the "webserver" cna you indicate where this is ?


You have to do an AJAX call and get the result from there.
Using jquery makes all this easier, using the MC webengine it looks like:


// invoke the service and when the data is ready process it.
$.get( "[LibraryServerLink]/MCWS/v1/File/GetInfo?File=6679382&Action=MPL&Token=[Token]", function( data ) {
   // if everything is ok the local variable data gets filled with the MPL (which is XML)
   var convertedInDOM = $(data)
   // convertInDOM contains a DOM structure that represents the XML document.
  ... now it's up to you to use the content
});



I've implemented several Javascript code libraries that are encapsulating communication with the MC server, I'm currently integrating all this in my own JQMGizmo customization.
Don't know exactly when I will be able to publish something polished, but since holidays are coming soon I should be able to provide something before New Year's Eve.
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #8 on: December 06, 2013, 05:10:25 am »

Thanks a lot
this will get me a lot further
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #9 on: December 06, 2013, 06:32:40 am »

?File=6679382 should this not be a variable ?
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #10 on: December 10, 2013, 01:14:06 pm »

I got started with the code supplied and this is what i came up with :

(additional AJAX scripting)
function Load_Tag_info(filekey) {
 $.get( "/MCWS/v1/File/GetInfo?File=" + filekey +"&Action=MPL", function( data ) {
  var xml = $.parseXML(data);
  

  
      // get all items
      var items = xml.getElementsByTagName("Field");

      if (items != null) {

         // loop items
         for (var i = 0; i < items.length; i++) {

            // parse values
            var name = items.getAttribute("Name");
            var value = items.childNodes[0].nodeValue;

            // get corresponding element

            var element = document.getElementById("Info." + name);
            if (element != null) {

               // update element
               if ((element.src != null) && (element.src != "")) {
                  if (element.src != value)
                     element.src = value; // image
               }
               else {
                  if (element.innerHTML != value)
                     element.innerHTML = value; // text
               }
            }
         }
      }

});
}

Added a line in the existing script to make sure they are both invoked with the wright parameters

function download_display_playing_information() {
    var xmlhttp = create_xmlhttp();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {

            // load response  
            var xml = xmlhttp.responseXML;
            var root = xml.getElementsByTagName("Response");

            // see if response is valid
            if ((root != null) && (root.length == 1) && (xml.documentElement.getAttribute("Status") == "OK")) {

                // get all items
                var items = xml.getElementsByTagName("Item");
                if (items != null) {

                    // loop items
                    for (var i = 0; i < items.length; i++) {

                        // parse values
                        var name = items.getAttribute("Name");
                        var value = items.childNodes[0].nodeValue;
                  if (name == "FileKey") {
                  var filekey=value;
                  }


                        // get corresponding element
                        var element = document.getElementById("PlaybackInfo." + name);
                        if (element != null) {

                            // update element
                            if ((element.src != null) && (element.src != "")) {
                                if (element.src != value)
                                    element.src = value; // image
                            }
                            else {
                                if (element.innerHTML != value)
                                    element.innerHTML = value; // text
                            }
                        }
                    }
                }

                xmlhttp = null;
         Load_Tag_info(filekey);                     
            }
        }
    }
    send_xmlhttp(xmlhttp, "MCWS/v1/Playback/Info?Zone=-1&Token=" + g_token, true);

}


The result so far is :

Logged

rlebrette

  • Guest
Re:
« Reply #11 on: December 10, 2013, 03:35:14 pm »

?File=6679382 should this not be a variable ?
Yes, it has to be. It's just an example.
Logged

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #12 on: December 17, 2013, 09:44:23 am »

I'v gotten a lot further now and there is the next thing .

To show the rating on my page i'm using Raty (jquery) and this is working very nice.  Next step is to allow the listener to change the rating by clicking on the stars. This score is send to :

Code: [Select]
function send_once(score) {
document.location.href="MCWS/v1/File/SetInfo?File="+ filekey + "&FileType=Key&Field=Rating&Value="+score + "&Token=" + g_token;
}
This works fine, the score is send to the Rating tag in MC.  The PROBLEM is that the result is the response page so i thought i had the solution by immediately adding :

Code: [Select]
function send_once(score) {
document.location.href="MCWS/v1/File/SetInfo?File="+ filekey + "&FileType=Key&Field=Rating&Value="+score + "&Token=" + g_token;
document.location.href="playingnow.html";
}


This works fine for getting the page back to the tag info page, but there is not sufficient time to update the tag in MC, since when i add this line it comes back with the old score (meaning that it is not updated)

any suggestions
Logged

vairulez

  • World Citizen
  • ***
  • Posts: 130
Re: Modify WebGizmo templates - Webremote
« Reply #13 on: December 17, 2013, 01:01:49 pm »

this has to be done in ajax as you do in the first part of your script
you first make an ajax call, treat the result and then refresh the div or span containing your rating stars
Logged
HTPC : Dell workstation, windows 10, GT 1030, Lynx Two B
zone 1 : 2 Chevin Research Q6 + DIY speakers
zone 2 : Lake People G93 + HD650
zone 3 : 2 yamaha HS80M

rafverhoogen

  • Junior Woodchuck
  • **
  • Posts: 52
Re: Modify WebGizmo templates - Webremote
« Reply #14 on: December 18, 2013, 03:22:22 am »

Of course, done and working like a charm
thanks
raf
Logged
Pages: [1]   Go Up