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)



- zi99y - 2011-05-31

Greetings folks

I just came across this yesterday and it's a great little project - thanks to the devs!

Couldn't help but poke around in the code to try to work out what's going on and I fixed a small problem with the "recent tv" and "recent movies" where the play button doesn't work on a lot of my videos. Basically it just needs to escape the filename with addslashes() here:

libXBMCLibrary.php line 415
$results = jsonmethodcall("XBMC.Play", '"file": "'.addslashes($videoInfo['file']).'"');

Unfortunately it still doesn't fix files that have single quotes in, but there you go.

Another little annoyance was the dump of the JSON request debug info when XBMC is not running so I've tweaked my code to look cleaner.

Are there any interesting widgets left to make?


- DejaVu - 2011-05-31

zi99y Wrote:Are there any interesting widgets left to make?
Sky's the limit with this little beauty. But we need more ideas as to what to add. Any suggestions are always considered/welcomed. Smile


- CoinTos - 2011-05-31

zi99y Wrote:libXBMCLibrary.php line 415
$results = jsonmethodcall("XBMC.Play", '"file": "'.addslashes($videoInfo['file']).'"');
Unfortunately it still doesn't fix files that have single quotes in, but there you go.

A better built in function to escape the string would be escapeshellarg(), it will escape single quotes.

$results = jsonmethodcall("XBMC.Play", '"file":'.escapeshellarg($videoInfo['file']).'"');

I don't run a json compatible xbmc so I can't confirm it.


- SleepyP - 2011-06-01

Actually something like that will need to be tested against both nightly and stable versions of XBMC, but probably works fine on both. Only SOME of the calls were changed in the "new" JSON interface, mostly stuff dealing with media metadata. I have never encountered an issue when hitting "play" when testing the widgets against either version, so I think it wrapping it like that in the escapeshellarg() should be all you gotta do for 100% workening Smile

CoinTos, what branch are you running? I committed a version of this widget recently that should work regardless of what version of XBMC you use and regardless of what database back-end you use (meaning nightly, stable, MySQL, and SQLite should all work). Can you test my XBMC Library widgets?
https://github.com/DivinityCycle/mediafrontpage is my repo
You would need to pull xbmcjsonlib.php, functions.php, /Widgets/wXBMCLibrary.php, and /Widgets/libXBMCLibrary.php from there for testing purposes.

On a general note, the IT guys at work put our network into a ridiculous whitelist-based lockdown, so basically anything NOT on the whitelist is blocked. This means I cannot do any sort of remote development (or even get to Gmail) from work at the present time. The last weekend I mostly was in NyQuil-induced sleep, and also played entirely too much MineCraft, so I haven't gotten much work done I'm afraid.

Also, I noticed that the Search widget throws up a bunch of errors similar to the Transmission widget, but only some of the time. I will try to work up a fixed version of the next day or so, since we really shouldn't get errors during normal operations in version 1.0.

Gugahoi, I will check out your new config.php ASAP and get back to you with feedback concerning the proxy setup.

Overall, this project is coming along super well.

Some dumb ideas for Widgets:
Google Google Google!
-Google Tasks: Google recently published an API to view / modify things stored in your Tasks list. This one is low priority, but seems like it could be handy some of the time.

-Google Calendar: I think there's an API on this one. For my media-related stuff I actually stick release dates into a particular calendar for easy reference. Might be handy since MFP is all about media. I am not sure but I think they give you embeddable versions of calendars. If that's true, I think this one wouldn't be too hard, mostly just some CSS tricks to make it look OK alongside all the other widgets?

-Google Voice: Similar, but they don't have a proper API for this one AFAIK. I would maybe actually use it, since I use Google Voice for all my texting.

-Shell Script Launcher: though it would have to have like a million security warnings on it, I am a lazy enough admin that I would occasionally like to be able to click something and have it fire a shell script on my server. Examples: run chmod to fix the permissions on a folder, run a script to move some files from one location to another, etc. Like I said, this would would require lots of documentation to make sure end-users understand "DO NOT USE THIS unless you actually are confident you are secure and can afford to have your server completely hacked". For the Linux people, I can easily document how to grant Apache sudo access to specific commands only (and not general root access). This is how I personally do it, and I am OK with the level of security exposure.

On Feature Request I have thought of: Add some sort of basic .torrent support for the Search widget. I can easily search and download stuff from newsgroups via Search. How hard would it be to add something similar for searching torrents? The main issue I can think of would be how to determine if the ops should be tried in Transmission or uTorrent?

