Kodi Community Forum
Android RunScript in Skin - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: Android Development (https://forum.kodi.tv/forumdisplay.php?fid=184)
+---- Thread: Android RunScript in Skin (/showthread.php?tid=344625)



RunScript in Skin - Sunny C. - 2019-06-11

Hello, everybody,

I want to query a version number in the skin. I created a small script for it.

default.py
python:
import xbmc, xbmcaddon, xbmcgui, xbmcplugin, os, sys, xbmcvfs, HTMLParser, glob, zipfile, json
import shutil
import errno
import string
import random
import urllib2,urllib
import re
import downloader
import extract
import uservar
import skinSwitch
import time
import pyqrcode
from datetime import date, datetime, timedelta
try: from sqlite3 import dbapi2 as database
except: from pysqlite2 import dbapi2 as database
from string import digits

# EVEAM FAVO-SYSTEM
from shutil import copyfile

EVEAM_UPDATE_VERSION = 'http://update.eveam.net/version.txt'
HOME = xbmc.translatePath('special://home/')
USERDATA = os.path.join(HOME, 'userdata')
EVEAM_VERSION = os.path.join(USERDATA, 'version.txt')

def eveamLocal():
serverlink = urllib.urlopen(EVEAM_UPDATE_VERSION)
for versionserver in serverlink:
with open(EVEAM_VERSION, 'r') as file:
versionlocal = file.read().replace('\n', '')
return versionlocal

if mode==None : eveamLocal()
elif mode=='local' : eveamLocal()

Skin XML:
xml:
                <control type="label" id="">
                    <description>Eveam Youtube Version</description>
                    <width>965</width>
                    <height>40</height>
                    <!-- <label>144</label> -->
                    <label>XBMC.RunScript(plugin://script.eveam.version/default.py,mode=local)</label>
                    <align>right</align>
                    <textcolor>$VAR[Colour.500]</textcolor>
                    <font>button.bold</font>
                </control>

As I said, I only want to output the version number. But so far without success. Can someone help me out?

Best regards