Exemple #1
0
        public override int DefaultRoute()
        {
            TestPlugin addon = KodiBridge.RunningAddon as TestPlugin;

            //ConsoleHelper.CreateConsole();
            Console.WriteLine("TestPlugin v1.0 - Smx");

            using (var sum = PyVariableManager.NewVariable()) {
                sum.Value = "1+2";
                PyConsole.WriteLine("Result: " + sum);
            }

            //Console.WriteLine("Settings['test'] => " + addon.Settings["test"]);

            using (var dict = PyVariableManager.NewVariable()) {
                Dictionary <string, string> TestDict = new Dictionary <string, string> {
                    { "hello", "python" },
                    { "dict", "test" }
                };
                dict.Value = TestDict.ToPythonCode();
                PyConsole.WriteLine("Dict: " + dict);
            }

            PyConsole.WriteLine("Hello Python");

            //ConsoleHelper.FreeConsole();
            return(0);
        }
Exemple #2
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
            }
                );
        }
Exemple #3
0
 public InfoTagRadioRDS()
 {
     this.Instance = PyVariableManager.NewVariable(flags: PyVariableFlags.Object);
 }