File IvoR.hws changed (mode: 100755) (index 6aa32cc..87f34b2) |
... |
... |
IvoR = {} |
8 |
8 |
;č buď pomocí IvoR.Bar nebo self.Bar |
;č buď pomocí IvoR.Bar nebo self.Bar |
9 |
9 |
;č V tom self nevidím žádný smysl |
;č V tom self nevidím žádný smysl |
10 |
10 |
|
|
11 |
|
Ivor.parsers = CreateList() |
|
|
11 |
|
IvoR.parsers = CreateList() |
12 |
12 |
|
|
13 |
13 |
Function IvoR:Load(feedid$) |
Function IvoR:Load(feedid$) |
14 |
|
IvoR:Clear() |
|
|
14 |
|
;DebugPrint(p_GetXMLname(feedid$)) |
|
15 |
|
Local err_code, text$, _len = ?FileToString(p_GetXMLname(feedid$)) |
|
16 |
|
; když máme chybu, tak rovnou končíme |
|
17 |
|
If err_code <> #ERR_NONE |
|
18 |
|
mui.Set("status", "Contents", "\27b" .. GetErrorName(err_code)) |
|
19 |
|
Return() |
|
20 |
|
EndIf |
|
21 |
|
|
|
22 |
|
|
|
23 |
|
Ivor:Clear() |
15 |
24 |
|
|
16 |
25 |
; TODO: load icon |
; TODO: load icon |
17 |
26 |
|
|
18 |
|
local lastP = GetItem(Ivor.parsers, -1) |
|
|
27 |
|
local lastP = GetItem(IvoR.parsers, -1) |
19 |
28 |
If Not isNil(lastP) Then lastP:Stop() |
If Not isNil(lastP) Then lastP:Stop() |
20 |
29 |
|
|
21 |
|
text$ = FileToString("feed.xml") |
|
22 |
|
;mui.Set("textfield", "Text", text$) |
|
23 |
|
|
|
24 |
|
;text$ = [[ <to attr="megagood"> some ]] |
|
25 |
30 |
|
|
26 |
|
items_list = CreateList() |
|
27 |
|
channel_level = True |
|
28 |
|
current_element$ = Nil |
|
|
31 |
|
items_list = CreateList() |
|
32 |
|
channel_level = True |
|
33 |
|
current_element$ = Nil |
29 |
34 |
|
|
30 |
|
current_item = {title="", pubdate="", category="", description=""} |
|
|
35 |
|
current_item = {title="", pubdate="", category="", description=""} |
31 |
36 |
|
|
32 |
37 |
Local p = XMLParser.New({StartElement = StartElement, EndElement=EndElement, CharacterData = CharacterData}) |
Local p = XMLParser.New({StartElement = StartElement, EndElement=EndElement, CharacterData = CharacterData}) |
33 |
38 |
InsertItem(Ivor.parsers, p) |
InsertItem(Ivor.parsers, p) |
|
... |
... |
EndFunction |
96 |
101 |
Function CharacterData(p, str$) |
Function CharacterData(p, str$) |
97 |
102 |
;DebugPrint("CD: ", str$) |
;DebugPrint("CD: ", str$) |
98 |
103 |
If channel_level |
If channel_level |
99 |
|
If current_element$ = "title" Then mui.Set("channel_title", "Contents", str$) |
|
100 |
|
If current_element$ = "description" Then mui.Set("channel_description", "Contents", str$) |
|
|
104 |
|
If current_element$ = "title" Then mui.Set("channel_title", "Contents", StripStr(str$)) |
|
105 |
|
If current_element$ = "description" Then mui.Set("channel_description", "Contents", StripStr(str$)) |
101 |
106 |
|
|
102 |
107 |
else |
else |
103 |
|
If current_element$ = "title" Then current_item.title = str$ |
|
104 |
|
If current_element$ = "pubDate" Then current_item.pubdate = str$ |
|
105 |
|
If current_element$ = "description" Then current_item.description = str$ |
|
|
108 |
|
If current_element$ = "title" Then current_item.title = StripStr(str$) |
|
109 |
|
If current_element$ = "pubDate" Then current_item.pubdate = StripStr(str$) |
|
110 |
|
If current_element$ = "description" Then current_item.description = StripStr(str$) |
106 |
111 |
If current_element$ = "category" |
If current_element$ = "category" |
107 |
112 |
If current_item.category = "" |
If current_item.category = "" |
108 |
113 |
current_item.category = str$ |
current_item.category = str$ |
109 |
114 |
Else |
Else |
110 |
|
current_item.category = current_item.category .. ", " .. str$ |
|
|
115 |
|
current_item.category = current_item.category .. ", " .. StripStr(str$) |
111 |
116 |
EndIf |
EndIf |
112 |
117 |
Endif |
Endif |
113 |
118 |
EndIf |
EndIf |
File IvoRSS.hws changed (mode: 100755) (index 7e67488..01430ee) |
... |
... |
Function p_GetFileID(feedid$) |
171 |
171 |
Return(LeftStr(MD5Str(feedid$), 26)) |
Return(LeftStr(MD5Str(feedid$), 26)) |
172 |
172 |
EndFunction |
EndFunction |
173 |
173 |
|
|
|
174 |
|
Function p_GetXMLname(feedid$) |
|
175 |
|
Return("Feeds/"..p_GetFileID(feedid$)..".xml") |
|
176 |
|
EndFunction |
|
177 |
|
|
|
178 |
|
|
174 |
179 |
/* From Hollywood docs: |
/* From Hollywood docs: |
175 |
180 |
Action: #DOWNLOADFILE_STATUS |
Action: #DOWNLOADFILE_STATUS |
176 |
181 |
Count: Contains the number of bytes that have already been downloaded. |
Count: Contains the number of bytes that have already been downloaded. |
|
... |
... |
InstallEventHandler({MUIRoyale = p_MUIEvent}) |
296 |
301 |
p_StartUpLoading() |
p_StartUpLoading() |
297 |
302 |
|
|
298 |
303 |
|
|
299 |
|
StartTimer(1) |
|
300 |
|
;p_testParse() |
|
301 |
|
For Local k = 1 To 100 |
|
302 |
|
CheckEvents() |
|
303 |
|
mui.DoMethod("articles", "Insert", "Bottom", |
|
304 |
|
k, |
|
305 |
|
"Dneska", |
|
306 |
|
"Test") |
|
307 |
|
Next |
|
308 |
|
DebugPrint("This took", GetTimer(1), "ms", strlen(data$)) |
|
309 |
|
|
|
310 |
|
IvoR:Load(feedid$) |
|
311 |
|
|
|
312 |
|
;Print(GetCatalogString(4, "default string")) |
|
313 |
|
|
|
314 |
304 |
Repeat |
Repeat |
315 |
305 |
WaitEvent |
WaitEvent |
316 |
306 |
Forever |
Forever |
File feedtree.hws changed (mode: 100755) (index ac7d16a..08e4a77) |
... |
... |
Function p_FetchCurrent() |
52 |
52 |
If t.Node |
If t.Node |
53 |
53 |
p_FetchGroup(t.muiid) |
p_FetchGroup(t.muiid) |
54 |
54 |
Else |
Else |
55 |
|
p_FetchFeed(t.id) |
|
|
55 |
|
If p_FetchFeed(t.id) = #ERR_NONE |
|
56 |
|
Ivor:Load(t.id) |
|
57 |
|
EndIf |
56 |
58 |
EndIf |
EndIf |
57 |
59 |
EndIf |
EndIf |
58 |
60 |
p_Unlock() |
p_Unlock() |
59 |
|
Ivor:Load(t.id) |
|
60 |
61 |
EndFunction |
EndFunction |
61 |
62 |
|
|
62 |
63 |
|
|
|
... |
... |
Function p_FetchFeed(feedid$) |
96 |
97 |
mui.DoMethod(#LIST_TREE, "Rename", feedid$, "\27i" .. feedid$) |
mui.DoMethod(#LIST_TREE, "Rename", feedid$, "\27i" .. feedid$) |
97 |
98 |
EndIf |
EndIf |
98 |
99 |
Else |
Else |
99 |
|
Local err_code = p_Download(feedid$, |
|
100 |
|
"Feeds/"..p_GetFileID(feedid$)..".xml") |
|
|
100 |
|
Local err_code = p_Download(feedid$, p_GetXMLname(feedid$)) |
101 |
101 |
;č zde je to jednoduchý, stahování je bud úspěšné, nebo neúspěšné |
;č zde je to jednoduchý, stahování je bud úspěšné, nebo neúspěšné |
102 |
102 |
mui.DoMethod(#LIST_TREE, "Rename", feedid$, |
mui.DoMethod(#LIST_TREE, "Rename", feedid$, |
103 |
103 |
IIf(err_code = #ERR_NONE, "\27".."5\27b", "\27i") .. feedid$) |
IIf(err_code = #ERR_NONE, "\27".."5\27b", "\27i") .. feedid$) |
104 |
104 |
|
|
105 |
105 |
EndIf |
EndIf |
|
106 |
|
Return(err_code) |
106 |
107 |
EndFunction |
EndFunction |
107 |
108 |
|
|
108 |
109 |
|
|