Exemplo n.º 1
0
        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
            }
                );
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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
                }
                    );
            }
        }
Exemplo n.º 6
0
 public static void DestroyVariable(PyVariable variable)
 {
     Eval(string.Format("del {0}", variable.PyName));
 }
Exemplo n.º 7
0
 public XbmcPlayer(PyVariable player)
 {
     PyVariableManager.Get.CopyVariable(Instance, player);
 }
Exemplo n.º 8
0
 public InfoTagRadioRDS()
 {
     this.Instance = PyVariableManager.Get.NewVariable();
 }
Exemplo n.º 9
0
 public InfoTagMusic(PyVariable instance)
 {
     this.Instance = instance;
 }
Exemplo n.º 10
0
        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())));
        }
Exemplo n.º 11
0
 public static string GetVariable(PyVariable variable)
 {
     return(EvalToResult(variable.PyName));
 }
Exemplo n.º 12
0
 public InfoTagRadioRDS()
 {
     this.Instance = PyVariableManager.NewVariable(flags: PyVariableFlags.Object);
 }
Exemplo n.º 13
0
 public InfoTagVideo(PyVariable instance)
 {
     this.Instance = instance;
 }
Exemplo n.º 14
0
 public static string ToPythonCode(this PyVariable var)
 {
     return(var.PyName);
 }
Exemplo n.º 15
0
 public static PythonEvalReply GetVariable(PyVariable variable)
 {
     return(EvalToResult(variable.PyName));
 }
Exemplo n.º 16
0
 public static PythonEvalReply EvalToVar(PyVariable variable, string code)
 {
     return(EvalToVar(variable.PyName, code));
 }
Exemplo n.º 17
0
 public static string EvalToVar(PyVariable variable, string code)
 {
     return(EvalToVar(variable.PyName, code));
 }
Exemplo n.º 18
0
 public InfoTagRadioRDS(PyVariable instance)
 {
     this.Instance = instance;
 }
Exemplo n.º 19
0
 public InfoTagMusic()
 {
     this.Instance = PyVariableManager.Get.NewVariable();
 }