Skip to content

Commit

Permalink
Merge pull request #60 from Ignoble61/master
Browse files Browse the repository at this point in the history
Remove references to Kodi v13
  • Loading branch information
marcelveldt committed Sep 4, 2015
2 parents 6f75cfb + ecddb17 commit a49b45c
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 143 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.skinshortcuts" name="Skin Shortcuts" version="0.5.3" provider-name="BigNoid,marcelveldt">
<requires>
<import addon="xbmc.python" version="2.14.0"/>
<import addon="xbmc.python" version="2.19.0"/>
<import addon="script.module.simplejson" version="3.3.0"/>
<import addon="script.module.unidecode" version="0.4.14"/>
</requires>
Expand Down
2 changes: 1 addition & 1 deletion default.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
hashlist = []

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
if isinstance (txt,str):
txt = txt.decode('utf-8')
message = u'%s: %s' % (__addonid__, txt)
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/datafunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
REMOVE_REXP = re.compile('-{2,}')

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
try:
if isinstance (txt,str):
txt = txt.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
xbmcvfs.mkdir(__datapath__)

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
try:
if isinstance (txt,str):
txt = txt.decode('utf-8')
Expand Down
58 changes: 18 additions & 40 deletions resources/lib/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
__xbmcversion__ = xbmc.getInfoLabel( "System.BuildVersion" ).split(".")[0]

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
try:
if isinstance (txt,str):
txt = txt.decode('utf-8')
Expand Down Expand Up @@ -739,12 +739,9 @@ def common( self ):
listitems.append( self._create(["ActivateWindow(Videos,videodb://movies/titles/,return)", "342", "32034", {"icon": "DefaultMovies.png"} ]) )
listitems.append( self._create(["ActivateWindow(Videos,videodb://tvshows/titles/,return)", "20343", "32034", {"icon": "DefaultTVShows.png"} ]) )

if __xbmcversion__ == "13":
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,34,0 ,13,0)", "32022", "32034", {"icon": "DefaultTVShows.png"} ]) )
else:
listitems.append( self._create(["ActivateWindow(TVGuide)", "32022", "32034", {"icon": "DefaultTVShows.png"} ]) )
listitems.append( self._create(["ActivateWindow(RadioGuide)", "32087", "32034", {"icon": "DefaultTVShows.png"} ]) )

listitems.append( self._create(["ActivateWindow(TVGuide)", "32022", "32034", {"icon": "DefaultTVShows.png"} ]) )
listitems.append( self._create(["ActivateWindow(RadioGuide)", "32087", "32034", {"icon": "DefaultTVShows.png"} ]) )

listitems.append( self._create(["ActivateWindow(Music)", "10005", "32034", {"icon": "DefaultMusicAlbums.png"} ]) )
listitems.append( self._create(["ActivateWindow(Videos,videodb://musicvideos/titles/,return)", "20389", "32034", {"icon": "DefaultMusicVideos.png"} ] ) )
listitems.append( self._create(["ActivateWindow(Pictures)", "10002", "32034", {"icon": "DefaultPicture.png"} ] ) )
Expand Down Expand Up @@ -800,20 +797,12 @@ def more( self ):
listitems.append( self._create(["Mastermode", "20045", "32054", {} ]) )

listitems.append( self._create(["RipCD", "600", "32054", {} ]) )

if __xbmcversion__ == "13":
listitems.append( self._create(["UpdateLibrary(video)", "32046", "32054", {} ]) )
listitems.append( self._create(["UpdateLibrary(music)", "32047", "32054", {} ]) )
else:
listitems.append( self._create(["UpdateLibrary(video,,true)", "32046", "32054", {} ]) )
listitems.append( self._create(["UpdateLibrary(music,,true)", "32047", "32054", {} ]) )

if __xbmcversion__ == "13":
listitems.append( self._create(["CleanLibrary(video)", "32055", "32054", {} ]) )
listitems.append( self._create(["CleanLibrary(music)", "32056", "32054", {} ]) )
else:
listitems.append( self._create(["CleanLibrary(video,true)", "32055", "32054", {} ]) )
listitems.append( self._create(["CleanLibrary(music,true)", "32056", "32054", {} ]) )

listitems.append( self._create(["UpdateLibrary(video,,true)", "32046", "32054", {} ]) )
listitems.append( self._create(["UpdateLibrary(music,,true)", "32047", "32054", {} ]) )

listitems.append( self._create(["CleanLibrary(video,true)", "32055", "32054", {} ]) )
listitems.append( self._create(["CleanLibrary(music,true)", "32056", "32054", {} ]) )

self.addToDictionary( "commands", listitems )

Expand Down Expand Up @@ -875,25 +864,14 @@ def pvrlibrary( self ):
log('Listing pvr library...')

# PVR
if __xbmcversion__ == "13":
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,32,0 ,11,0)", "19023", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,33,0 ,12,0)", "19024", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,31,0 ,10,0)", "19069", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,34,0 ,13,0)", "19163", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindowAndFocus(MyPVR,35,0 ,14,0)", "32023", "32017", {"icon": "DefaultTVShows.png"} ] ) )

