1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2013 Team-XBMC
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 __addon__ = xbmcaddon.Addon()
26 __addonversion__ = __addon__.getAddonInfo('version')
27 __addonname__ = __addon__.getAddonInfo('name')
28 __addonpath__ = __addon__.getAddonInfo('path').decode('utf-8')
29 __addonprofile__ = xbmc.translatePath( __addon__.getAddonInfo('profile') ).decode('utf-8')
30 __icon__ = __addon__.getAddonInfo('icon')
33 string = __addon__.getLocalizedString(id).encode( 'utf-8', 'ignore' )
37 if isinstance (txt,str):
38 txt = txt.decode("utf-8")
39 message = u'%s: %s' % ("XBMC Version Check", txt)
40 xbmc.log(msg=message.encode("utf-8"), level=xbmc.LOGDEBUG)
42 def get_password_from_user():
43 keyboard = xbmc.Keyboard("", __addonname__ + "," +localise(32022), True)
45 if (keyboard.isConfirmed()):
46 pwd = keyboard.getText()
49 def message_upgrade_success():
50 xbmc.executebuiltin("XBMC.Notification(%s, %s, %d, %s)" %(__addonname__,
55 def message_restart():
56 if dialog_yesno(32014):
57 xbmc.executebuiltin("RestartApp")
59 def dialog_yesno(line1 = 0, line2 = 0):
60 return xbmcgui.Dialog().yesno(__addonname__,
64 def upgrade_message(msg, oldversion, upgrade):
65 # Don't show while watching a video
66 while(xbmc.Player().isPlayingVideo() and not xbmc.abortRequested):
69 while(i < 5 and not xbmc.abortRequested):
72 if __addon__.getSetting("lastnotified_version") < __addonversion__:
73 xbmcgui.Dialog().ok(__addonname__,
77 __addon__.setSetting("lastnotified_version", __addonversion__)
79 log("Already notified one time for upgrading.")