So yeah, food for thought I guess


- DejaVu - 2011-06-01

Bummer.
Cannot seem to get to Google Tasks either.
Image


- gugahoi - 2011-06-01

SleepyP Wrote:Gugahoi, I will check out your new config.php ASAP and get back to you with feedback concerning the proxy setup

Thanks, I've been anxious to upload it as it might not work for everyone. I decided to put it up now as I find it much easier to use. It's quite organised.
I think you've had some good ideas, but unfortunately they might not work for a lot of us who are outside of the USA.

_Mikie_ Wrote:I don't know exactly why this is happening but from another project I'm working on I have a general idea. If I use authentication for sickbeard and put it in the config (new or old) when I load mfp it still asks me for it with a pop up. If I cancel it still loads fine. From what I can tell the problem is the call for the images. For ever call the widget makes to sickbeard it needs authentication and somewhere along the line its missing one. It asks for the pop up on every auto refresh of the widget if I cancelled it in the beginning. Or maybe its just me? Can someone verify? Clear cache and restart browser just to check there aren't any cookies etc.

EDIT: It actually asks for authentication on ever reload even if I accept it

I think this has always happened. I also find it weird, it asks for authentication tons of times! On chrome it works fine tho. FF not so much in my experience.

CoinTos Wrote:Weird, worked for me, anyways here's a megashare link

I got it now but from my testing it didn't seem to work... I'm on a mac using chrome and it said it was an unknown browser....


On a side note tho, I reckon Mikie did a wonderful job in his authentication page for MFP. I just helped him with his logout issues and it now seems to be very functional. We wanted to ask you guys what do you think of it and if everyone likes it, we would add to the Official repo. In my opinion the biggest upside is not having to deal with htacces files. Even tho my authentication system works fine, it's not everyone who's going to know how to setup htaccess. Furthermore it has MFP's style and it's a piece of cake to configure.

Please check it out guys...

https://github.com/Mikie-Ghost/mediafrontpage


- niietzshe - 2011-06-01

I've had this problem before, so sorry for asking about it again, but things have seemed to advanced recently.
I've just blasted my computer with a new XBMCLive install, so that means a completly fresh install of sickbeard/mediafrontpage etc as of yesterday.

I have "localhost" as the ip for all of my services. If I want to access these links (localhost:9091 for transmission) from outside, this isn't going to work is it? Should I be looking at reverse proxies or am I missing something?

Thanks for any hints.
Niietzshe


- _Mikie_ - 2011-06-01

I'll update me repo so its the same as the master repo over the weekend and add in authentication. It works currently but some of the latest general bug fixes (last week or so) aren't in there.

With regard to sickbeard asking for authentication all the time I think chrome must store the username and password or handle it differently. The only way I can think of solving the issue entirely alone with the user and pass being show is to in a sense create a proxy to sickbeard. So not only the initial request is curled but all requests are curled thus using the curl authentication method for everything and not having user/pass in url. Its quite a major overall though that is beyond my knowledge so unless someone else wants to try it will have to stay as is.


- _Mikie_ - 2011-06-01

niietzshe Wrote:I've had this problem before, so sorry for asking about it again, but things have seemed to advanced recently.
I've just blasted my computer with a new XBMCLive install, so that means a completly fresh install of sickbeard/mediafrontpage etc as of yesterday.

I have "localhost" as the ip for all of my services. If I want to access these links (localhost:9091 for transmission) from outside, this isn't going to work is it? Should I be looking at reverse proxies or am I missing something?

Thanks for any hints.
Niietzshe

If I'm understanding you correctly you have a couple options.

If you want to access each one via its port, you will need to forward all the ports in your router. So 8081 (sickbeard), 5000 (couchpotato) 9091 (transmissoin) etc and then it should work. It means you have to remember the ports as well as involve possible security holes with so many ports open.

The other option is to, like you said, use reverse proxies. This will mean that you don't need to forward ports as everything is accessed on port 80 or whichever port apache uses. You would access stuff

localhost/tvseries - dont use sickbeard it fails
localhost/couchpotato
localhost/transmission
etc

And obviously when accessing this from an outside network localhost would be replaced with your pc's external IP or your domain name


There is a right up at this link if you wanna check it out
http://mediafrontpage.lighthouseapp.com/projects/76089/apache-configuration-hints


- gugahoi - 2011-06-01

_Mikie_ Wrote:The other option is to, like you said, use reverse proxies. This will mean that you don't need to forward ports as everything is accessed on port 80 or whichever port apache uses. You would access stuff

