コード例 #1
0
        public void ProcessCommand(System.Data.DataTable table)
        {
            System.Data.DataRow row = table.Rows[0];
            osae.AddToLog("Found Command: " + row["method_name"].ToString() + " | param1: " + row["parameter_1"].ToString() + " | param2: " + row["parameter_1"].ToString(), false);

            XBMCSystem s = getXBMCSystem(row["object_name"].ToString());

            if (s != null)
            {
                switch (row["method_name"].ToString())
                {
                case "VPLAYPAUSE":
                    s.Connection.Player.PlayPause();
                    break;

                case "VSTOP":
                    s.Connection.Player.Stop();
                    break;

                case "VBIGSKIPFORWARD":
                    s.Connection.Player.BigSkipForward();
                    break;

                case "VBIGSKIPBACK":
                    s.Connection.Player.BigSkipBackward();
                    break;
                }
            }
        }
コード例 #2
0
        public override void ProcessCommand(OSAEMethod method)
        {
            this.Log.Debug("Found Command: " + method.MethodName + " | param1: " + method.Parameter1 + " | param2: " + method.Parameter2);

            XBMCSystem s = getXBMCSystem(method.ObjectName);

            if (s != null)
            {
                switch (method.MethodName)
                {
                case "VPLAYPAUSE":
                    s.xbmcSystem.Player.PlayPause();
                    break;

                case "VSTOP":
                    s.xbmcSystem.Player.Stop();
                    break;

                case "VBIGSKIPFORWARD":
                    s.xbmcSystem.Player.Seek2(0, Player.Seekvalue.bigforward);
                    break;

                case "VBIGSKIPBACK":
                    s.xbmcSystem.Player.Seek2(0, Player.Seekvalue.bigbackward);
                    break;
                }
            }
        }
コード例 #3
0
        public override void RunInterface(string pluginName)
        {
            this.Log.Debug("Running interface");
            pName = pluginName;
            OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int    port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                    case "IP":
                        ip = p.Value;
                        break;

                    case "Port":
                        port = Int32.Parse(p.Value);
                        break;

                    case "Username":
                        username = p.Value;
                        break;

                    case "Password":
                        password = p.Value;
                        break;
                    }
                }
                this.Log.Debug("Creating new XBMC System connection: " + obj.Name + " - " + ip);
                try
                {
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                    {
                        Systems.Add(system);
                    }
                }
                catch (Exception ex)
                {
                    this.Log.Error("Error connecting to XBMC system: " + ex.Message + " - " + ex.InnerException.Message);
                }
            }

            Clock          = new System.Timers.Timer();
            Clock.Interval = 5000;

            Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
            Clock.Start();
        }
コード例 #4
0
        public override void RunInterface(string pluginName)
        {
            this.Log.Debug("Running interface");
            pName = pluginName;
            OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                        case "IP":
                            ip = p.Value;
                            break;
                        case "Port":
                            port = Int32.Parse(p.Value);
                            break;
                        case "Username":
                            username = p.Value;
                            break;
                        case "Password":
                            password = p.Value;
                            break;
                    }
                }
                this.Log.Debug("Creating new XBMC System connection: " + obj.Name + " - " + ip);
                try
                {
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                        Systems.Add(system);
                }
                catch (Exception ex)
                {
                    this.Log.Error("Error connecting to XBMC system: " + ex.Message + " - " + ex.InnerException.Message);
                }
            }

            Clock = new System.Timers.Timer();
            Clock.Interval = 5000;
            
            Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
            Clock.Start();
        }
コード例 #5
0
        public void RunInterface(string pluginName)
        {
            osae.AddToLog("Running interface", false);
            pName = pluginName;
            osae.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            List <OSAEObject> XBMCInstances = osae.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int    port = 0;

                foreach (ObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                    case "IP":
                        ip = p.Value;
                        break;

                    case "Port":
                        port = Int32.Parse(p.Value);
                        break;

                    case "Username":
                        username = p.Value;
                        break;

                    case "Password":
                        password = p.Value;
                        break;
                    }
                }
                osae.AddToLog("Creating new XBMC System connection: " + obj.Name + " - " + ip, false);
                XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                system.Connect();
                Systems.Add(system);
            }

            Clock          = new System.Timers.Timer();
            Clock.Interval = 10000;
            Clock.Start();
            Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
        }
コード例 #6
0
        public override void RunInterface(string pluginName)
        {
            logging.AddToLog("Running interface", false);
            pName = pluginName;
            OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                        case "IP":
                            ip = p.Value;
                            break;
                        case "Port":
                            port = Int32.Parse(p.Value);
                            break;
                        case "Username":
                            username = p.Value;
                            break;
                        case "Password":
                            password = p.Value;
                            break;
                    }
                }
                logging.AddToLog("Creating new XBMC System connection: " + obj.Name + " - " + ip, false);
                XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                system.Connect();
                Systems.Add(system);
            }

            //Clock = new System.Timers.Timer();
            //Clock.Interval = 5000;
            //Clock.Start();
            //Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
        }
