Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lekma committed Jun 13, 2023
1 parent f5b0d5e commit 0a9be0d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 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.module.iapc"
name="Inter-Addon Procedure Call"
version="2.1.0"
version="2.1.4"
provider-name="lekma">

<requires>
Expand Down
2 changes: 1 addition & 1 deletion lib/iapc/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import xbmc

from .tools import Logger, getAddonId, executeJSONRPC
from .tools import executeJSONRPC, getAddonId, Logger


# ------------------------------------------------------------------------------
Expand Down
20 changes: 15 additions & 5 deletions lib/iapc/tools/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"getAddonId", "getAddonName", "getAddonVersion",
"getAddonPath", "getAddonIcon", "getAddonProfile",
"getLanguage", "localizedString", "maybeLocalize",
"getMediaPath", "getMedia", "makeProfile",
"getMediaPath", "getMedia",
"pathExists", "profileExists", "makeProfile",
"openSettings", "getSetting", "setSetting",
"Logger"
]
Expand Down Expand Up @@ -55,19 +56,28 @@ def maybeLocalize(value):
return value


__media_path__ = join(getAddonPath(), "resources", "media")
__media_path__ = join("resources", "media")

def getMediaPath(*args):
return join(__media_path__, *args)
return join(getAddonPath(), __media_path__, *args)


def getMedia(name, ext="png"):
return getMediaPath(f"{name}.{ext}")


def pathExists(path):
return xbmcvfs.exists(path)


def profileExists():
return pathExists(getAddonProfile())


def makeProfile():
if not xbmcvfs.exists(profile := getAddonProfile()):
xbmcvfs.mkdirs(profile)
if not pathExists(profile := getAddonProfile()):
return xbmcvfs.mkdirs(profile)
return False


# settings ---------------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions lib/iapc/tools/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

__all__ = [
"executeBuiltin", "executeJSONRPC",
"containerRefresh", "containerUpdate", "playMedia", "addFavourite"
"containerRefresh", "containerUpdate", "playMedia", "runScript",
"addFavourite"
]


Expand Down Expand Up @@ -58,7 +59,10 @@ def containerUpdate(*args):
def playMedia(*args):
executeBuiltin("PlayMedia", *args)

# runScript
def runScript(*args):
executeBuiltin("RunScript", *args)

# addFavourite
def addFavourite(title, type, **kwargs):
executeJSONRPC("Favourites.AddFavourite", title=title, type=type, **kwargs)

0 comments on commit 0a9be0d

Please sign in to comment.