listitems.append( self._create(["PlayPvrTV", "32066", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["PlayPvrRadio", "32067", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["PlayPvr", "32068", "32017", {"icon": "DefaultTVShows.png"} ] ) )
else:
listitems.append( self._create(["ActivateWindow(TVChannels)", "19019", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVGuide)", "22020", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVRecordings)", "19163", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVTimers)", "19040", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVSearch)", "137", "32017", {"icon": "DefaultTVShows.png"} ] ) )

listitems.append( self._create(["PlayPvrTV", "32066", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["PlayPvr", "32068", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVChannels)", "19019", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVGuide)", "22020", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVRecordings)", "19163", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVTimers)", "19040", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["ActivateWindow(TVSearch)", "137", "32017", {"icon": "DefaultTVShows.png"} ] ) )

listitems.append( self._create(["PlayPvrTV", "32066", "32017", {"icon": "DefaultTVShows.png"} ] ) )
listitems.append( self._create(["PlayPvr", "32068", "32017", {"icon": "DefaultTVShows.png"} ] ) )

self.addToDictionary( "pvr", listitems )

Expand Down
2 changes: 1 addition & 1 deletion resources/lib/nodefunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
REMOVE_REXP = re.compile('-{2,}')

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
try:
if isinstance (txt,str):
txt = txt.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__skinpath__ = xbmc.translatePath( "special://skin/shortcuts/" ).decode('utf-8')

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
try:
if isinstance (txt,str):
txt = txt.decode('utf-8')
Expand Down
81 changes: 42 additions & 39 deletions resources/lib/xmlfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import hashlib, hashlist

