public List <string> getPropertyList(string objName, string propName) { List <string> list = new List <string>(); DataSet ds = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(objName, propName); foreach (DataRow dr in ds.Tables[0].Rows) { list.Add(dr["item_name"].ToString()); } return(list); }
public List <string> getPropertyList(string objName, string propName, string authkey) { if (OSAESecurity.Authorize(authkey, objName)) { List <string> list = new List <string>(); DataSet ds = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(objName, propName); foreach (DataRow dr in ds.Tables[0].Rows) { list.Add(dr["item_name"].ToString()); } return(list); } else { return(null); } }
public void updateFeeds() { this.Log.Debug("Trying to get all feed Urls:" + pName); DataSet ds = new DataSet(); ds = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(pName, "Feeds"); foreach (DataRow dr in ds.Tables[0].Rows) { try { this.Log.Debug("Fetching feed: " + dr["item_name"].ToString()); WebClient webClient = new WebClient(); string strSource = webClient.DownloadString(dr["item_name"].ToString()); webClient.Dispose(); XmlDocument xml = new XmlDocument(); xml.LoadXml(strSource); string feedTitle = xml.SelectSingleNode("/rss/channel/title").InnerText; this.Log.Debug("Feeds title: " + feedTitle); if (OSAEObjectPropertyManager.GetObjectPropertyValue(pName, feedTitle).Value == "") { this.Log.Debug("Adding property to object type"); OSAEObjectTypeManager.ObjectTypePropertyAdd(feedTitle, "List", "", "RSS", false); } OSAEObjectPropertyManager.ObjectPropertyArrayDeleteAll(pName, feedTitle); this.Log.Debug("Cleared feed data"); XmlNodeList xnList = xml.SelectNodes("/rss/channel/item"); foreach (XmlNode xn in xnList) { string content = xn.SelectSingleNode("title").InnerText + " - " + xn.SelectSingleNode("description").InnerText; content = Regex.Replace(content, "<.*?>", string.Empty); this.Log.Debug("Added item to feed data: " + content); OSAEObjectPropertyManager.ObjectPropertyArrayAdd(pName, feedTitle, content, ""); } } catch (Exception ex) { this.Log.Error("Error", ex); } } }
public override void ProcessCommand(OSAEMethod method) { //Process incomming command this.Log.Debug("Process command: " + method.MethodName); this.Log.Debug("Process parameter1: " + method.Parameter1); this.Log.Debug("Process parameter2: " + method.Parameter2); this.Log.Debug("Address: " + method.Address); switch (method.MethodName) { case "PLAY": if (method.Parameter1.Trim() == string.Empty) { sbs.Play(method.Address); } else { sbs.PlaylistPlay(method.Address, method.Parameter1); } OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PLAYING", pName); break; case "STOP": sbs.StopPlayer(method.Address); OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "STOPPED", pName); break; case "NEXT": sbs.Next(method.Address); break; case "PREV": sbs.Previous(method.Address); break; case "SHOW": sbs.ShowMessage(method.Address, method.Parameter1, Int32.Parse(method.Parameter2)); break; case "PAUSE": sbs.PausePlayer(method.Address); OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PAUSED", pName); break; case "TTS": TextToSpeech(method.Parameter1); sbs.PlaylistPlay(method.Address, ttsPlay); break; case "TTSLIST": DataSet list = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(method.Parameter1, method.Parameter2); string tts = ""; int count = 1; foreach (DataRow item in list.Tables[0].Rows) { tts += " RSS item number " + count.ToString() + ". " + item["item_name"].ToString(); count++; } TextToSpeech(tts); sbs.PlaylistPlay(method.Address, ttsPlay); break; case "TTSLISTRAND": string listItem = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(method.Parameter1, method.Parameter2); TextToSpeech(listItem); sbs.PlaylistPlay(method.Address, ttsPlay); break; } }