Esempio 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
            }
                );
        }
Esempio n. 2
0
 /// <summary>
 /// Returns a legal filename or path as a string.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="fatX"></param>
 /// <returns></returns>
 public static string makeLegalFilename(string filename, bool fatX = false)
 {
     return(PythonInterop.CallFunction(
                new PyFunction(PyModule.Xbmc, "makeLegalFilename"),
                filename, fatX
                ));
 }
Esempio n. 3
0
 /// <summary>
 /// Returns the validated path.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static string validatePath(string path)
 {
     return(PythonInterop.CallFunction(
                new PyFunction(PyModule.Xbmc, "validatePath"),
                path
                ));
 }
Esempio n. 4
0
 /// <summary>
 /// Returns a thumb cache filename.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static string getCacheThumbName(string path)
 {
     return(PythonInterop.CallFunction(
                new PyFunction(PyModule.Xbmc, "getCacheThumbName"),
                path
                ));
 }
Esempio n. 5
0
 /// <summary>
 /// Returns the validated path.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static string validatePath(string path)
 {
     return(PythonInterop.CallFunction(
                new PythonFunction(PyModule.Xbmc, "validatePath"),
                new List <object> {
         path
     }
                ));
 }
Esempio n. 6
0
 /// <summary>
 /// Returns a thumb cache filename.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static string getCacheThumbName(string path)
 {
     return(PythonInterop.CallFunction(
                new PythonFunction(PyModule.Xbmc, "getCacheThumbName"),
                new List <object> {
         path
     }
                ));
 }
Esempio n. 7
0
 public static void Show(bool succeded = true, bool updateListing = false, bool cacheToDisc = true)
 {
     PythonInterop.CallFunction(
         new PythonFunction(PyModule.XbmcPlugin, "endOfDirectory"),
         new List <object> {
         KodiBridge.RunningAddon.Handle,
         succeded, updateListing, cacheToDisc
     }
         );
 }
Esempio n. 8
0
 public static void Add(ListItem item)
 {
     PythonInterop.CallFunction(
         new PythonFunction(PyModule.XbmcPlugin, "addDirectoryItem"),
         new List <object> {
         KodiBridge.RunningAddon.Handle,
         item.Url,
         item.Instance,
         item.IsFolder
     }
         );
 }
Esempio n. 9
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
                }
                    );
            }
        }
Esempio n. 10
0
 public dynamic Call(params object[] args)
 {
     return(PythonInterop.CallFunction(this, args));
 }