Idea: Start/stop XBMC from web gui
|
9th Apr, 2013, 01:23 AM
Post: #1
|
|||
|
|||
Start/stop XBMC from web gui
I was looking for a way to run bash scripts from my phone or Ipad in a user friendly way. Main reason for this is that I want to be able to start XBMC and pause all downloads in one click, and vice versa.
I wasn't able to find anything that suited my needs so I decided to 'hack' something together. I say 'hack' because my knowledge on doing this in a neat way is limited. The result for now is a web gui with two buttons: Start XBMC button: starts XBMC pauses nzbget downloads, nzb scans and processing pauses all downloads in transmission shuts down couchpotato shuts down sickbeard Stop XBMC button: stops XBMC resumes nzbget downloads, nzb scans and processing resumes all downloads in transmission starts couchpotato starts sickbeard How did I put this together [guide/tutorial if you want]: [1]Create bash scripts Created the bash scripts: Code: sudo nano startxbmc.sh Inserted the following lines: Code: #!/bin/bash Made it executable: Code: sudo chmod +x startxbmc.sh Did the same for the stopxbmc.sh script which contains the following: Code: #!/bin/bash [2] Set up PHP webserver Now we are going to need a webserver with php support to run the bash files from a web gui. I used the following guide for this: http://www.simonthepiman.com/how_to_setup_a_web_server_with_php_support.php In the step where the lighttpd.conf is edited you can also change the port if you would like. [3] Design a web GUI Now we have to build a basic web page with the buttons by changing index.php. I have set this up very simple with some basic formatting. The php code is below, I haven’t commented it yet sorry for that. It roughly contains 3 parts, the first part contains the php code that is called when a button is pushed. The second part contains the styling for the buttons en the final part is the html code for the web page. PHP Code: <?php [4] Create nopasswd exceptions for bash scripts Because there are some sudo commands in our website we want to make some exceptions so they can be executed without the need of a password. For this I implemented the following solution. I have absolutely no idea how safe or unsafe this method is. Code: sudo visudo Add the following line at the end: Code: www-data ALL=NOPASSWD: /path/to/your/scriptfolder/startupscript.sh, path/to/your/scriptfolder/shutdownscript.sh [5] Push your buttons Go to the website: Code: http://yourraspberrypi-IP Or if you have changed the port in step 2 Code: http://yourraspberrypi-IP:portnumber What’s next: [1] First of all I would like to know if someone knows there is already something similar to this (I was not able to find it), which is probably better than this. If there is not then: [2] I would like to know if you think this method is safe and if not, how to implement this better. [3] I would like to make the web gui better looking but I have close to none experience with this, I had the following things in mind: - Adjust it automatically to screensize (so the buttons are not to small on a phone and not to big on an Ipad or computerscreen) - Add some feedback to it (XBMC started successfully etc.) - Disable the buttons for a minute after they are pressed. So suggestions and recommendations on this and also on other aspects are more than welcome. I have put this together starting with close to no knowledge of php, html and linux, so there will be enough room for improvement. Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
9th Apr, 2013, 12:07 PM
Post: #2
|
|||
|
|||
Re: Start/stop XBMC from web gui
Do you have an android or ios device?
Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us. |
|||
9th Apr, 2013, 04:57 PM
Post: #3
|
|||
|
|||
RE: Start/stop XBMC from web gui
I have an android phone and an Ipad.
Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
10th Apr, 2013, 01:25 AM
Post: #4
|
|||
|
|||
Re: Start/stop XBMC from web gui
On android you can use Coversal with the SSH plugin, there is also ScriptKitty among others.
Not knocking your work, just letting you know of these two great apps that will allow you to start/stop XBMC from your device. I'm sure there are equivalent iOS applications but I don't know. With ScriptKitty you can use per command widgets and you get a nice output screen: Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us. |
|||
10th Apr, 2013, 04:10 AM
Post: #5
|
|||
|
|||
RE: Start/stop XBMC from web gui
Thanks I will look in to that. I just made this because I couldn't find something (for free) that could do this and it's a fun way of learning how this stuff works.
Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
10th Apr, 2013, 08:11 AM
Post: #6
|
|||
|
|||
Re: Start/stop XBMC from web gui
Nothing wrong with that
Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us. |
|||
11th Apr, 2013, 12:21 AM
Post: #7
|
|||
|
|||
RE: Start/stop XBMC from web gui
Does anybody know Apps for iOS like ScriptKitty or Coversal for Android? Can't find anything in the Web or the App Store...
|
|||
11th Apr, 2013, 05:23 AM
Post: #8
|
|||
|
|||
Re: RE: Start/stop XBMC from web gui
(11th Apr, 2013 12:21 AM)wuschl Wrote: Does anybody know Apps for iOS like ScriptKitty or Coversal for Android? Can't find anything in the Web or the App Store... PilotSSH seems to be the closest ios ScriptKitty alternative, although the scripts would reside on the pi instead of locally. Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us. |
|||
11th Apr, 2013, 10:41 PM
Post: #9
|
|||
|
|||
RE: Start/stop XBMC from web gui
Thx for your answer! I'll give it a try
|
|||
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread: | Author | Replies | Views: | Last Post | |
read out XBMC play, pause stop status | lukeg01 | 36 | 101,432 |
11th Apr, 2014 05:22 AM Last Post: CurlyMo |