Kodi plugin to to play various online streams (mostly Latvian)

12345678910111213141516171819202122232425262728293031323334
  1. import sys, os, os.path
  2. from kodiswift import xbmc, xbmcgui, CLI_MODE
  3. from resources.lib.sources.config import Source
  4. cfg = Source()
  5. lists = cfg.get_lists()
  6. titles = [cfg.get_title(name) for name in lists]
  7. cmd = sys.argv[1]
  8. if cmd == "add":
  9. if not CLI_MODE:
  10. ret = xbmcgui.Dialog().select("Select menu",titles)
  11. else:
  12. ret = 3
  13. title = sys.argv[2]
  14. img = sys.argv[3]
  15. desc = sys.argv[4]
  16. cfg.add_item(lists[ret],sys.argv[2:])
  17. cfg.write_streams()
  18. elif cmd == "delete":
  19. xbmcgui.Dialog().ok("Info","Not yet implemented!")
  20. elif cmd == "download":
  21. xbmcgui.Dialog().ok("Info","Not yet implemented!")
  22. else:
  23. xbmcgui.Dialog().ok("Error","Wrong command")
  24. #mode = "a" if os.path.exists("context_menu.log") else "w"
  25. #with open("context_menu.log", mode) as f:
  26. # f.write("%s %s %s %s", sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])