def log(txt):
if __xbmcversion__ == "13" or __addon__.getSetting( "enable_logging" ) == "true":
if __addon__.getSetting( "enable_logging" ) == "true":
if isinstance (txt,str):
txt = txt.decode('utf-8')
message = u'%s: %s' % (__addonid__, txt)
Expand Down Expand Up @@ -104,51 +104,54 @@ def buildMenu( self, mainmenuID, groups, numLevels, buildMode, options, weEnable
# Menu is built, reload the skin
xbmc.executebuiltin( "XBMC.ReloadSkin()" )
else:
# Menu couldn't be built - if the user has script.xbmc.debug.log offer to upload a debug log
if xbmc.getCondVisibility( "System.HasAddon( script.xbmc.debug.log )" ):
# If we enabled debug logging
if weEnabledSystemDebug or weEnabledScriptDebug:
# Disable any logging we enabled
if weEnabledSystemDebug:
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method":"Settings.setSettingValue", "params": {"setting":"debug.showloginfo", "value":false} } ' )
if weEnabledScriptDebug:
__addon__.setSetting( "enable_logging", "false" )

# Offer to upload a debug log
# Menu couldn't be built - generate a debug log

# If we enabled debug logging
if weEnabledSystemDebug or weEnabledScriptDebug:
# Disable any logging we enabled
if weEnabledSystemDebug:
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method":"Settings.setSettingValue", "params": {"setting":"debug.showloginfo", "value":false} } ' )
if weEnabledScriptDebug:
__addon__.setSetting( "enable_logging", "false" )

# Offer to upload a debug log
if xbmc.getCondVisibility( "System.HasAddon( script.xbmc.debug.log )" ):
ret = xbmcgui.Dialog().yesno( __addon__.getAddonInfo( "name" ), __language__( 32092 ), __language__( 32093 ) )
if ret:
xbmc.executebuiltin( "RunScript(script.xbmc.debug.log)" )

xbmc.executebuiltin( "RunScript(script.xbmc.debug.log)" )
else:
# Enable any debug logging needed
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method": "Settings.getSettings", "params": { "filter":{"section":"system", "category":"debug"} } }')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
xbmcgui.Dialog().ok( __addon__.getAddonInfo( "name" ), __language__( 32092 ), __language__( 32094 ) )

enabledSystemDebug = False
enabledScriptDebug = False
if json_response.has_key('result') and json_response['result'].has_key('settings') and json_response['result']['settings'] is not None:
for item in json_response['result']['settings']:
if item["id"] == "debug.showloginfo":
if item["value"] == False:
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method":"Settings.setSettingValue", "params": {"setting":"debug.showloginfo", "value":true} } ' )
enabledSystemDebug = True
else:
# Enable any debug logging needed
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method": "Settings.getSettings", "params": { "filter":{"section":"system", "category":"debug"} } }')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)

enabledSystemDebug = False
enabledScriptDebug = False
if json_response.has_key('result') and json_response['result'].has_key('settings') and json_response['result']['settings'] is not None:
for item in json_response['result']['settings']:
if item["id"] == "debug.showloginfo":
if item["value"] == False:
json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method":"Settings.setSettingValue", "params": {"setting":"debug.showloginfo", "value":true} } ' )
enabledSystemDebug = True

if __addon__.getSetting( "enable_logging" ) != "true":
__addon__.setSetting( "enable_logging", "true" )
enabledScriptDebug = True

if __addon__.getSetting( "enable_logging" ) != "true":
__addon__.setSetting( "enable_logging", "true" )
enabledScriptDebug = True

if enabledSystemDebug or enabledScriptDebug:
# We enabled one or more of the debug options, re-run this function
self.buildMenu( mainmenuID, groups, numLevels, buildMode, options, enabledSystemDebug, enabledScriptDebug )
else:
# Debug logging already enabled - offer to upload a debug log
if enabledSystemDebug or enabledScriptDebug:
# We enabled one or more of the debug options, re-run this function
self.buildMenu( mainmenuID, groups, numLevels, buildMode, options, enabledSystemDebug, enabledScriptDebug )
else:
# Offer to upload a debug log
if xbmc.getCondVisibility( "System.HasAddon( script.xbmc.debug.log )" ):
ret = xbmcgui.Dialog().yesno( __addon__.getAddonInfo( "name" ), __language__( 32092 ), __language__( 32093 ) )
if ret:
xbmc.executebuiltin( "RunScript(script.xbmc.debug.log)" )

else:
xbmcgui.Dialog().ok( __addon__.getAddonInfo( "name" ), __language__( 32092 ), __language__( 32094 ) )
xbmc.executebuiltin( "RunScript(script.xbmc.debug.log)" )
else:
xbmcgui.Dialog().ok( __addon__.getAddonInfo( "name" ), __language__( 32092 ), __language__( 32094 ) )

def shouldwerun( self, profilelist ):
try:
Expand Down
32 changes: 0 additions & 32 deletions resources/shortcuts/livetv.DATA.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<shortcuts>
<shortcut>
<label>19023</label>
<label2>32017</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindowAndFocus(MyPVR,32,0 ,11,0)</action>
<version>13</version>
</shortcut>
<shortcut>
<label>19019</label>
<label2>32017</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindow(TVChannels)</action>
<version>14</version>
</shortcut>
<shortcut>
<label>19024</label>
<label2>32017</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindowAndFocus(MyPVR,33,0 ,12,0)</action>
<version>13</version>
</shortcut>
<shortcut>
<label>19069</label>
<label2>32017</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindowAndFocus(MyPVR,31,0 ,10,0)</action>
<version>13</version>
</shortcut>
<shortcut>
<label>22020</label>
<label2>32017</label2>
Expand Down
10 changes: 0 additions & 10 deletions resources/shortcuts/mainmenu.DATA.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,19 @@
<thumb />
<action>ActivateWindow(Pictures)</action>
</shortcut>
<shortcut>
<label>32022</label>
<label2>32034</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindowAndFocus(MyPVR,34,0 ,13,0)</action>
<version>13</version>
</shortcut>
<shortcut>
<label>32022</label>
<label2>32034</label2>
<icon>DefaultTVShows.png</icon>
<thumb />
<action>ActivateWindow(TVGuide)</action>
<version>14</version>
</shortcut>
<shortcut>
<label>32087</label>
<label2>32034</label2>
<icon>DefaultAudio.png</icon>
<thumb />
<action>ActivateWindow(RadioGuide)</action>
<version>14</version>
</shortcut>
<shortcut>
<label>10006</label>
Expand Down
18 changes: 2 additions & 16 deletions resources/shortcuts/overrides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
<shortcutEquivalent version="14" action="ActivateWindow(RadioTimers)">All</shortcutEquivalent>
<shortcutEquivalent version="14" action="ActivateWindow(RadioSearch)">All</shortcutEquivalent>

<!-- Music shortcuts -->
<shortcutEquivalent version="13" action="MusicLibrary,Artists,return">14</shortcutEquivalent>
<shortcutEquivalent version="13" action="ActivateWindow(MusicLibrary,Albums,return)">14</shortcutEquivalent>
<shortcutEquivalent version="13" action="ActivateWindow(MusicLibrary,Songs,return)">14</shortcutEquivalent>

<shortcutEquivalent version="15" action="ActivateWindow(MusicLibrary,musicdb://artists/,return)">All</shortcutEquivalent>
<shortcutEquivalent version="15" action="ActivateWindow(MusicLibrary,musicdb://albums/,return)">All</shortcutEquivalent>
<shortcutEquivalent version="15" action="ActivateWindow(MusicLibrary,musicdb://songs/,return)">All</shortcutEquivalent>

</versionEquivalency>


Expand All @@ -50,16 +41,11 @@
<node label="32031">
<content>music</content>
</node>
<node label="32017" condition="System.GetBool(pvrmanager.enabled)" version="13">
<node label="32017" condition="PVR.HasTVChannels">
<content>pvr</content>
<content>pvr-tv</content>
<content>pvr-radio</content>
</node>
<node label="32017" condition="PVR.HasTVChannels" version="14">
<content>pvr</content>
<content>pvr-tv</content>
</node>
<node label="32087" condition="PVR.HasRadioChannels" version="14">
<node label="32087" condition="PVR.HasRadioChannels">
<content>radio</content>
<content>pvr-radio</content>
</node>
Expand Down

0 comments on commit a49b45c

Please sign in to comment.