Check-in [d16f5b9864]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Introduce `launchpad-releases` page. Updated polling with less delay. (So far only 30% of projects information received, less than 12% of release infos.) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d16f5b9864e7f4dc525149158efaf577 |
User & Date: | mario 2015-01-18 22:31:51 |
Context
2015-01-18
| ||
22:43 | Launchpad-releases for frontpage sidebar. check-in: 6df868d8f9 user: mario tags: trunk | |
22:31 | Introduce `launchpad-releases` page. Updated polling with less delay. (So far only 30% of projects information received, less than 12% of release infos.) check-in: d16f5b9864 user: mario tags: trunk | |
22:28 | Make freecode/freshmeat.club just aliases of main freshcode.club domain. check-in: 28d1e9f14c user: mario tags: trunk | |
Changes
Changes to cron.daily/poll_launchpad.php.
1 2 3 4 5 6 7 8 9 | <?php /** * title: Launchpad projects/series/releases polling * description: Poll Launchpad devel API for project names, then releases and series * version: 0.2 * category: rpc * api: cli * depends: config.local * type: cron | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php /** * title: Launchpad projects/series/releases polling * description: Poll Launchpad devel API for project names, then releases and series * version: 0.2 * category: rpc * api: cli * depends: config.local * type: cron * x-cron: *\/3 9 * * * * doc: https://launchpad.net/+apidoc/devel.html#projects * * * Retrieves project summaries from launchpad. In steps of 100. * Continously queries and updates release/series lists. Delays of 20 secs each. * Script is run in 3-minute intervals. * Project list should be complete in 10 days. |
︙ | ︙ | |||
164 165 166 167 168 169 170 | $projects = lp::projects($start); array_map("lp::insert_proj", $projects); } #-- now step-through poll for releases | | | > > > | > > > > < | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | $projects = lp::projects($start); array_map("lp::insert_proj", $projects); } #-- now step-through poll for releases $names = db("SELECT name FROM projects ORDER BY RANDOM() LIMIT 55")->fetchAll(); $t_outdated = time() - 21*24*3600; print_r($names); foreach ($names as $row) { $name = $row["name"]; // check if it exists, or entries too old if ($t_outdated > db("SELECT t FROM releases WHERE name=? ORDER BY t DESC", $name)->t) { // collect if (count($entries = lp::proj_releases($name))) { $entries = array_slice($entries, -3); } else { // stub entry to keep name+timestamp $entries = [["name"=>$name]]; } // clean up old entries db("DELETE FROM releases WHERE name=?", $name); // and insert foreach ($entries as $ver) { $ver["name"] = $name; lp::insert_release($ver); print_r($ver); } } // delay sleep(9); } // API queries |
︙ | ︙ |
Changes to index.php.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | case "feed": case "links": case "tags": case "search": case "rc": case "drchangelog": case "githubreleases": case "login": case "redir": include("page_$page.php"); break; case "forum": case "meta": | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | case "feed": case "links": case "tags": case "search": case "rc": case "drchangelog": case "githubreleases": case "launchpadreleases": case "login": case "redir": include("page_$page.php"); break; case "forum": case "meta": |
︙ | ︙ |
Added page_launchpadreleases.php.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | <?php /** * api: freshcode * title: launchpad-releases * description: dump releases feed * version: 0.1 * * Launchpad is polled by a cron script. * This page just displays the latest project releases. * */ #-- switch database db(new PDO("sqlite:launchpad.db")); include("template/header.php"); ?> <section id=main style="width:70%"> <h2><img src="https://help.launchpad.net/moin_static192/lp20/img/logo.png" width=28 height=31> Launchpad Releases</h2> <article class=launchpad-releases> <style> /** table **/ .launchpad-releases { width: 100%; } #launchpadreleases { table-layout: fixed; width: 100%; } tr.release { padding: 4pt 1pt; font-size: 95%; box-shadow: none; } /** long fields **/ td.lp-release-notes, td.proj-desc { color: #444; font-size: 75%; } tr.release td .max-height { max-height: 90pt; overflow: hidden; text-overflow: ellipsis; } /** title + version **/ .proj-title a { font-size: 105%; } .prog-lang { font-size: 60%; padding: 0.5pt 1pt; border: dotted 1px #eef; background: #f1f3ff; color: #aae; } td.proj-version { color: #977; } td.proj-version .version { font-size: 120%; font-weight: 600; } /** urls **/ td.proj-urls { font-size: 70%; color: #555; } td.proj-urls a { font-size: 95%; font-weight: normal; } </style> <table id=launchpadreleases> <colgroup> <col width="15%"> <col width="15%"> <col width="30%"> <col width="20%"> <col width="20%"> </colgroup> <?php // query latest $q = db(" SELECT r.name, r.title, r.version, r.release_notes, SUBSTR(r.date_created, 1, 10) AS date_created, r.web_link, p.web_link AS launchpad_url, p.programming_language, p.homepage_url, p.display_name, p.summary, p.title AS proj_title, p.description, p.screenshots_url FROM releases AS r LEFT JOIN projects AS p ON p.name = r.name ORDER BY date_created DESC LIMIT 100 "); // print in table foreach ($q as $row) { $row = array_map("input::html", $row); print <<<HTML <tr class=release> <td class=proj-title title="$row[summary]"> <a href="$row[launchpad_url]"> $row[proj_title] </a><br> <span class=prog-lang> $row[programming_language] </span> </td> <td class=proj-version> <a href="$row[web_link]"> →<em class=version> $row[version] </em> </a> <div class=release-date>$row[date_created]</div> </td> <td class=lp-release-notes> <div class=max-height> $row[release_notes] </div> </td> <td class=proj-urls> Url <a href="$row[homepage_url]"><b> $row[homepage_url] </b></a><br> LP <a href="$row[launchpad_url]"> $row[launchpad_url] </a><br> Img <a href="$row[screenshots_url]"> $row[screenshots_url] </a><br> </td> <td class=proj-desc> <div class=max-height> $row[description] </div> </td> </tr> HTML; } ?> </table> </article> <p style="break: both; clear: all; background: #f3f5f7; padding: 20pt;"> Polled via <a href="https://launchpad.net/+apidoc/">Launchpad API</a>. </p> <?php include("template/bottom.php"); |