-- function libraries, initialization dofile "compatibility.lua" dofile "init.lua" dofile "graphicsPrint.lua" dofile "CFGParser.lua" local connectionNum, feedList = parseCFG("rss.cfg") dofile "libwww.lua" dofile "DNSIPtools.lua" dofile "misc.lua" dofile "helpful.lua" dofile("parseXML.lua") Wlan.init() connections = Wlan.getConnectionConfigs() -- list available connections gPrint("available connections:\n") for key, value in connections do gPrint(key .. ": " .. value .. "\n") end gPrint("using connection "..connections[tonumber(connectionNum)].."\n") Wlan.useConnectionConfig(connectionNum) for key, feed in feedList do gPrint("Getting feed #"..key.." ("..feed.title..")...\n") downloadFile(feed.url, feed.title, feed.defaultFilename, true) ChannelInfo, ParsedFeed = parseCorrectType(parseXML("feeds/"..fixFileName(feed.title)..".xml")) writePlainText(feed.title, ParsedFeed) gPrint("Feed #"..key.." ("..feed.title..") written!\n") if ParsedFeed.nEnc > 0 then gPrint("This feed has "..ParsedFeed.nEnc.." enclosures. Download "..enclosuresToSave.."? (x = yes, o = no)\n") keys = Controls.read() while not keys:circle() and not keys:cross() do keys = Controls.read() screen.waitVblankStart() end if keys:cross() then gPrint("Downloading "..enclosuresToSave.." enclosures.\n") numSaved = 0 doneSaving = false for key, item in ParsedFeed.items do if item.enclosures then for num, enclosure in item.enclosures do if numSaved >= enclosuresToSave then doneSaving = true break end gPrint("Downloading "..item.title..".\n") downloadFile(enclosure, feed.title, "/psp/music/pspRSS/"..fixFileName(feed.title).."-"..numSaved..".mp3", false) numSaved = numSaved + 1 gPrint("\n") end end if doneSaving then break end end if doneSaving then break end end end end keys = Controls.read() if keys:cross() then gPrint("Enclosures saved to /PSP/MUSIC/pspRSS.\n") end gPrint("Feeds saved to Applications/pspRSS/feeds/.txt\nPress start to quit or select for a screenshot.\n") keys = Controls.read() while not keys:start() do keys = Controls.read() if keys:select() then screen:save("screenshot.jpg") end screen.waitVblankStart() end Wlan.term()