I don't think that's what he meant. He wanted to know how to translate his external IP to a domain name service.

If that's the case the answer would be: you need a DNS to translate your ip to a "human readable" website. Most people dont have a static IP which makes it impossible to know which address is your computer at. Therefore, there are some services that check for the ip address constantly and update the url to point to this new IP whenever it changes.

The one I recommend is DynDNS, most routers have built in support for it but for those that don't, it is possible to install a program that handles that in you computer.

In sum, your home network usually has an external ip (eg.: 202.167.0.45) but this is a pain to remember, specially since it changes all the time. DynDNS records this number and let's you choose an address to redirect to your ip (eg.: niietzshe.homeip.net). Therefore you will have you're webserver accessible at that website. You will have to forward port 80 as that is the standar web port. To enable the other programs to be accessed from outside you will have to either forward their ports or follow the tutorial Mikie posted above to translate your ports to names (eg: localhost:9091 into localhost/torrents)


- gugahoi - 2011-06-01

_Mikie_ Wrote:I'll update me repo so its the same as the master repo over the weekend and add in authentication. It works currently but some of the latest general bug fixes (last week or so) aren't in there.

With regard to sickbeard asking for authentication all the time I think chrome must store the username and password or handle it differently. The only way I can think of solving the issue entirely alone with the user and pass being show is to in a sense create a proxy to sickbeard. So not only the initial request is curled but all requests are curled thus using the curl authentication method for everything and not having user/pass in url. Its quite a major overall though that is beyond my knowledge so unless someone else wants to try it will have to stay as is.

This is easy to do Mikie. Have a look into the rebase git command. You shouldn't have to do much other than that.


- niietzshe - 2011-06-01

Thanks guys,
I have dyndns setup with my website, which just forwards me to my networks IP address, thats all fine.
My problem is this. If I setup config.php with "localhost" as the ip, if I connect from outside, it tries to connect to localhost:8081, not myexternalIP:8081....

I have ports forwarded, so I can connect straight to myexternalIP:8081 and it'll connect, but if I try and do that inside of my network it will fail (going out, then coming back in I presume).

Why will sickbeard not work with reverse proxy btw?

Maybe this is a problem with my lighttpd setup or router. How are people setting up their config.php's to access from inside and outside the network? If you are successful with just "localhost" then maybe I've got a problem with my server or router etc...

Thanks for the help guys
Niietzshe

P.s. One thing at a time I know, but in the sickbeard widget I get the tv discriptions, but no images. If I go directly to the sickbeard comingEpisodes page it has images (although they're bloody massive). Any ideas on this one? Permissions of the cache folder are correct, do I need to active it somewhere?


- niietzshe - 2011-06-01

Just a quick example, I have my sickbeard widget on the left showing comingEpisodes. If I click on one I get this error page:

Code:
This web page is not available
The web page at [url]http://****:****@localhost:8081/home/displayShow?show=78804[/url] might be temporarily down or it may have moved permanently to a new web address.

*From outside my network. Inside would work I think, maybe not actually, unless I change localhost to the IP of my htpc...

So really what I'm saying is, I need it to look at the htpc's localhost, not the localhost of the computer I'm currently using.


- drunkendragon - 2011-06-01

1. Do I edit the size of the scrollbar in scrollbar.css ?
2. When i've time i'll check the authorisation page, because an htacces solution was already on my todo list, because im using MFP more and more. Also from outside my LAN.
3. I'll check the play function in recent Tv, movies $results = jsonmethodcall("XBMC.Play", '"file":'.escapeshellarg($videoInfo['file']).'"');
4. The new config.php is really nice. Should be in the master!
5. A PHP widget to connect to the Youtube Api for searching video's would be nice! I use greasymonkey to play them remotely on my htpc

We have a national holiday comming up, but im painting my living room. So don't know when i give some feed back, but i'm always into some testing on a user level Smile


- _Mikie_ - 2011-06-01

gugahoi Wrote:This is easy to do Mikie. Have a look into the rebase git command. You shouldn't have to do much other than that.

I used the merge upstream master and it seems to have worked. My repo should be the same as the master but with authentication added. I updated the new config to work. Please could you check that my if statement for global is correct. Not 100% about that one. Also using your config it says logging out and then takes an age to actually log out. Don't quite know why. Possibly the if (session_id()=='') session_start(); being so low down in the config? I don't know though. Also don't know if the way session start is being used is ideal.

In general please just look over everything and see that its all alright. If anyone wants to test it out

https://github.com/Mikie-Ghost/mediafrontpage