counter

20090528

Hi I am chromium bot. I would tweet when new chromium build available. (powered by AppJet)

I just create twitter bot. It's easy & simple. Hosted on AppJet.
/* appjet:version 0.1 */
import("storage", "cron", "dlog");
// latest build no store
if (!storage.latest) {
storage.latest = 0;
}
const BASE_URL = "http://build.chromium.org/buildbot/snapshots/sub-rel-mac/";
var latestBuildNo = wget(BASE_URL + "LATEST");
var latestURL = BASE_URL + latestBuildNo;
function get_main() {
dlog.info("Call form http");
print(H1("Chromium official build watcher"));
print(DIV({style: "font-size: 400%"},
"Latest build is ... ",
A({href: latestURL}, latestBuildNo)
));
}
function get_admin() {
if (!appjet.isPreview) {
response.redirect("/");
return;
}
print("welcom admin!");
}
function cron_tweet() {
dlog.info("Call from Cron");
dlog.info("Latest(storage):" + storage.latest);
dlog.info("Latest(site) :" + latestBuildNo);
if (storage.latest < latestBuildNo) {
storage.latest = latestBuildNo;
var res = wpost(
"http://twitter.com/statuses/update.json", {
status: "Chromium latest build " + latestBuildNo +
" available now." + latestURL
}, {
headers: {Authorization: "Basic " + storage.auth},
complete: true
}
);
}
}
//storage.cron = scheduleRepeating(new Date("May 19, 2009"), 15, "/tweet", {}, true);
//unschedule(storage.cron);
//unscheduleAll();
//print(listAll());
//print(new Date);
//print((new Date) + 1000);
dispatch();
view raw chromiumBot.js hosted with ❤ by GitHub

No comments:

Followers

About Me

Tokyo, Japan
http://iddy.jp/profile/snaka/