public static void Add(IList <ListItem> items) { var list = PyVariableManager.NewVariable(); string listCode = "["; for (int i = 0; i < items.Count; i++) { listCode += string.Format("({0},{1},{2})", PythonInterop.EscapeArgument(items[i].Url), items[i].Instance.PyName, items[i].IsFolder ); if (i + 1 < items.Count) { listCode += ","; } } listCode += "]"; PyVariable listVar = PyVariableManager.NewVariable(flags: PyVariableFlags.Object); listVar.Value = listCode; PythonInterop.CallFunction( new PythonFunction(PyModule.XbmcPlugin, "addDirectoryItems"), new List <object> { KodiBridge.RunningAddon.Handle, listVar, items.Count } ); }
public XbmcPlayer() { this.Instance = PyVariableManager.Get.NewVariable(evalCode: "self.new_player()"); // We now register this type so that PostEvent will be able to invoke onMessage in this class Console.WriteLine("=> Registering EventClass " + typeof(XbmcPlayer).FullName); KodiBridge.RegisterPlayer(this); }
public Player() { PyEventClassBuilder cb = new PyEventClassBuilder("xbmc.Player", typeof(Player)); cb.Methods.AddRange(this.eventNames); cb.Install(); this.Instance = cb.NewInstance(flags: PyVariableFlags.Player); Console.WriteLine("=> Registering EventClass " + typeof(Player).FullName); KodiBridge.RegisterEventClass(typeof(Player), this); }
public Monitor() { PyEventClassBuilder cb = new PyEventClassBuilder("xbmc.Monitor", typeof(Monitor)); cb.Methods.AddRange(this.eventNames); cb.Install(); this.Instance = cb.NewInstance(flags: PyVariableFlags.Monitor); // We now register this type so that PostEvent will be able to invoke onMessage in this class Console.WriteLine("=> Registering EventClass " + typeof(Monitor).FullName); KodiBridge.RegisterEventClass(typeof(Monitor), this); }
public static void Add(IList <ListItem> items) { var list = PyVariableManager.Get.NewVariable(); string listCode = items.ToPythonCode(); using (PyVariable listVar = PyVariableManager.Get.NewVariable(evalCode: listCode)) { PythonInterop.CallFunction( new PyFunction(PyModule.XbmcPlugin, "addDirectoryItems"), new List <object> { KodiBridge.RunningAddon.Handle, listVar, items.Count } ); } }
public static void DestroyVariable(PyVariable variable) { Eval(string.Format("del {0}", variable.PyName)); }
public XbmcPlayer(PyVariable player) { PyVariableManager.Get.CopyVariable(Instance, player); }
public InfoTagRadioRDS() { this.Instance = PyVariableManager.Get.NewVariable(); }
public InfoTagMusic(PyVariable instance) { this.Instance = instance; }
public static PythonEvalReply EvalToVar(PyVariable variable, string codeFormat, List <object> arguments, EscapeFlags escapeMethod) { List <string> textArguments = EscapeArguments(arguments, escapeMethod); return(EvalToVar(variable, string.Format(codeFormat, textArguments.ToArray()))); }
public static string GetVariable(PyVariable variable) { return(EvalToResult(variable.PyName)); }
public InfoTagRadioRDS() { this.Instance = PyVariableManager.NewVariable(flags: PyVariableFlags.Object); }
public InfoTagVideo(PyVariable instance) { this.Instance = instance; }
public static string ToPythonCode(this PyVariable var) { return(var.PyName); }
public static PythonEvalReply GetVariable(PyVariable variable) { return(EvalToResult(variable.PyName)); }
public static PythonEvalReply EvalToVar(PyVariable variable, string code) { return(EvalToVar(variable.PyName, code)); }
public static string EvalToVar(PyVariable variable, string code) { return(EvalToVar(variable.PyName, code)); }
public InfoTagRadioRDS(PyVariable instance) { this.Instance = instance; }
public InfoTagMusic() { this.Instance = PyVariableManager.Get.NewVariable(); }