<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,7 @@ class HomeController &lt; ApplicationController
 
   def authenticate
     authenticate_or_request_with_http_basic(realm = 'Enter your BBC Redux login details') do |username,password| 
+      #return true if request.host =~ /\.local$/
       if Redux.valid_user?(username,password)
         true 
       else</diff>
      <filename>app/controllers/home_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,9 @@ class PodcastsController &lt; ApplicationController
   end
 
   def show
-    key = podcast_path(:guid =&gt; params[:guid])
-    pid = Obscurer.unobscure(params[:guid])
-    @brand = handle_fragment(key,pid)
+    key = podcast_path(:guid =&gt; params[:guid], :year =&gt; params[:year])
+    @brand = handle_fragment(key,params)
+    return custom_404 if @brand.blank? 
 
     respond_to do |format|
       format.xml
@@ -18,18 +18,20 @@ class PodcastsController &lt; ApplicationController
 
   def url
     return render(:status =&gt; 404, :template =&gt; 'podcasts/show') if params[:pid].blank?
-    @guid = Obscurer.obscure(params[:pid])
-    key = podcast_path(:guid =&gt; @guid)
-    @brand = handle_fragment(key,params[:pid])
+    key = podcast_path(:guid =&gt; Obscurer.obscure(params[:pid]), :year =&gt; params[:year])
+    @brand = handle_fragment(key,params)
   rescue URI::InvalidURIError, OpenURI::HTTPError, SocketError, Errno::ENETUNREACH
     custom_404
   end
 
   private
 
-  def handle_fragment(key,pid)
+  def handle_fragment(key,options=nil)
+    pid = options[:pid] if options.is_a?(Hash) &amp;&amp; options.has_key?(:pid)
+    pid = pid || Obscurer.unobscure(params[:guid]) if options.is_a?(Hash) &amp;&amp; options.has_key?(:guid)
+    return nil if pid.blank? 
     expire_fragment(key) unless 
-      brand = read_fragment(key, :expires_in =&gt; 6.hours) || write_fragment(key, Redux.data(pid))
+      brand = read_fragment(key, :expires_in =&gt; 6.hours) || write_fragment(key, Redux.data(pid,options))
     return brand
   end
 </diff>
      <filename>app/controllers/podcasts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,17 @@
 class Brand
-  attr_accessor :pid,:title, :subtitle, :episodes
+  attr_accessor :pid,:title, :subtitle, :episodes, :year
 
   def initialize
     @title = nil
     @subtitle = nil
     @pid = nil
+    @year = nil
     @episodes = []
   end
 
-  def self.fetch(pid)
-    year = Time.now.year
+  def self.fetch(pid,options=nil)
+    year = options[:year] if options.is_a?(Hash) &amp;&amp; options.has_key?(:year)
+    year = year || Time.now.year
     episodes = []
     url = &quot;http://www.bbc.co.uk/programmes/#{pid}/episodes/#{year}&quot;
     doc = Nokogiri::XML(open(url))
@@ -18,6 +20,7 @@ class Brand
     brand.title = doc.search(&quot;li[@class='tleo']/a&quot;).text
     brand.subtitle = doc.search(&quot;h1/span[@class='desc']&quot;).text.gsub(/&lt;\/?[^&gt;]*&gt;/, &quot;&quot;).strip
     brand.pid = pid 
+    brand.year = year 
 
     doc.search(&quot;dd/ol[@class='episodes']/li&quot;).each do |e| 
       episode = Episode.new
@@ -52,7 +55,7 @@ class Brand
     File.join('http://bbc.co.uk/programmes', self.pid)
   end
 
-  def rss_link 
-    File.join(self.pid, 'podcasts.xml')
+  def guid
+    Obscurer.obscure(self.pid) unless self.pid.blank?
   end
 end</diff>
      <filename>app/models/brand.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,8 +12,9 @@ class Redux
     !valid.nil?
   end
 
-  def self.data(pid)
-    return unless brand = Brand.fetch(pid)
+  def self.data(pid,options=nil)
+    pid = pid.strip
+    return unless brand = Brand.fetch(pid,options)
     episodes_to_use = []
 
     brand.episodes.each do |e|
@@ -21,7 +22,6 @@ class Redux
 
       url = File.join(e.redux_url)
       e.redux_link = url
-      puts e.redux_link + ' ' + e.pid
       res = Net::HTTP.post_form(URI.parse(url), CREDENTIALS)
       doc = Nokogiri::XML(res.body)
       results=[]</diff>
      <filename>app/models/redux.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,14 +4,14 @@
 &lt;p&gt;Some recent subscriptions:&lt;/p&gt;
 &lt;ul&gt;
 &lt;% recent_subscriptions.each do |f| %&gt;