コード例 #7
0
        public void Timer_Tick(object sender, EventArgs eArgs)
        {
            try
            {
                foreach (XBMCSystem r in Systems)
                {
                    this.Log.Debug("Checking " + r.Name + " - pinging: " + r.Pinging.ToString());
                    if (!r.Pinging)
                    {
                        if (!r.Connected)
                        {
                            this.Log.Info("Removing system from list");
                            Systems.Remove(r);
                        }
                    }
                }

                OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");
                foreach (OSAEObject obj in XBMCInstances.ToList())
                {
                    foreach (XBMCSystem r in Systems)
                    {
                        if (obj.Name == r.Name)
                        {
                            XBMCInstances.Remove(obj);
                        }
                    }
                }
                foreach (OSAEObject obj in XBMCInstances)
                {
                    string ip = "", username = "", password = "";
                    int    port = 0;

                    foreach (OSAEObjectProperty p in obj.Properties)
                    {
                        switch (p.Name)
                        {
                        case "IP":
                            ip = p.Value;
                            break;

                        case "Port":
                            port = Int32.Parse(p.Value);
                            break;

                        case "Username":
                            username = p.Value;
                            break;

                        case "Password":
                            password = p.Value;
                            break;
                        }
                    }
                    this.Log.Debug("Creating new XBMC System connection: " + obj.Name + " - " + ip);
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                    {
                        Systems.Add(system);
                    }
                }
            }
            catch (Exception ex)
            {
                this.Log.Error("Error on timer tick", ex);
            }
        }
コード例 #8
0
        public override void RunInterface(string pluginName)
        {
            Log.Info("Running interface");
            gAppName = pluginName;
            Log      = new General.OSAELog(gAppName);
            if (OSAEObjectManager.ObjectExists(gAppName))
            {
                Log.Info("Found the XBMC plugin's Object (" + gAppName + ")");
            }
            else
            {
                Log.Info("Could Not Find the XBMC plugin's Object!!! (" + gAppName + ")");
            }

            try
            {
                gDebug = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Debug").Value);
            }
            catch
            { Log.Info("The XBMC Object Type seems to be missing the Debug Property!"); }
            Log.Info("Debug Mode Set to " + gDebug);


            OwnTypes();
            //OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int    port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                    case "IP":
                        ip = p.Value;
                        break;

                    case "Port":
                        port = Int32.Parse(p.Value);
                        break;

                    case "Username":
                        username = p.Value;
                        break;

                    case "Password":
                        password = p.Value;
                        break;
                    }
                }
                Log.Info("Creating new XBMC System connection: " + obj.Name + " (" + ip + ":" + port + ", user="******")");
                try
                {
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                    {
                        Systems.Add(system);
                        Log.Info("XBMC System connection Successfull for: " + obj.Name);
                    }
                }
                catch (Exception ex)
                { Log.Error("Error connecting to XBMC system", ex); }
            }

            try
            {
                Clock          = new System.Timers.Timer();
                Clock.Interval = 10000;

                Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
                Clock.Start();
                if (gDebug)
                {
                    Log.Debug("Timers Started");
                }
            }
            catch (Exception ex)
            { Log.Error("Error starting timers ", ex); }
        }
コード例 #9
0
        public void Timer_Tick(object sender, EventArgs eArgs)
        {
            
            try
            {
                foreach (XBMCSystem r in Systems)
                {
                    this.Log.Debug("Checking " + r.Name + " - pinging: " + r.Pinging.ToString());
                    if (!r.Pinging)
                    {
                        if (!r.Connected)
                        {
                            this.Log.Info("Removing system from list");
                            Systems.Remove(r);
                        }
                    }
                }

                OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");
                foreach (OSAEObject obj in XBMCInstances.ToList())
                {
                    foreach (XBMCSystem r in Systems)
                    {
                        if (obj.Name == r.Name)
                            XBMCInstances.Remove(obj);
                    }
                }
                foreach (OSAEObject obj in XBMCInstances)
                {
                    string ip = "", username = "", password = "";
                    int port = 0;

                    foreach (OSAEObjectProperty p in obj.Properties)
                    {
                        switch (p.Name)
                        {
                            case "IP":
                                ip = p.Value;
                                break;
                            case "Port":
                                port = Int32.Parse(p.Value);
                                break;
                            case "Username":
                                username = p.Value;
                                break;
                            case "Password":
                                password = p.Value;
                                break;
                        }
                    }
                    this.Log.Debug("Creating new XBMC System connection: " + obj.Name + " - " + ip);
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                        Systems.Add(system);
                }
            
            }
            catch (Exception ex)
            {
                this.Log.Error("Error on timer tick", ex);
            }

        }
コード例 #10
0
ファイル: XBMC.cs プロジェクト: just8/Open-Source-Automation
        public override void RunInterface(string pluginName)
        {
            Log.Info("Running interface");
            gAppName = pluginName;
            if (OSAEObjectManager.ObjectExists(gAppName))
                Log.Info("Found the XBMC plugin's Object (" + gAppName + ")");
            else
                Log.Info("Could Not Find the XBMC plugin's Object!!! (" + gAppName + ")");

            try
            {
                gDebug = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Debug").Value);
            }
            catch
            {
                Log.Info("The XBMC Object Type seems to be missing the Debug Property!");
            }
            Log.Info("Debug Mode Set to " + gDebug);


            OwnTypes();
            //OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");
            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                        case "IP":
                            ip = p.Value;
                            break;
                        case "Port":
                            port = Int32.Parse(p.Value);
                            break;
                        case "Username":
                            username = p.Value;
                            break;
                        case "Password":
                            password = p.Value;
                            break;
                    }
                }
                Log.Info("Creating new XBMC System connection: " + obj.Name + " (" + ip + ":" + port + ", user="******")");
                try
                {
                    XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                    if (system.Connect())
                    {
                        Systems.Add(system);
                        Log.Info("XBMC System connection Successfull for: " + obj.Name);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("Error connecting to XBMC system",ex);
                }
            }

            try
            {
                Clock = new System.Timers.Timer();
                Clock.Interval = 10000;

                Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
                Clock.Start();
                if (gDebug) Log.Debug("Timers Started");
            }
            catch (Exception ex)
            {
                Log.Error("Error starting timers ", ex);
            }
        }