Permalink
Browse files

- Fix iso character encoding.

- Add program rating.
- Add head image in programs table.
  • Loading branch information...
1 parent b20c62f commit bab619626d8af92b79e6f39c12439b887541226b @frichez frichez committed Aug 21, 2010
Showing with 20 additions and 14 deletions.
  1. +1 −1 cinetelerevue/channels.xml
  2. +6 −1 cinetelerevue/details.xml
  3. +13 −12 cinetelerevue/programs.xml
@@ -26,7 +26,7 @@
while (arrMatch = rePattern.exec(data.toString())) {
var channel = <channel/>;
channel.node += <id>{arrMatch[2]}</id>;
- channel.node += <name>{arrMatch[1]}</name>;
+ channel.node += <name>{arrMatch[1].replace(/\ufffd/g,"é")}</name>;
channel.node += <icon>{request.url}/images_chaines/transparent/32x32/{arrMatch[2]}.gif</icon>;
channels.node += channel;
}
@@ -24,6 +24,10 @@
return str.slice(0, i + 1);
}
+ function multiply (str, num) {
+ return num ? Array(num + 1).join(str) : "";
+ }
+
var details = <details/>;
details.node += <id>{id}</id>;
details.node += <link>{request.url}/php/fiche/detail.php?f_id_diffusion={id}</link>;
@@ -110,7 +114,8 @@
}
}
if (star > 0) {
- details.node += <star>{star}</star>;
+ details.node += <advise>{star}</advise>;
+ details.node += <star>{multiply("*",star)}</star>;
}
var detail_prog = xdata.div.(@["class"] == "zone_detail_prog").div.(@["class"] == "detail_prog").children().text().toString();
@@ -33,33 +33,31 @@
if (data == null) {
- y.log("no response from cinetelerevue1");
+ y.log("no response from cinetelerevue");
exit(0);
}
- var headDiffusionId;
+ var programs = <programs></programs>;
+
+ var headDiffusionId = 0;
+ var headImage;
var xdata = y.xpath(data, "//div[@class='infos']/a/@href");
- if (xdata.text()) {
+ if (xdata) {
headDiffusionId = xdata.text().toString().match(/(\d+)/);
if (headDiffusionId) {
headDiffusionId=headDiffusionId[1];
}
+ xdata = y.xpath(data, "//div[@class='grillePtImage']/img/@src");
+ if (xdata && !xdata.text().toString().equals("")) {
+ headImage = xdata.text();
+ }
}
- else {
- y.log("no response from cinetelerevue2");
- exit(0);
- }
var channel = y.xpath(data, "//div[@class='left']/p").text();
xdata = y.xpath(data, "//div[@class='grilleProg']");
-
- var programs = <programs></programs>;
-
for each (var h in xdata) {
- //programs.appendChild(h.toString());
-
var program = <program/>;
program.node += <channel>{channel}</channel>
@@ -75,6 +73,9 @@
diffusionId = diffusionId[1];
if (diffusionId == headDiffusionId) {
program.node += <head>true</head>
+ if (headImage) {
+ program.node += <image>{request.url}{headImage}</image>
+ }
}
program.node += <id>{diffusionId}</id>
program.node += <link>{request.url}/php/fiche/detail.php?f_id_diffusion={diffusionId}</link>;

0 comments on commit bab6196

Please sign in to comment.