Build a webinterface
#8
Hi everybody,

quick update on this.
So I was able to setup the extension point and the website will be displayed if I run "python app.py" manually via ssh. How can I start this on startup?

xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="test.pluign" name="Test" version="1.0.7" provider-name="Plugin">
    <requires>
        <import addon="xbmc.python" version="2.14.0"/>
        <import addon="xbmc.json" version="6.0.0"/>
        <import addon="xbmc.webinterface" version="1.0.0"/>
    </requires>
    <extension point="xbmc.webinterface" type="wsgi" library="app.py" entry="app" start="startup"/>
    <extension point="xbmc.python.pluginsource" library="addon.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>linux</platform>
        <summary lang="en">Test Plugin Summary</summary>
        <description lang="en">Test Plugin</description>
        <license>GNU General Public License, v2</license>
        <language></language>
        <forum>nothing</forum>
        <source>nothing</source>
        <email>nothing</email>
    </extension>
</addon>

One more thing...
As you can see I have the addon.py in this file there some functions I want to call with the input of the app.py (flask webservice). But my ways are not working and I get error messages like "ImportError: No module named xbmc". XBMC is the first thing I am importing in the addon.py.

python:
from flask import Flask, request, render_template
from addon import TestFunction

app = Flask(__name__)

@app.route('/')
def hello_Lightymon():
    return 'Welcome to Lightymon!'

@app.route('/hello')
def my_form():
    return render_template('form.html')

@app.route('/hello', methods=['POST'])
def my_form_post():
    direction = request.form['direction']
    device = request.form['device']
    processed_text = device + " " + direction
    TestFunction(ldevice)
    return processed_text

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=8000, debug=False)

Extract from the addon.py
python:
import xbmc
import os
import sys
import xbmcaddon
import xbmcgui
import time
import subprocess
import urllib2

addon       = xbmcaddon.Addon()
addonname   = addon.getAddonInfo('name')
[...]

Any Ideas? Thank you very much.
Reply


Messages In This Thread
Build a webinterface - by M4tRiX - 2021-04-22, 14:57
RE: Build a webinferface - by pkscout - 2021-04-22, 18:29
RE: Build a webinferface - by Roman_V_M - 2021-04-23, 09:38
RE: Build a webinferface - by M4tRiX - 2021-04-24, 09:13
RE: Build a webinferface - by Sidewinder_2011 - 2021-04-24, 09:17
RE: Build a webinferface - by enen92 - 2021-04-24, 10:29
RE: Build a webinterface - by Roman_V_M - 2021-04-25, 08:13
RE: Build a webinterface - by M4tRiX - 2021-04-29, 22:08
RE: Build a webinterface - by M4tRiX - 2021-05-01, 00:39
RE: Build a webinterface - by Roman_V_M - 2021-05-01, 08:20
RE: Build a webinterface - by M4tRiX - 2021-05-01, 13:54
RE: Build a webinterface - by Roman_V_M - 2021-05-02, 07:44
RE: Build a webinterface - by Roman_V_M - 2021-05-02, 07:48
Logout Mark Read Team Forum Stats Members Help
Build a webinterface0