notify_mins = "0" clearSleep() do_it = False action_if_playing = False action = "" warn = -1 action_number = 0 # Load the rules # This can delay for up to 3 minutes if there's no network available rules = rules(True) rules.preloadRulesAddons() # Check the keymaps for this add-on are intact if fixKeymaps(): xbmcgui.Dialog().ok(addon_name, "The keymap had been renamed. This has been reverted to the correct name, but you must restart for the keymap to take effect.") while not monitor.abortRequested(): t = now() # This copes with endPlayback not being called properly (for whatever reason) if player.isStillPlaying() and not player.isPlaying(): player.runPlaybackEnded("main loop") if playback_timer > 0 and t > playback_timer: player.stop() infoTrace("service.py", "Stopping play back. Duration is " + str(playback_duration_minutes) + " minutes, time limit is " + str(playback_time)) # Sleep Checking
action = sys.argv[1] debugTrace("-- Entered mapkey.py with parameter " + action + " --") cycle_key = "" info_key = "" map_name = getKeyMapsFileName() xml_start = '<keymap><global><keyboard>\n' xml_key = '<key id="#KEY">runscript(#PATH#COMMAND)</key>\n' xml_end = '</keyboard></global></keymap>\n' cycle_command = "cycle.py" info_command = "infopopup.py" # Fix the keymap if it's been renamed by the Keymap addon fixKeymaps() # Determine if there's an existing map that needs to be updated if xbmcvfs.exists(getKeyMapsPath(map_name)): path = getKeyMapsPath(map_name) try: debugTrace("Writing the map file to " + path) map_file = open(path, 'r') lines = map_file.readlines() map_file.close() for line in lines: if cycle_command in line: i1 = line.index("key id=\"") + 8 i2 = line.index("\"", i1) cycle_key = line[i1:i2] debugTrace("Found cycle key " + cycle_key)
action = sys.argv[1] debugTrace("-- Entered mapkey.py with parameter " + action + " --") cycle_key = "" info_key = "" map_name = getKeyMapsFileName() xml_start = '<keymap><global><keyboard>\n' xml_key = '<key id="#KEY">runscript(#PATH#COMMAND)</key>\n' xml_end = '</keyboard></global></keymap>\n' cycle_command = "cycle.py" info_command = "infopopup.py" # Fix the keymap if it's been renamed by the Keymap addon fixKeymaps() # Determine if there's an existing map that needs to be updated if xbmcvfs.exists(getKeyMapsPath(map_name)): path = getKeyMapsPath(map_name) try: debugTrace("Writing the map file to " + path) map_file = open(path, 'r') lines = map_file.readlines() map_file.close() for line in lines: if cycle_command in line: i1 = line.index("key id=\"") + 8 i2 = line.index("\"", i1) cycle_key = line[i1:i2] debugTrace("Found cycle key " + cycle_key)