Difference between revisions of "Cchost/concepts/Sample Pools"

From Creative Commons
Jump to: navigation, search
(New page: =Overview= A ''sample pool'' is a site that exposes Creative Commons licensed media and optionally accepts 'trackback' style notifications of reuse. To be a sample pool the site exposes it...)
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:ccHost]]
 +
[[Category:ccMixter]]
 +
[[Category:Developer]]
 +
[[Category:Software]]
 +
[[Category:Technology]]
 +
{{cchost_head}}
 +
{{lowercase}}
 +
 
=Overview=
 
=Overview=
 
A ''sample pool'' is a site that exposes Creative Commons licensed media and optionally accepts 'trackback' style notifications of reuse. To be a sample pool the site exposes it's media with a RESTful API called the Sample Pool API. Every ccHost is potentially a sample pool with several admin options to control the interfacing with other sample pool enabled sites. The definition of the API can be found at every ccHost installation at '''<installation_root>/pool_api_doc''' for example at [http://ccmixter.org/pool_api_doc ccMixter].
 
A ''sample pool'' is a site that exposes Creative Commons licensed media and optionally accepts 'trackback' style notifications of reuse. To be a sample pool the site exposes it's media with a RESTful API called the Sample Pool API. Every ccHost is potentially a sample pool with several admin options to control the interfacing with other sample pool enabled sites. The definition of the API can be found at every ccHost installation at '''<installation_root>/pool_api_doc''' for example at [http://ccmixter.org/pool_api_doc ccMixter].
Line 15: Line 23:
 
   function add_license_ns()
 
   function add_license_ns()
 
   { echo
 
   { echo
     'xmlns:cc="http://backend.userland.com/creativeCommonsRssModule"' .
+
     'xmlns:cc="<nowiki>http://backend.userland.com/creativeCommonsRssModule</nowiki>"' .
 
     "\n\t" ; }
 
     "\n\t" ; }
 
+
 
   add_action('rss2_ns', 'add_license_ns');
 
   add_action('rss2_ns', 'add_license_ns');
 
+
 
   function add_license_item()
 
   function add_license_item()
 
   { if( !empty($_GET['pool']) )
 
   { if( !empty($_GET['pool']) )
 
     { echo "\t" .
 
     { echo "\t" .
       '<cc:license>http://creativecommons.org/licenses/by/3.0/</cc:license>' .
+
       '<nowiki><cc:license>http://creativecommons.org/licenses/by/3.0/</cc:license></nowiki>' .
 
       "\n"; } }
 
       "\n"; } }
 
+
 
   add_action('rss2_item', 'add_license_item');
 
   add_action('rss2_item', 'add_license_item');
  

Latest revision as of 08:59, 26 November 2008


Docs Home Install Upgrade Troubleshoot Customize Admins Devs Content Query Templates Commands Skins


Overview

A sample pool is a site that exposes Creative Commons licensed media and optionally accepts 'trackback' style notifications of reuse. To be a sample pool the site exposes it's media with a RESTful API called the Sample Pool API. Every ccHost is potentially a sample pool with several admin options to control the interfacing with other sample pool enabled sites. The definition of the API can be found at every ccHost installation at <installation_root>/pool_api_doc for example at ccMixter.

Converting Wordpress Blogs into Sample Pool

As it turns out 99% of the functionality needed to be a passive Sample Pool is already built into recent Wordpress installations so the tweaking needed is extremely minimal. Here are the steps:

1) If you have a plugin or some other mechanism that adds a <*.license tag to your feed entries, then skip to step (2). Otherwise, find the 'functions.php' file in your theme. That would be in a place like wp-content/themes/your_theme_name/functions.php

Put the following code into that file:

 //Add CC license to namespace, item, inline img link within description
 function add_license_ns()
  { echo
    'xmlns:cc="http://backend.userland.com/creativeCommonsRssModule"' .
    "\n\t" ; }

 add_action('rss2_ns', 'add_license_ns');

 function add_license_item()
 { if( !empty($_GET['pool']) )
    { echo "\t" .
      '<cc:license>http://creativecommons.org/licenses/by/3.0/</cc:license>' .
      "\n"; } }

 add_action('rss2_item', 'add_license_item');


The code above assumes a BY 3.0 license for your items. If you have a different default license then replace the license URL in the code above. If you have difference licenses for each item then I leave that as an exercise for the reader.

2) This hack assumes you have mod_rewrite enabled on your WP site. In the line directly after:

RewriteBase /

Put the following code:

 RewriteCond %{QUERY_STRING}  ^query=(.+)$
 RewriteRule ^pool/search$ tag/remixable/?feed=rss2&pool=1&s=%1 [L,R]
 RewriteRule ^pool(/info/?)?$   tag/_?feed=rss2&pool=1 [L,R]


(It's possible my mail client breaks the lines apart, there should be three lines that each start with "Rewrite...")

3) Tag all entries that you want in the Sample Pool as 'remixable'. If you use a different tag, replace the word 'remixable' in step (2) above with your tag. If you use a category, replace the word 'tag' with 'category'.

That's it!

These sites should work with either 4.x ccHost sites as well as 5.