Commits

shl...@cec68495-dca5-4e2b-845c-11fdaaa4f967  committed a4dcc0a

Added the music recommendations page - currently unlinked from the rest of
the site. Lots of changes to integrate XML::Grammar::ProductsSyndication
to generate its HTML.

  • Participants
  • Parent commits 358c13e

Comments (0)

Files changed (10)

 $(T2_SITEMAP_FILE): bin/gen-google-site-map.pl
 	$<
 
+PROD_SYND_MUSIC_DIR = lib/prod-synd/music
+PROD_SYND_MUSIC_INC = $(PROD_SYND_MUSIC_DIR)/include-me.html
+
+$(T2_SRC_DIR)/art/recommendations/music/index.html.wml : $(PROD_SYND_MUSIC_INC)
+	touch $@
+
+$(PROD_SYND_MUSIC_INC) : $(PROD_SYND_MUSIC_DIR)/gen-prod-synd.pl $(T2_SRC_DIR)/art/recommendations/music/shlomi-fish-music-recommendations.xml
+	perl $<
+
 %.show:
 	@echo "$* = $($*)"
 

File common/style.css.ttml

     padding: 0.2em 0.2em 1em 0.2em;
     border: #689 thin solid;
 }
+[% PROCESS "shlomif/products-syndication.ttml" %]

File lib/prod-synd/music/gen-prod-synd.pl

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use XML::Grammar::ProductsSyndication;
+
+use XML::LibXML::XPathContext;
+
+my $wml_dir = "t2/art/recommendations/music";
+my $lib_dir = "lib/prod-synd/music";
+my $ps = XML::Grammar::ProductsSyndication->new(
+    {
+        'source' =>
+        {
+            'file' => "$wml_dir/shlomi-fish-music-recommendations.xml",
+        }
+    },
+);
+
+my $xml = $ps->transform_into_html({ 'output' => "xml" });
+
+my $xc = XML::LibXML::XPathContext->new($xml);
+$xc->registerNs('html' => "http://www.w3.org/1999/xhtml");
+
+open my $out, ">", "$lib_dir/include-me.html";
+print {$out} $xc->findnodes('/html:html/html:body/html:div')->[0]->toString(0);
+close ($out);
+
+$ps->update_cover_images(
+    {
+        'size' => "l",
+        'resize_to' => { 'width' => 150, 'height' => 250 },
+        'name_cb' => 
+            sub 
+            {
+                my $args = shift;
+                return "$wml_dir/images/$args->{id}.jpg";
+            },
+        'amazon_token' => "0VRRHTFJECHSKYNYD282",
+        'amazon_associate' => "shlomifishhom-20",
+    }
+);
+
+1;
+

File t2/art/recommendations/index.html.wml

-#include '../template.wml'
-
-#include "amazon.wml"
-
-;;; To add:
-;;; Beatles - Red Album
-;;; Beatles - Blue Album
-;;; Yehuda Poliker - Live at Caesarea.
-;;; Shania Twain - Greatest Hits
-;;; Blues Brothers
-;;; The Best of Enya 
-;;; Ace of Base - First CD.
-;;; Boney M collection
-;;; Abba Gold
-;;; Michael Jackson - HIStory
-;;; Spice Girls - Disc 1
-;;; Dirty Dancing
-;;; Harvey Danger - Little by Little
-;;; Lebo M - Rhythm of the Pride Lands.
-;;; The Lion King
-;;; Offspring - Americana
-;;; Queen - Greatest Hits I and II
-;;; Innovators
-;;; Pink Floyd - Obscured by Clouds
-;;; Disney's Hercules
-;;; The Neverending Story
-;;; Arizona Dream
-;;; Rabin Memorial Disc
-;;; Hooked on Classics
-;;; Evanescence
-;;; Bugsy Malone
-;;; Aqua
-;;; Black Eyed Peas - Elephunk
-;;; U2 - 1980-1990, 1990-2000.
-;;; Vangelis
-;;;     - Themes I
-;;;     - Albedo
-;;;     - Spiral
-;;; SleepWalks
-;;; Explosive - the best of bond
-

File t2/art/recommendations/music/images/beatles_blue_album.jpg

Added
New image

File t2/art/recommendations/music/images/beatles_red_album.jpg

Added
New image

File t2/art/recommendations/music/images/blues_brothers_sountrack.jpg

Added
New image

