Kodi Community Forum
Maraschino (formerly HTPC Frontend) - a summary web interface for your XBMC HTPC - 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: Maraschino (formerly HTPC Frontend) - a summary web interface for your XBMC HTPC (/showthread.php?tid=113136)



- mrkipling - 2011-11-13

gugahoi Wrote:Awesome, it's exactly as I thought it was. I only overlooked the hook.

One thing I noticed tho is that all the py files end up having a pyc file except for the module I created. It does show up in the page fine however.

Another quick question I have: how do you debug some of the code? As in, variables for example. How do you check the content of a variable? Can I just print it to the console or would I have to pass it to the template and use some special printing there?

*.pyc files are created by Python, they're just compiled version of the *.py files. They are in .gitignore and can be safely deleted, they'll just get re-made by Python.

For simple debugging you can just use

Code:
print variablename

in the Python code to print it to the console.


- mrkipling - 2011-11-13

_Mikie_ Wrote:If you don't want the decimals then somewhere around line 102

free = float(st.f_bavail * st.f_frsize) / 1073741824
total = float(st.f_blocks * st.f_frsize) / 1073741824
used = float((st.f_blocks - st.f_bfree) * st.f_frsize) / 1073741824

These shouldn't be floating numbers.

When talking in GB I prefer them being displayed to 2 decimal places, but if you don't then you could just use Jinja's built-in "int" template filter, like so (in "templates/diskspace.html"):

Code:
{{ disk.used|int }} GB used



- DejaVu - 2011-11-13

Awesome - thanks for that MrK.

Also, the latest commit for the Image dropdown seems to be working for me too on the CherryPy install.


- Rumik - 2011-11-14

At first glance the installation instructions on the website seem to assume you're using Linux... are there no Windows installation instructions? Can this even run on Windows?


- DejaVu - 2011-11-14

It is originally created for Linux, but Python is universal and can run on Linux, Apple Mac's and Windows.

Look through this thread and check Archigos' posts, he has this running in a Windows environment.


- Archigos - 2011-11-14

Rumik Wrote:At first glance the installation instructions on the website seem to assume you're using Linux... are there no Windows installation instructions? Can this even run on Windows?