-&lt;li&gt;&lt;%= link_to(f.title + image_tag('rss14.png', :class =&gt; 'rss'), podcast_url(:guid =&gt; to_guid(f.pid))) %&gt;&lt;/li&gt;
+&lt;li&gt;&lt;%= link_to(&quot;#{f.title} &lt;span&gt;#{f.year}&lt;/span&gt;&quot; + image_tag('rss14.png', :class =&gt; 'rss'), podcast_url(:guid =&gt; to_guid(f.pid), :year =&gt; f.year)) %&gt;&lt;/li&gt;
 &lt;% end %&gt;
 &lt;/ul&gt;
 &lt;% end %&gt;
 &lt;p&gt;You just need a brand pid. These can be found over at &lt;%= link_to('BBC Programmes', 'http://bbc.co.uk/programmes') %&gt;.&lt;/p&gt;
 &lt;% form_tag(obscure_path, :method =&gt; &quot;post&quot;) do %&gt;
   &lt;h2&gt;&lt;label for=&quot;pid&quot;&gt;Enter a brand pid, e.g &lt;code&gt;b006wkfp&lt;/code&gt;&lt;/label&gt;&lt;/h2&gt;
-  &lt;%= text_field_tag(:pid) %&gt;
-  &lt;%= submit_tag(&quot;fetch&quot;) %&gt;
+  &lt;p&gt;&lt;%= text_field_tag(:pid) %&gt;&lt;%= submit_tag(&quot;Make me a Feed&quot;, :id =&gt; 'submit') %&gt;&lt;/p&gt;
+  &lt;p&gt;&lt;%= select_year(Date.today, { :start_year =&gt; 2007, :end_year =&gt; 2009 }, { :id =&gt; &quot;year&quot;, :name =&gt; &quot;year&quot; }) %&gt;&lt;label for=&quot;year&quot;&gt;Optional, defaults to current year&lt;/em&gt;&lt;/label&gt;&lt;/p&gt;
 &lt;% end %&gt;
 &lt;p id=&quot;footer&quot;&gt;&lt;small&gt;Any bugs? &lt;strike&gt;keep them to y...&lt;/strike&gt; .. let me know at &lt;em&gt;duncan at whomwah dot com&lt;/em&gt;&lt;/p&gt;</diff>
      <filename>app/views/home/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 xml.instruct!
 xml.rss(:version =&gt; '2.0', 'xmlns:itunes' =&gt; 'http://www.itunes.com/dtds/podcast-1.0.dtd', 'xmlns:atom' =&gt; 'http://www.w3.org/2005/Atom') do
   xml.channel do
-    xml.tag!('atom:link', :href =&gt; podcast_url(:guid =&gt; to_guid(@brand.pid)), :rel =&gt; 'self', :type =&gt; 'application/rss+xml')
+    xml.tag!('atom:link', :href =&gt; podcast_url(:guid =&gt; to_guid(@brand.pid), :year =&gt; @brand.year), :rel =&gt; 'self', :type =&gt; 'application/rss+xml')
     xml.title CGI.unescapeHTML(@brand.title)
     xml.link @brand.programmes_link
     xml.language 'en-uk'</diff>
      <filename>app/views/podcasts/show.xml.builder</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,8 @@
 &lt;div id=&quot;url&quot;&gt;
 &lt;small&gt;&lt;%= render(:partial=&gt;'shared/home_link') -%&gt; : Podcast link for &lt;code&gt;&lt;%= link_to(@brand.pid,&quot;http://bbc.co.uk/programmes/#{@brand.pid}&quot;) %&gt;&lt;/code&gt;&lt;/small&gt;
-&lt;h1&gt;&lt;%= link_to(@brand.title + image_tag('rss.png', :class =&gt; 'rss'), podcast_url(:guid =&gt; @guid)) %&gt;&lt;/h1&gt;
+&lt;h1&gt;&lt;%= link_to(&quot;#{@brand.title} &lt;span&gt;#{@brand.year}&lt;/span&gt;&quot; + image_tag('rss.png', :class =&gt; 'rss'), podcast_url(:guid =&gt; @brand.guid, :year =&gt; @brand.year)) %&gt;&lt;/h1&gt;
 &lt;h2&gt;&lt;%= @brand.subtitle %&gt;&lt;/h2&gt;
 &lt;%= image_tag(@brand.image, :class =&gt; 'brand') %&gt;
-&lt;p&gt;Use the link below in your favourite podcast reader (it's up to you to keep this secret)&lt;/p&gt;
-&lt;%= text_field_tag( 'copy', podcast_url(:guid =&gt; @guid) ) %&gt;
+&lt;p&gt;Use the link below in your favourite podcast reader (&lt;strong&gt;NOTE:&lt;/strong&gt; It's up to you to keep this url private!)&lt;/p&gt;
+&lt;%= text_field_tag( 'copy', podcast_url(:guid =&gt; @brand.guid, :year =&gt; @brand.year) ) %&gt;
 &lt;/div&gt;</diff>
      <filename>app/views/podcasts/url.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -45,7 +45,7 @@ end
 require 'file_store_expires'
 
 CONFIG = YAML::load(File.read(File.expand_path('~')+'/configs/redux.yaml'))
-MAX_EPISODES = 20
+MAX_EPISODES = 30
 REDUX_URL = 'http://g.bbcredux.com'
 CREDENTIALS = {
   'username' =&gt; CONFIG[:login][:username], </diff>
      <filename>config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,9 +6,14 @@ ActionController::Routing::Routes.draw do |map|
   # Keep in mind you can assign values other than :controller and :action
 
   # Sample of named route:
-  map.obscure 'podcasts/url', :controller =&gt; 'podcasts', :action =&gt; 'url'
+  map.obscure 'podcasts/url', :controller =&gt; 'podcasts', :action =&gt; 'url',
+              :method =&gt; :post
   map.connect 'podcasts/:guid', :controller =&gt; 'podcasts', :action =&gt; 'index'
-  map.podcast 'podcasts/:guid.xml', :controller =&gt; 'podcasts', :action =&gt; 'show'
+  map.connect 'podcasts/:guid.:format', :controller =&gt; 'podcasts', :action =&gt; 'index'
+  map.podcast 'podcasts/:year/:guid.xml', :controller =&gt; 'podcasts', :action =&gt; 'show',
+              :year =&gt; Time.now.year,
+              :requirements =&gt; { :year =&gt; /\d{4}/ }
+
   #map.purchase 'products/:id/purchase', :controller =&gt; 'catalog', :action =&gt; 'purchase'
   # This route can be invoked with purchase_url(:id =&gt; product.id)
 
@@ -41,6 +46,6 @@ ActionController::Routing::Routes.draw do |map|
   # Install the default routes as the lowest priority.
   # Note: These default routes make all actions in every controller accessible via GET requests. You should
   # consider removing the them or commenting them out if you're using named routes and resources.
-  map.connect ':controller/:action/:id'
-  map.connect ':controller/:action/:id.:format'
+  #map.connect ':controller/:action/:id'
+  #map.connect ':controller/:action/:id.:format'
 end</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,11 +3,11 @@ require &quot;base64&quot;
 module Obscurer
 
   def self.obscure(str)
-    Base64.encode64([str,SALT].join('+')).strip.gsub(/=/,'')
+    Base64.encode64([str.strip,SALT].join('+')).strip.gsub(/=/,'')
   end
 
   def self.unobscure(str)
-    Base64.decode64(str).split('+').first 
+    Base64.decode64(str.strip).split('+').first 
   end
 
 end</diff>
      <filename>lib/obscurer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,6 +19,10 @@ h1 {
   line-height:0.2em;
 }
 
+h1 span, li span {
+  font-size: 0.8em;
+}
+
 h2 {
   font-size: 1em;
   margin:0 0 0.3em 0;  
@@ -31,9 +35,19 @@ p,ul,pre {
   margin-bottom:0.8em;  
 }
 
-label, input {
+input, select {
+  font-size: 1em;
+  padding:0.1em;
+  margin-right:0.3em;
+}
+
+label {
   font-size: 2em;
-  padding:0.2em;
+}
+
+form p label {
+  color:#666;
+  font-size: 0.7em;
 }
 
 input#pid {</diff>
      <filename>public/stylesheets/all.css</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5ad48c431e8ac54b7a70e812d3b41be271ec9ff0</id>
    </parent>
  </parents>
  <author>
    <name>Duncan Robertson</name>
    <email>duncan@whomwah.com</email>
  </author>
  <url>http://github.com/whomwah/redux-podcaster/commit/f6d995babab9502bdec08d08ee1d775f842d40a9</url>
  <id>f6d995babab9502bdec08d08ee1d775f842d40a9</id>
  <committed-date>2009-04-06T05:33:22-07:00</committed-date>
  <authored-date>2009-04-06T05:33:22-07:00</authored-date>
  <message>simple year support still need to work out how to handle all episodes for a year</message>
  <tree>7041c50ff970690b2e6f4303701d2a313b3651e1</tree>
  <committer>
    <name>Duncan Robertson</name>
    <email>duncan@whomwah.com</email>
  </committer>
</commit>
