Originally posted by mrhappy
View Post
Announcement
Collapse
No announcement yet.
Facebook plugin?
Collapse
This topic is closed.
X
X
-
Originally posted by mrhappy View Postsorry I don't use the script anymore so don't know why the error is coming up. It could be dependent on the notification, it might be coming up if someone is using quotes in posts and confusing it thinking the string has finished.
That hstouch example means I had a screen in hstouch called scrFB. This screen had a single element tracked to the notification title. That script line meant when there was a new notification this screen showed up. It really depends on what you want to do in Hstouch.
Option Strict OffImports System.XMLImports System.Text.RegularExpressionsImports System.NetImports System.IOimports Schedulerimports SystemPublic Module scriptcode21#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(ByVal Parms As Object)Const LT As String = "Facebook Notification"Const DC As String = "Q8"Dim PRet As String = ""Dim XMLNews As New XmlDocumentDim XMLNewsNodeList As XmlNodeListDim XMLNewsNode As XmlNodeDim currentLine As StringDim data As StreamDim fileReader As New WebClient()Dim i As Integer = 0Dim sr As StreamReaderDim Result As String = ""TryfileReader.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705")data = fileReader.OpenRead("https://www.facebook.com/feeds/notifications.php?id=1400544417&viewer=1400544417&key=AWgvhd xJ8891DtBD&format=rss20")sr = New StreamReader(data)currentLine = sr.ReadLine()While Not (currentLine Is Nothing)If Not (currentLine.Trim().Equals("")) ThenPRet = PRet & currentLineEnd IfcurrentLine = sr.ReadLine()End Whiledata.Close()XMLNews.LoadXML(PRet)XMLNews.Save(hs.getapp path & "\data\facebook.xml")fileReader.Dispose()XMLNewsNodeList = XMLNews.SelectNodes("//item")'add the top five news items to the list box'remove all the values firstFor Each XMLNewsNode In XMLNewsNodeListDim regx As New Regex("", RegexOptions.IgnoreCase)Result = Regx.Replace(XMLNewsNode.Item("title").InnerText, " ")Result = Result.Replace(" ", " ")Result = Result.Replace(""", "")Result = Result.Replace(Chr(34), "")Result = Result.Replace(" : ", " ")Result = Result.TrimDim DStr = hs.devicestring(DC).TrimIf Result = DStr Then'hs.writelog(LT, "Device string is same as XML result, not a new notification")'this is not new newsElse'why does the device string not equal to the result'hs.writelog(LT, "Device String: " & hs.devicestring(DC))'hs.writelog(LT, "XML Result: " & Result)hs.writelog(LT, "New Notification: " & Result)hs.setdevicestring(DC, Result, True)hs.setdevicestring("Q9", XMLNewsNode.Item("title").InnerText, True)hs.setdevicestring("Q15", XMLNewsNode.Item("pubDate").InnerText, True)hs.setdevicestring("Q15", DateTime.Now.ToString("dd/MM/yyyy HH:mm"), True)hs.runex("xbmcmessage.vb","Main","New Facebook Notification")hs.speak("New Facebook Notification")hs.speak(Result)hs.plugin("HSTouch Server").ClientAction(70, "", "Facebook-L", "")End IFi = i+1If i = 1 ThenExit ForEnd IfNextCatch ex As Exceptionhs.writelog(LT, "Error: " & ex.Message)End TryEnd SubEnd Module
Comment
-
Originally posted by Loup View PostHello, can someone get this script HS3?
Great script, it would be very boring.
thank you
Link is at the bottom of the post here http://ajstillman12.wordpress.com/20...notifications/
Comment
Comment