Kodi Community Forum
MediaFrontPage - Web interface with widget type architecture to control multiple apps - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: MediaFrontPage - Web interface with widget type architecture to control multiple apps (/showthread.php?tid=83304)



- SleepyP - 2011-05-09

DejaVu, thank you for your input but I believe you are incorrect on this point. As I posted earlier, I was able to get things working by creating a brand new MySQL database and then populating it using the "stable" 10.1 version of XBMC. The test database was created exactly the same way as the original and was given the same permissions.

Clearly some changes have taken place on the database side during development. The stable builds of XBMC use database version 42, while the nightlies are up to database version 51. This means that if you run the nightly build, it "updates" the database and then it will no longer work with the stable build. I'm gonna ask the devs what else has changed, because this more than likely means the JSONRPC parts of MediaFrontPage may need some tweaks to work on the newer XBMC builds with MySQL.

On a different note, how do you go about adding a widget?


- gugahoi - 2011-05-10

SleepyP Wrote:DejaVu, thank you for your input but I believe you are incorrect on this point. As I posted earlier, I was able to get things working by creating a brand new MySQL database and then populating it using the "stable" 10.1 version of XBMC. The test database was created exactly the same way as the original and was given the same permissions.

Clearly some changes have taken place on the database side during development. The stable builds of XBMC use database version 42, while the nightlies are up to database version 51. This means that if you run the nightly build, it "updates" the database and then it will no longer work with the stable build. I'm gonna ask the devs what else has changed, because this more than likely means the JSONRPC parts of MediaFrontPage may need some tweaks to work on the newer XBMC builds with MySQL.

On a different note, how do you go about adding a widget?

I'm pretty sure that they changed something with JSON RPC. From what I remember reading at least.

There is an example widget in the widgets folder for you to follow. All you need to do is code that and then remember to add it to layout.php

hernandito Wrote:I think I can come up with something to do with what you have... Would you mind sharing how you did it?

Thanks!

I will upload it later today.... Probably merging the imdb and master branches, what do you reckon?


- SleepyP - 2011-05-10

Hey gugahoi, have you seen this: http://forum.xbmc.org/showthread.php?tid=98551 ?

Also, I just did a test using a completely "fresh" install of yesterday's nightly build, with purely local SQLite databases. Same issue, the "recently added" widgets are broken and the Library Browser widget lets me get to my list of TV shows but that's it. This means the issue is with nightly builds, not MySQL specifically. What's interesting is that a lot of stuff does still work, like the commands being sent to XBMC, and retrieving a list of TV shows. This implies that it shouldn't be too hard to re-write the stuff that's broken.


- hernandito - 2011-05-10

gugahoi Wrote:I will upload it later today.... Probably merging the imdb and master branches, what do you reckon?

There is nothing but awesomeness on that widget... merge away por favor!

I have my work cutout... , I have to try to restore my css... drive recovery process is probably halfway through... So I cannot test or try anything. Once that is done, I will work backwards and see exactly what is needed to make my light color theme possible. This time, I will copy all files that have changed and we can decide how to proceed.

I am not sure if anyone else prefers my theme, or if I am alone. If alone, I am happy to be odd man out and fart around by my lonesome as new widgets come out.

Anyone else interested in the Light theme?

Sometimes it sucks being an un-relenting stubborn, perfectionist, tunnel-visioned, control-freak designer..... But what else do I do on my spare time? Talk to the wife..? [SIZE="0"]Boring[/SIZE]... Laugh


- Nick8888 - 2011-05-10

SleepyP Wrote:Hey guys, here's my config.php:

For the MySQL stuff I have tried a bunch of variations, like 127.0.0.1, localhost, and 192.168.1.1:3601. I guess I should roll my client XBMC back to 10.1 with IP addresses in the settings and see if that helps?

Sorry this is confusing. Just ignore that setting as it is for dev purposes.

Having xbmc use a mysql database will not affect xbmc's json server and you need to try and get it to connect to that. The reason for it not working is because (like dejaVu or gugahoi pointed out) there have been changes to xbmc's json server in trunk and it no longer works with mfp. you need to go back to the last stable release of xbmc or wait until mfp is updated.