Look for posts I created in this thread, I did a detailed install instructions that work fine on Windows 7 and Windows Server 2008 R2 (should apply fine to Vista as well, if you're XP, no clues)


--Edit--
Guess I should have actually read Deja's post instead... my bad.


- Rumik - 2011-11-14

Great thanks, I'll go back through and see if I can dig out your guide Smile

I totally think it should be on the official website too tho!


- Archigos - 2011-11-14

Rumik Wrote:Great thanks, I'll go back through and see if I can dig out your guide Smile

I totally think it should be on the official website too tho!

If I remember right, he wanted a few users to confirm my method worked fine (which it does) before he added it, since he's not really a Windows user it'd kind of suck for him to put up instructions if they don't work cause then he'd be scratching his head trying to think of fixes.

Anyway, it's this post you want.


- Rumik - 2011-11-14

I could really use a hand with the setup process. I've installed Python 2.7 and the setup tools, but i'm getting this error when trying to install cherrypy

C:\Python27\Scripts>Python easy_install cherrypy
Python: can't open file 'easy_install': [Errno 2] No such file or directory


any advice?

cheers


- Archigos - 2011-11-14

Rumik Wrote:I could really use a hand with the setup process. I've installed Python 2.7 and the setup tools, but i'm getting this error when trying to install cherrypy

C:\Python27\Scripts>Python easy_install cherrypy
Python: can't open file 'easy_install': [Errno 2] No such file or directory


any advice?

cheers

I'll have to check my guide to make sure I didn't mess that up... don't put "Python" when you're in the scripts directory, just do "easy_install cheerypy"

--Edit--
Nice catch, I fixed the guide.


- Shaolin - 2011-11-14

Archigos Wrote:Next (still in command prompt)
Code:
python setup.py
start python maraschino-cherrypy.py
Only do the second command if the first one stated it was successful. Congrats.

Hi,

thanks for posting these instructions for windows. I followed your instructions and everything went well up until i executed this command:

Code:
start python maraschino-cherrypy.py

where upon i get the following error:

Code:
File "C:\XBMC Maraschino\maraschino-cherrypy.py", line 10, in <module>
    server.start()
File "C:\Python27\lib\site-packages\cherrypy-3.2.2-py2.7-win32.egg\cherrypy\wsgiserver\wsgiserver2.py", line 1824, in start
    raise socket.error(msg)
socket.error: No socket could be created

Any help appreciated

Shaolin


- Archigos - 2011-11-14

Shaolin Wrote:Hi,

thanks for posting these instructions for windows. I followed your instructions and everything went well up until i executed this command:

Code:
start python maraschino-cherrypy.py

where upon i get the following error:

Code:
File "C:\XBMC Maraschino\maraschino-cherrypy.py", line 10, in <module>
    server.start()
File "C:\Python27\lib\site-packages\cherrypy-3.2.2-py2.7-win32.egg\cherrypy\wsgiserver\wsgiserver2.py", line 1824, in start
    raise socket.error(msg)
socket.error: No socket could be created

Any help appreciated

Shaolin

Do you have everything in the settings.py configured correctly? Don't think that's what is causing it, but may be a port issue there. Make sure the Cherry port is 7000 and that the other port reference is uncommented (and change from 5000 if you're using that for CP or something else) plus make sure that the AUTH section is uncommented and filled out if you use a user/pass for XBMC.

If that doesn't work, try doing:
Code:
start python maraschino.py
and if it runs correctly, let it go for a minute or so, kill the command prompt it's running in and try the CherryPy one again. The only other thing I can think of off the top of my head is the space you have in the directory name. If you're only running Maraschino out of that directory, try changing it from "XBMC Maraschino" to "XBMC-Maraschino" (make sure to change the settings.py to reflect that) and see if that helps.


- Rumik - 2011-11-14

Thanks, that got a bit further.... but now I'm getting this:


C:\Python27\Scripts>easy_install cherrypy
Searching for cherrypy
Reading http://pypi.python.org/simple/cherrypy/
No local packages or download links found for cherrypy
Best match: None
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1712, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1700, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
211, in run
self.easy_install(spec, not self.no_deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
434, in easy_install
self.local_index
File "C:\Python27\lib\site-packages\setuptools\package_index.py", line 475, in
fetch_distribution
return dist.clone(location=self.download(dist.location, tmpdir))
AttributeError: 'NoneType' object has no attribute 'clone'

C:\Python27\Scripts>


- Archigos - 2011-11-14

Rumik Wrote:Thanks, that got a bit further.... but now I'm getting this:


C:\Python27\Scripts>easy_install cherrypy
Searching for cherrypy
Reading http://pypi.python.org/simple/cherrypy/
No local packages or download links found for cherrypy
Best match: None
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module>
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1712, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1700, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
1716, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
211, in run
self.easy_install(spec, not self.no_deps)
File "C:\Python27\lib\site-packages\setuptools\command\easy_install.py", line
434, in easy_install
self.local_index
File "C:\Python27\lib\site-packages\setuptools\package_index.py", line 475, in
fetch_distribution
return dist.clone(location=self.download(dist.location, tmpdir))
AttributeError: 'NoneType' object has no attribute 'clone'

C:\Python27\Scripts>

I remember it tossing errors when I set mine up as well, I think it's a version mismatch on their end, as far as I can tell, it's safe to ignore those. Try to easy_install the remaining ones and finish the guide, if it still tosses errors, try to easy_install cherrypy a second time and run maraschino again. I know it's not 'pretty' but I think it's the packages and nothing we can really do about it.


- Shaolin - 2011-11-14

Archigos Wrote:Do you have everything in the settings.py configured correctly? Don't think that's what is causing it, but may be a port issue there. Make sure the Cherry port is 7000 and that the other port reference is uncommented (and change from 5000 if you're using that for CP or something else) plus make sure that the AUTH section is uncommented and filled out if you use a user/pass for XBMC.

I use MYSQL to share my library around the house with username 'xbmc' and password 'xbmc' on port 3306 as outlined in the MYSQL tutorial on these forums. I have tried keeping AUTH commented and also tried tried putting:

Code:
AUTH = {
    'username': 'xbmc',
    'password': 'xbmc'
}

in settings.py but I still get the same sockets error.

here is my settings.py:

Code:
# this is where you database is going to be stored
# make sure that you have write access to the directory

DATABASE = 'c:/maraschino.db'

# if serving using CherryPy (maraschino-cherrypy.py)
# you can set the port here

CHERRYPY_PORT = 7000

# include AUTH if you want to use HTTP basic authentication
# if serving using Apache and mod_wsgi, make sure to enable auth forwarding:
# http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPassAuthorization

AUTH = {
    'username': 'xbmc',
    'password': 'xbmc'
}

# if you are using the dev server and want to run Maraschino on a different port
# then enable this setting

PORT = 5000


Archigos Wrote:If that doesn't work, try doing:
Code:
start python maraschino.py

This opens up a command window which hangs at:

Code:
* Running on http://0.0.0.0:5000/
* Restarting with reloader

Archigos Wrote:and if it runs correctly, let it go for a minute or so, kill the command prompt it's running in and try the CherryPy one again. The only other thing I can think of off the top of my head is the space you have in the directory name. If you're only running Maraschino out of that directory, try changing it from "XBMC Maraschino" to "XBMC-Maraschino" (make sure to change the settings.py to reflect that) and see if that helps.

Killed it and tried the cherrypy again with the same sockets error.

Thanks for the assistance on this.

Much appreciated.

Shaolin