File t2/art/recommendations/music/images/shania_twain.jpg

Added
New image

File t2/art/recommendations/music/index.html.wml

+#include '../template.wml'
+
+#include "amazon.wml"
+
+;;; To add:
+;;; + Beatles - Red Album
+;;; + Beatles - Blue Album
+;;; Yehuda Poliker - Live at Caesarea.
+;;; + Shania Twain - Greatest Hits
+;;; + Blues Brothers
+;;; The Best of Enya 
+;;; Ace of Base - First CD.
+;;; Boney M collection
+;;; Abba Gold
+;;; Michael Jackson - HIStory
+;;; Spice Girls - Disc 1
+;;; Dirty Dancing
+;;; Harvey Danger - Little by Little
+;;; Lebo M - Rhythm of the Pride Lands.
+;;; The Lion King
+;;; Offspring - Americana
+;;; Queen - Greatest Hits I and II
+;;; Innovators
+;;; Pink Floyd - Obscured by Clouds
+;;; Disney's Hercules
+;;; The Neverending Story
+;;; Arizona Dream
+;;; Rabin Memorial Disc
+;;; Hooked on Classics
+;;; Evanescence
+;;; Bugsy Malone
+;;; Aqua
+;;; Black Eyed Peas - Elephunk
+;;; U2 - 1980-1990, 1990-2000.
+;;; Vangelis
+;;;     - Themes I
+;;;     - Albedo
+;;;     - Spiral
+;;; SleepWalks
+;;; Explosive - the best of bond
+
+#include "prod-synd/music/include-me.html"
+

File t2/art/recommendations/music/shlomi-fish-music-recommendations.xml

+<?xml version='1.0' encoding='utf-8'?>
+<?xml-stylesheet type="text/xml" href="product-syndication.xsl"?>
+<!DOCTYPE comparison SYSTEM "product-syndication.dtd">
+<product-syndication>
+    <data>
+        <cat id="music">
+            <title>Music</title>
+            <desc>
+                <p>
+                    These are my favourite popular music CDs.
+                </p>
+            </desc>
+            <prod id="beatles_red_album">
+                <title>The Beatles - The Red Album - 1962 - 1966</title>
+                <isbn>B000002UYZ</isbn>
+                <desc>
+                    <p>
+                        A double album of the first years of my favourite 
+                        English-singing band. Some pretty nifty songs, with
+                        very revolutionary melodies and style.
+                    </p>
+                </desc>
+            </prod>
+            <prod id="beatles_blue_album">
+                <title>The Beatles - The Blue Album - 1962 - 1966</title>
+                <isbn>B000002UZ1</isbn>
+                <desc>
+                    <p>
+                        The later Beatles' years. Songs have become more
+                        expermintal, but also very good.
+                    </p>
+                </desc>
+            </prod>
+            <prod id="shania_twain">
+                <title>Greatest Hits</title>
+                <creator type="performer">Shania Twain</creator>
+                <isbn>B0002Z1EG2</isbn>
+                <desc>
+                    <p>
+                        I've been a fan of some of Shania Twain's MTv hits, and
+                        downloaded them from Peer-to-Peer networks. One day
+                        when I went to a local store looking for certain CDs, 
+                        I saw her "Greatest Hits" compilation. Since I was
+                        looking for other CDs, I did not buy it then, but
+                        rather went another day and bought Twain's CD.
+                    </p>
+                    <p>
+                        The CD did not disappoint me. With some great songs like
+                        "Up", "Come on over", "Man, I feel like a woman!", 
+                        "Any man of mine", "Party for Two", and my old
+                        favourites "That don't impress me much", "You're Still
+                        the One", and "I'm Gonna Getcha" - this CD is one of
+                        my favourites. Shania Twain sings her country, (perhaps
+                        pop country) songs in a fun way, and the arrangement is
+                        very nice.
+                    </p>
+                </desc>
+            </prod>
+            <prod id="blues_brothers_sountrack">
+                <title>The Blues Brothers: Original Soundtrack Recording</title>
+                <creator type="performer">The Blues Brothers</creator>
+                <isbn>B000002J5K</isbn>
+                <desc>
+                    <p>
+                        The soundtrack to the movie "The Blues Brothers"
+                        contains a wonderful collection of Blues and rock
+                        songs some of them are classics. 
+                    </p>
+                </desc>
+            </prod>
+        </cat>
+    </data>
+</product-syndication>