The MySQL stuff was added as the beginning of adding support to bypassing xbmc's json server. This would be handy for users with client server architecture who do not run xbmc 24/7 but do run their server 24/7 which runs their mysql database. It was never completed and that option in config serves little purpose.


- Nick8888 - 2011-05-10

I finally found what the widget jquery was based on:
http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/

Looks like it was updated on Dec 23rd 2010. Lots of helpful information there now. Not sure if it has any info for upgrading to jquery ui 1.8.12


- HarryRosen - 2011-05-10

I have read through the whole thread but unable to find a how to guide on setting this up, I am a total linux noob, Is there a guide on how to run this on either a WHS or xbmc live? Thanks


- SleepyP - 2011-05-10

Nick, that is actually really helpful information, and also makes a lot of sense given the testing I have done. Also I would be one of the people in that target audience who don't have XBMC running all the time but DO have MySQL running all the time, so I would love a feature like that.

The biggest question that comes to my mind is, could the JSON-RPC stuff in MediaFrontPage at the moment be updated without breaking it for the stable version of XBMC? I started reading up on what was changed, and it looks parameters have changed a lot for some of the methods, and some stuff has been renamed as well. If that's the case, I believe the "updated" version will totally fail when working against the stable version of XBMC.

I can think of three solutions for this:
1-pack in two files and have the user rename the appropriate one during installation time

2-if its possible to query XBMC and get either the interface version or the program's version number, then it would be possible to make the JSON code check the version and then fork to either the old or new methods as needed

3-A much lighter way of accomplishing 2 would be to have a variable set in config.php that specifies which JSON-RPC behavior should be used when talking to XBMC client(s). This seems like the best way to do it since it wouldn't adversely effect current setups and would make updating to the new setup trouble-free for the end-user.

When I get home from work I will have a look at the source, though its been over a year since I did any PHP work.


- SleepyP - 2011-05-10

Harry, which parts have you got working so far (if any)? You may wanna PM me rather than putting the stuff into this already-busy thread. The main focus here seems to be development, and setting up some of the server-side stuff can be pretty complicated.


- DejaVu - 2011-05-10

HarryRosen Wrote:I have read through the whole thread but unable to find a how to guide on setting this up, I am a total linux noob, Is there a guide on how to run this on either a WHS or xbmc live? Thanks

