12345678910111213141516171819202122232425262728293031323334 |
- import sys, os, os.path
- from kodiswift import xbmc, xbmcgui, CLI_MODE
- from resources.lib.sources.config import Source
-
- cfg = Source()
- lists = cfg.get_lists()
- titles = [cfg.get_title(name) for name in lists]
- cmd = sys.argv[1]
-
- if cmd == "add":
- if not CLI_MODE:
- ret = xbmcgui.Dialog().select("Select menu",titles)
- else:
- ret = 3
- title = sys.argv[2]
- img = sys.argv[3]
- desc = sys.argv[4]
- cfg.add_item(lists[ret],sys.argv[2:])
- cfg.write_streams()
-
- elif cmd == "delete":
- xbmcgui.Dialog().ok("Info","Not yet implemented!")
-
- elif cmd == "download":
- xbmcgui.Dialog().ok("Info","Not yet implemented!")
-
- else:
- xbmcgui.Dialog().ok("Error","Wrong command")
-
-
-
- #mode = "a" if os.path.exists("context_menu.log") else "w"
- #with open("context_menu.log", mode) as f:
- # f.write("%s %s %s %s", sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
|