File IvoR.hws changed (mode: 100755) (index 4e263c3..9a89dd9) |
... |
... |
Function IvoR:Load(feedid$) |
19 |
19 |
local lastP = GetItem(IvoR.parsers, -1) |
local lastP = GetItem(IvoR.parsers, -1) |
20 |
20 |
If Not isNil(lastP) Then lastP:Stop() |
If Not isNil(lastP) Then lastP:Stop() |
21 |
21 |
|
|
|
22 |
|
self.feedid = feedid$ |
|
23 |
|
self.link = feedid$ |
|
24 |
|
|
22 |
25 |
;č teprve teď uklízíme |
;č teprve teď uklízíme |
23 |
26 |
Ivor:Clear() |
Ivor:Clear() |
24 |
27 |
|
|
25 |
28 |
; TODO: load icon |
; TODO: load icon |
|
29 |
|
self.ImageLoaded = False |
|
30 |
|
self:LoadImage() |
|
31 |
|
If Not self.ImageLoaded Then mui.Set("feedimage", "Brush", 1) |
26 |
32 |
|
|
27 |
33 |
|
|
28 |
34 |
;č a vytahujeme seznam přečteného |
;č a vytahujeme seznam přečteného |
|
... |
... |
Function IvoR:ShowArticle(pos) |
113 |
119 |
EndFunction |
EndFunction |
114 |
120 |
|
|
115 |
121 |
|
|
|
122 |
|
Function IvoR:DownloadImage(str$) |
|
123 |
|
If Not AllowImages Or self.ImageLoaded Then Return() |
|
124 |
|
Local extension$ = "image" |
|
125 |
|
If StrLen(str$) > 4 |
|
126 |
|
Switch LowerStr(RightStr(str$, 4)) |
|
127 |
|
Case "ilbm": FallThrough |
|
128 |
|
Case ".lbm": extension$ = "ilbm" |
|
129 |
|
Case ".png": extension$ = "png" |
|
130 |
|
Case ".gif": extension$ = "gif" |
|
131 |
|
Case "jpeg": FallThrough |
|
132 |
|
Case ".jpg": extension$ = "jpg" |
|
133 |
|
Case ".bmp": extension$ = "bmp" |
|
134 |
|
EndSwitch |
|
135 |
|
EndIf |
|
136 |
|
|
|
137 |
|
Local url$ = p_reconstructURL(self.link, str$) |
|
138 |
|
Local err_code, _empty_str$, count = ?DownloadFile(url$, |
|
139 |
|
{File=p_GetLogoName(self.feedid, extension$), Adapter="hurl", |
|
140 |
|
Fail404=True, Encoded=FindStr(url$, "%", True) <> -1}) |
|
141 |
|
p_Replay(err_code, "Image logo is downloaded") |
|
142 |
|
fd_Set(self.feedid, "imageformat", extension$) |
|
143 |
|
|
|
144 |
|
self:LoadImage() |
|
145 |
|
|
|
146 |
|
EndFunction |
|
147 |
|
|
|
148 |
|
Function IvoR:LoadImage() |
|
149 |
|
If Not AllowImages Or self.ImageLoaded Then Return() |
|
150 |
|
Local extension$ = fd_Get(self.feedid, "imageformat") |
|
151 |
|
If IsNil(extension$) Then Return() |
|
152 |
|
|
|
153 |
|
Local filename$ = p_GetLogoName(self.feedid, extension$) |
|
154 |
|
Local ret, t = IsPicture(filename$, {Loader="Inbuilt"}) |
|
155 |
|
If Not ret Then Return() |
|
156 |
|
|
|
157 |
|
For i,v In Pairs(t) |
|
158 |
|
DebugPrint(i .. "=" .. v) |
|
159 |
|
Next |
|
160 |
|
|
|
161 |
|
Local err_code, _id = ?LoadBrush(2, filename$, |
|
162 |
|
{LoadAlpha = t.Alpha, LoadTransparency=t.Transparency}) |
|
163 |
|
If err_code <> #ERR_NONE |
|
164 |
|
mui.Set("status", "Contents", "\27b" .. GetErrorName(err_code)) |
|
165 |
|
Return() |
|
166 |
|
EndIf |
|
167 |
|
DebugPrint(ID) |
|
168 |
|
If t.Height > 32 Then ScaleBrush(2, #KEEPASPRAT, 32) |
|
169 |
|
|
|
170 |
|
mui.Set("feedimage", "Brush", 2) |
|
171 |
|
self.ImageLoaded = True |
|
172 |
|
EndFunction |
|
173 |
|
|
116 |
174 |
Function IvoR:OpenChannel() |
Function IvoR:OpenChannel() |
117 |
175 |
;č Vostuda, ale nemáme to nikde uloženo. Jen na formě =] |
;č Vostuda, ale nemáme to nikde uloženo. Jen na formě =] |
118 |
176 |
Local url$ = mui.Get("channel_link", "Contents") |
Local url$ = mui.Get("channel_link", "Contents") |
|
... |
... |
Function CharacterData(p, str$) |
190 |
248 |
Case "title": mui.Set("channel_title", "Contents", tf_Label(str$)) |
Case "title": mui.Set("channel_title", "Contents", tf_Label(str$)) |
191 |
249 |
Case "description": |
Case "description": |
192 |
250 |
mui.Set("channel_description", "Contents", tf_Label(str$)) |
mui.Set("channel_description", "Contents", tf_Label(str$)) |
193 |
|
Case "link": mui.Set("channel_link", "Contents", StripStr(str$)) |
|
|
251 |
|
Case "link": |
|
252 |
|
IvoR.link = str$ |
|
253 |
|
mui.Set("channel_link", "Contents", StripStr(str$)) |
|
254 |
|
|
|
255 |
|
;č url podle RSS specifikace musí být pouze u obrázků. |
|
256 |
|
Case "url": IvoR:DownloadImage(str$) |
|
257 |
|
|
|
258 |
|
|
194 |
259 |
EndSwitch |
EndSwitch |
195 |
260 |
|
|
196 |
261 |
Else |
Else |