Installation instructions for XBMCLive are on git in the Readme.md file (which displays on the Repo splash - here.

All platforms are relatively the same, but you must now how to setup a Apache/PHP Server on other platforms (or at least where it gets installed to).

More instructions will be added for other OS's soon.


- HarryRosen - 2011-05-10

Ok Thanks, I will do more reading, still learning


- Nick8888 - 2011-05-10

SleepyP Wrote:I can think of three solutions for this:
1-pack in two files and have the user rename the appropriate one during installation time

2-if its possible to query XBMC and get either the interface version or the program's version number, then it would be possible to make the JSON code check the version and then fork to either the old or new methods as needed

3-A much lighter way of accomplishing 2 would be to have a variable set in config.php that specifies which JSON-RPC behavior should be used when talking to XBMC client(s). This seems like the best way to do it since it wouldn't adversely effect current setups and would make updating to the new setup trouble-free for the end-user.



I think 2. is the way to go here and Im 99% sure its possible.


Quote:When I get home from work I will have a look at the source, though its been over a year since I did any PHP work.
Its all pretty simple php as most of us have not much coding experience. Its just a matter of looking at the mediafrontpage.php and seeing how the widgets are loaded. In regards to a WOL widget, just use the example widget as a base and look at how some of the other ones work. Although personally I would just use/extend the control widget for this purpose.


- DejaVu - 2011-05-10

I've just upgraded my XBMCLive to the latest nightly and can also confirm I have now lost Recent Added Movies and Recent Added TV.

I have not checked any of the others as I dont have them setup.

Now, from what I read about the JSON queries being played with, would I be right in saying that the thing thats messed up is -

xbmcjsonlib.php
Code:
        'VideoLibrary.GetRecentlyAddedMovies' => array(
            'call' => '{"jsonrpc": "2.0", "method": "VideoLibrary.GetRecentlyAddedMovies", "params" : { "start" : 0 , "end" : %d , "fields": [ "genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "showtitle", "firstaired", "duration", "season", "episode", "runtime", "year", "playcount", "rating", "writer", "studio", "mpaa", "premiered", "album" ] }, "id" : 1 }',
            'sql' => array(
                'db' => 'video',
                'query' => 'select * from movieview order by idMovie desc limit %d',
                'resultwrapper' => 'movies'
            ),
            'args' => 50
        ),

&

Code:
'VideoLibrary.GetRecentlyAddedEpisodes' => array(
            'call' => '{"jsonrpc": "2.0", "method": "VideoLibrary.GetRecentlyAddedEpisodes", "params" : { "start" : 0 , "end" : %d , "fields": [ "genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "showtitle", "firstaired", "duration", "season", "episode", "runtime", "year", "playcount", "rating", "writer", "studio", "mpaa", "premiered", "album" ] }, "id" : 1 }',
            'sql' => array(
                'db' => 'video',
                'query' => 'select c13 as episode, idEpisode as episodeid, c05 as firstaired, c00 as label, mpaa, c01 as plot, premiered, strTitle as showtitle, strStudio as studio, c00 as title, * from episodeview order by idEpisode desc limit %d',
                'resultwrapper' => 'episodes'
            ),
            'args' => 50
        ),

If memory serves me, in order to find the new values for this, there is a special web address on live in order to query for these?

If I'm right Nick, would you mind enlightening me to the whereabouts of the JSON Query string please and I'll see if I can fix it for myself.

If not and I'm being a proper n00b - just slap me. (Still learning! Wink)

--EDIT--
Well, seek and ye shall find! Wink
http://localhost/xbmcjsonlib.php?tester=y

This looks completely different and just by looking at it - I know I'll break it!


- Nick8888 - 2011-05-10

DejaVu Wrote:Now, from what I read about the JSON queries being played with, would I be right in saying that the thing thats messed up is -

xbmcjsonlib.php
Code:
        'VideoLibrary.GetRecentlyAddedMovies' => array(
            'call' => '{"jsonrpc": "2.0", "method": "VideoLibrary.GetRecentlyAddedMovies", "params" : { "start" : 0 , "end" : %d , "fields": [ "genre", "director", "trailer", "tagline", "plot", "plotoutline", "title", "originaltitle", "lastplayed", "showtitle", "firstaired", "duration", "season", "episode", "runtime", "year", "playcount", "rating", "writer", "studio", "mpaa", "premiered", "album" ] }, "id" : 1 }',
            'sql' => array(
                'db' => 'video',
                'query' => 'select * from movieview order by idMovie desc limit %d',
                'resultwrapper' => 'movies'
            ),
            'args' => 50
        ),

--EDIT--
Well, seek and ye shall find! Wink
http://localhost/xbmcjsonlib.php?tester=y

This looks completely different and just by looking at it - I know I'll break it!

Okay I havent any time to verify this but I believe you are on the right track in finding those bits of code.

The relevant part in particular is this:

Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetRecentlyAddedMovies", "params" : { "start" : 0 , "end" : 10 , "fields": [ "title"] }, "id" : 1 }

This call used to work but you will need to find out why it is not now and what the correct call would now be. From memory I believe they changed the jsonrpc so that start and end parameters are no longer used. But check out the thread that sleepyP linked to and Im sure you'll find why.

From here http://forum.xbmc.org/showthread.php?p=767487

Quote: # "start" and "end" parameters for methods returning an array of items have been moved into a "limits" object. So now you have to use "params": { "limits": { "start": 5, "end": 15 }, ...}


Looks like they have updated this too http://wiki.xbmc.org/index.php?title=JSON_RPC

Not as easy to understand as it used to be but it looks to be quite informative

EDIT: Zarquon added that tester thing which can be very usefull for testing the jsonrpc methods


- Nick8888 - 2011-05-10

DejaVu Wrote:Installation instructions for XBMCLive are on git in the Readme.md file (which displays on the Repo splash - here.

Cheers, added to first post.