refinerycms-podcast 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ class Admin::PodcastsController < Admin::BaseController
2
+
3
+ crudify :podcast, :title_attribute => :title, :order => "published DESC"
4
+
5
+ end
@@ -0,0 +1,12 @@
1
+ class PodcastsController < ApplicationController
2
+
3
+ def index
4
+ respond_to do |format|
5
+ format.rss do
6
+ @items = Podcast.all
7
+ render :layout => false
8
+ end
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,24 @@
1
+ class Podcast < ActiveRecord::Base
2
+
3
+ acts_as_indexed :fields => [:title, :author, :subtitle, :duration, :keywords, :summary]
4
+
5
+ validates_presence_of :title
6
+ validates_uniqueness_of :title
7
+ # validations to be added yet
8
+
9
+ belongs_to :file, :class_name => 'Resource'
10
+
11
+ default_scope :order => "published DESC"
12
+
13
+ def episode_number
14
+ episode = 0
15
+
16
+ Podcast.find(:all, :order => "published ASC").each do |p|
17
+ episode += 1
18
+ break if p === self
19
+ end
20
+
21
+ episode
22
+ end
23
+
24
+ end
@@ -0,0 +1,59 @@
1
+ <% form_for [:admin, @podcast] do |f| -%>
2
+ <%= f.error_messages %>
3
+
4
+ <div class='field'>
5
+ <%= f.label :title -%>
6
+ <%= f.text_field :title, :class => 'larger widest' -%>
7
+ </div>
8
+
9
+ <div class='field'>
10
+ <%= f.label :subtitle -%>
11
+ <%= f.text_field :subtitle, :size => 100 -%>
12
+ </div>
13
+
14
+ <div class='field'>
15
+ <span class='label_with_help'>
16
+ <%= f.label :file, 'Podcast file' -%>
17
+ <%= refinery_help_tag "Supported file formats include .m4a, .mp3, .mov, .mp4, .m4v, and .pdf" %>
18
+ </span>
19
+ <%= render :partial => "/shared/admin/resource_picker", :locals => {
20
+ :f => f,
21
+ :field => :file_id,
22
+ :resource => @podcast.file,
23
+ :description => "podcast"
24
+ } %>
25
+ </div>
26
+
27
+ <div class='field'>
28
+ <%= f.label :published -%>
29
+ <%= f.date_select :published -%>
30
+ </div>
31
+
32
+ <div class='field'>
33
+ <%= f.label :author -%>
34
+ <%= f.text_field :author -%>
35
+ </div>
36
+
37
+ <div class='field'>
38
+ <span class='label_with_help'>
39
+ <%= f.label :duration -%>
40
+ <%= refinery_help_tag "In HH:MM:SS format. E.g. \"10:22\" for 10 minutes 22 seconds" %>
41
+ </span>
42
+ <%= f.text_field :duration, :size => 6 -%>
43
+ </div>
44
+
45
+ <div class='field'>
46
+ <span class='label_with_help'>
47
+ <%= f.label :keywords -%>
48
+ <%= refinery_help_tag "Up to 12 keywords separated by commas. <br/><br/>E.g. rails, ruby on rails, refinerycms, refinery. <br/><br/>According to iTunes, the best use for keywords is to include common misspellings of your name or title, to ensure your podcast is still searchable despite a misspelling. To prevent keyword abuse, iTunes indexes only the first 12 keywords found in this tag." %>
49
+ </span>
50
+ <%= f.text_field :keywords, :size => 100 -%><br/>
51
+ </div>
52
+
53
+ <div class='field'>
54
+ <%= f.label :summary -%>
55
+ <%= f.text_area :summary, :rows => 5, :class => 'widest' -%>
56
+ </div>
57
+
58
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
59
+ <% end -%>
@@ -0,0 +1,16 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(podcast) -%>">
2
+ <span class='title'>
3
+ #<%= podcast.episode_number %> <%=h podcast.title %>
4
+ <span class="preview">- <%=h truncate(podcast.subtitle, :length => 50) %></span>
5
+ </span>
6
+ <span class='actions'>
7
+ <%# link_to refinery_icon_tag("page_white_put.png"), podcast.file.public_filename,
8
+ :title => 'Download File',
9
+ :target => "_blank" %>
10
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_podcast_path(podcast),
11
+ :title => t('.edit') %>
12
+ <%= link_to refinery_icon_tag("delete.png"), admin_podcast_path(podcast),
13
+ :class => "cancel confirm-delete",
14
+ :title => t('.delete') %>
15
+ </span>
16
+ </li>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,34 @@
1
+ <div id='actions'>
2
+ <ul>
3
+ <li>
4
+ <%= render :partial => "/shared/admin/search", :locals => {:url => admin_podcasts_url} %>
5
+ </li>
6
+ <li>
7
+ <%= link_to "Create New Podcast", new_admin_podcast_url, :class => "add_icon" %>
8
+ </li>
9
+ </ul>
10
+ </div>
11
+ <div id='records'>
12
+ <% if searching? %>
13
+ <h2><%= t('admin.search_results_for', :query => params[:search]) %></h2>
14
+ <% if @podcasts.any? %>
15
+ <%= render :partial => "podcast", :collection => @podcasts %>
16
+ <% else %>
17
+ <p><%= t('admin.search_no_results') %></p>
18
+ <% end %>
19
+ <% else %>
20
+ <% if @podcasts.any? %>
21
+ <%= will_paginate @podcasts, :previous_label => '&laquo;', :next_label => '&raquo;' %>
22
+ <ul id='sortable_list'>
23
+ <%= render :partial => "podcast", :collection => @podcasts %>
24
+ </ul>
25
+ <%= will_paginate @podcasts, :previous_label => '&laquo;', :next_label => '&raquo;' %>
26
+ <% else %>
27
+ <p>
28
+ <strong>
29
+ <%= t('.no_items_yet') %>
30
+ </strong>
31
+ </p>
32
+ <% end %>
33
+ <% end %>
34
+ </div>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,56 @@
1
+ xml.instruct!
2
+
3
+ xml.rss 'xmlns:itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd', :version => "2.0"
4
+ xml.channel do
5
+ # NOTE: Fill in everything with your own data down to the categories.
6
+ xml.title 'Your Podcast Title'
7
+ xml.link 'http://yoursite.com/'
8
+
9
+ # Accepted values are those in the ISO 639-1 Alpha-2 list (two-letter language codes, some with possible modifiers, such as "en-us").
10
+ xml.language 'en-us'
11
+
12
+ xml.copyright "&#x2117; &amp; &#xA9; #{Time.now.year} Jack &amp; Jill"
13
+ xml.tag!('itunes:subtitle', 'A show about everything')
14
+
15
+ # The content of this tag is shown in the Artist column in iTunes.
16
+ xml.tag!('itunes:author', 'John Doe')
17
+
18
+ # The contents of this tag are shown in a separate window that appears when the
19
+ # "circled i" in the Description column is clicked. It also appears on the iTunes
20
+ # page for your podcast. This field can be up to 4000 characters.
21
+ description = "All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our Podcast in the iTunes Store"
22
+
23
+ xml.tag!('itunes:summary', description)
24
+ xml.description description
25
+
26
+ # This tag contains information that will be used to contact the owner of the podcast
27
+ # for communication specifically about their podcast. It will not be publicly displayed.
28
+ xml.tag!('itunes:owner') do |owner|
29
+ xml.tag!('itunes:name', 'John Doe')
30
+ xml.tag!('itunes:email', 'john.doe@example.com')
31
+ end
32
+
33
+ # upload an image to your resources tab and link it in here
34
+ # iTunes prefers square .jpg images that are at least 600 x 600 pixels
35
+ xml.tag!('itunes:image', 'http://mysite.com/system/0000/1000x1000.jpg')
36
+
37
+ # select from the list of categories here:
38
+ # http://www.apple.com/itunes/podcasts/specs.html#categories
39
+ xml.tag!('itunes:category', :text => "Technology") do |category|
40
+ xml.tag!('itunes:category', :text => "Software How-To")
41
+ end
42
+
43
+ @items.each do |item|
44
+ xml.item do
45
+ xml.title item.title
46
+ xml.tag!('itunes:author', item.author)
47
+ xml.subtitle item.subtitle
48
+ xml.summary item.summary
49
+ xml.enclosure :url => item.file.public_filename, :length => item.file.size, :length => item.file.content_type
50
+ xml.tag!('pubDate', item.published.strftime("%a, %d %b %Y %H:%M:%S %Z"))
51
+ xml.tag!('itunes:duration', item.duration)
52
+ xml.tag!('itunes:keywords', item.keywords)
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,16 @@
1
+ en:
2
+ admin:
3
+ podcasts:
4
+ index:
5
+ create_new: Create a new Podcast
6
+ reorder: Reorder Podcasts
7
+ reorder_done: Done Reordering Podcasts
8
+ sorry_no_results: Sorry! There are no results found.
9
+ no_items_yet: There are no podcasts yet. Click "Create a new Podcast" to add your first podcast.
10
+ podcast:
11
+ view_live: View this podcast live <br/><em>(opens in a new window)</em>
12
+ edit: Edit this podcast
13
+ delete: Remove this podcast forever
14
+ podcasts:
15
+ show:
16
+ other: Other Podcasts
@@ -0,0 +1,16 @@
1
+ nl:
2
+ admin:
3
+ podcasts:
4
+ index:
5
+ create_new: Maak een nieuwe Podcast
6
+ reorder: Wijzig de volgorde van de Podcasts
7
+ reorder_done: Klaar met het wijzingen van de volgorde van de Podcasts
8
+ sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
9
+ no_items_yet: Er zijn nog geen podcasts. Druk op 'Maak een nieuwe Podcast' om de eerste aan te maken.
10
+ podcast:
11
+ view_live: Bekijk deze podcast op de website <br/><em>(opent een nieuw venster)</em>
12
+ edit: Bewerk deze podcast
13
+ delete: Verwijder deze podcast voor eeuwig
14
+ podcasts:
15
+ show:
16
+ other: Andere Podcasts
@@ -0,0 +1,10 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.resources :podcasts
3
+
4
+ map.namespace(:admin, :path_prefix => 'refinery') do |admin|
5
+ admin.resources :podcasts, :collection => {:update_positions => :post, :settings => :get}
6
+ end
7
+
8
+ map.podcast '/podcast.rss', :controller => "podcasts", :action => "index", :format => "rss"
9
+
10
+ end
@@ -0,0 +1,23 @@
1
+ class PodcastGenerator < Rails::Generator::NamedBase
2
+
3
+ def initialize(*runtime_args)
4
+ # set first argument to the table's name so that the user doesn't have to pass it in.
5
+ runtime_args[0] = ["podcasts"]
6
+ super(*runtime_args)
7
+ end
8
+
9
+ def banner
10
+ "Usage: script/generate podcast"
11
+ end
12
+
13
+ def manifest
14
+ record do |m|
15
+ m.migration_template 'migration.rb', 'db/migrate',
16
+ :migration_file_name => "create_structure_for_podcast",
17
+ :assigns => {
18
+ :migration_name => "CreateStructureForPodcast"
19
+ }
20
+ end
21
+ end
22
+
23
+ end if defined?(Rails::Generator::NamedBase)
@@ -0,0 +1,32 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :podcasts do |t|
5
+ t.string :title
6
+ t.string :author
7
+ t.string :subtitle
8
+ t.integer :file_id
9
+ t.date :published
10
+ t.string :duration
11
+ t.string :keywords
12
+ t.text :summary
13
+ t.integer :position
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ add_index :podcasts, :id
19
+
20
+ User.find(:all).each do |user|
21
+ user.plugins.create(:name => "Podcast",
22
+ :position => (user.plugins.maximum(:position) || -1) +1)
23
+ end
24
+ end
25
+
26
+ def self.down
27
+ UserPlugin.destroy_all({:title => "Podcast"})
28
+
29
+ drop_table :podcasts
30
+ end
31
+
32
+ end
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../refinery/podcast.rb', __FILE__)
3
+ version = Refinery::Podcast.version
4
+ raise "Could not get version so gemspec can not be built" if version.nil?
5
+ files = Dir.glob("**/*").flatten.reject do |file|
6
+ file =~ /\.gem(spec)?$/
7
+ end
8
+
9
+ gemspec = <<EOF
10
+ Gem::Specification.new do |s|
11
+ s.name = %q{refinerycms-podcast}
12
+ s.version = %q{#{version}}
13
+ s.description = %q{Plugin for Refinery CMS to manage and publish podcasts to iTunes}
14
+ s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
15
+ s.summary = %q{Ruby on Rails podcast plugin for RefineryCMS.}
16
+ s.email = %q{info@refinerycms.com}
17
+ s.homepage = %q{http://refinerycms.com}
18
+ s.authors = %w(David\\ Jones)
19
+ s.require_paths = %w(lib)
20
+
21
+ s.files = [
22
+ '#{files.join("',\n '")}'
23
+ ]
24
+ #{"s.test_files = [
25
+ '#{Dir.glob("test/**/*.rb").join("',\n '")}'
26
+ ]" if File.directory?("test")}
27
+ end
28
+ EOF
29
+
30
+ File.open(File.expand_path("../../refinerycms-podcast.gemspec", __FILE__), 'w').puts(gemspec)
@@ -0,0 +1,15 @@
1
+ module Refinery
2
+ module Podcast
3
+
4
+ def self.version
5
+ ::Refinery::Podcast::Version.to_s
6
+ end
7
+
8
+ class Version
9
+ def self.to_s
10
+ %q{0.5}
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,35 @@
1
+ namespace :refinery do
2
+ namespace :podcast do
3
+ desc "Install extra files from the podcast plugin"
4
+
5
+ task :install do
6
+ [%w(db migrate), %w(app views podcasts)].each do |dir|
7
+ Rails.root.join(dir.join(File::SEPARATOR)).mkpath
8
+ end
9
+
10
+ podcast_root = Pathname.new(File.expand_path("../../../", __FILE__))
11
+ copies = [
12
+ {:from => %w(app views podcasts), :to => %w(app views podcasts), :filename => "index.rss.builder"},
13
+ ]
14
+ puts "\nCopying files...\n\n"
15
+ copies.each do |copy|
16
+ copy_from = podcast_root.join(copy[:from].join(File::SEPARATOR), copy[:filename])
17
+ copy_to = Rails.root.join(copy[:to].join(File::SEPARATOR), copy[:filename])
18
+ unless copy_to.exist? and ENV["force"].presence.to_s != "true"
19
+ FileUtils::cp copy_from.to_s, copy_to.to_s
20
+ puts "Copied to #{copy_to}"
21
+ else
22
+ puts "'#{File.join copy[:to], copy[:filename]}' already existed in your application so your existing file was not overwritten - use force=true to overwrite."
23
+ puts "Without this file being up to date, the podcast may not function properly."
24
+ end
25
+ end
26
+
27
+ puts "\nCopied all files."
28
+ puts "\nGenerating migration..."
29
+ puts `ruby #{Rails.root.join('script', 'generate').cleanpath.to_s.gsub(/\/$/, '')} podcast`
30
+ puts "\nNow, run these tasks:"
31
+ puts " rake db:migrate"
32
+ puts "\nWe hope you enjoy using our podcast plugin!\n\n"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2005-2010 [Resolve Digital Ltd.](http://www.resolvedigital.co.nz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ Refinery::Plugin.register do |plugin|
2
+ plugin.title = "Podcasts"
3
+ plugin.name = "podcasts"
4
+ plugin.description = "Manage Podcasts"
5
+ plugin.version = 1.0
6
+ plugin.url = {:controller => "/admin/podcasts", :action => "index"}
7
+ plugin.activity = {
8
+ :class => Podcast,
9
+ :url_prefix => "edit",
10
+ :title => 'title'
11
+ }
12
+ # this tells refinery where this plugin is located on the filesystem and helps with urls.
13
+ plugin.directory = directory
14
+ end
@@ -0,0 +1,48 @@
1
+ # Podcast plugin for [RefineryCMS](http://www.refinerycms.com) ([Github](http://github.com/djones/refinerycms-podcast))
2
+
3
+ By: [David Jones](http://www.d-jones.com) from [Resolve Digital](http://www.resolvedigital.com)
4
+
5
+ ## Requirements
6
+
7
+ Refinery CMS >= 0.9.7.7
8
+
9
+ ## Installation Using Gem
10
+
11
+ Open your ``Gemfile`` and add this line to the bottom:
12
+
13
+ gem 'refinerycms-podcast', '= 0.5'
14
+
15
+ Now run ``bundle install`` and once bundler has installed the gem run:
16
+
17
+ rake refinery:podcast:install
18
+
19
+ ..and follow the instructions!
20
+
21
+ ## Installation using Plugin
22
+
23
+ From within your Refinery directory at command line, install this as a plugin using:
24
+
25
+ script/plugin install git://github.com/djones/refinerycms-podcast.git
26
+
27
+ Then run:
28
+
29
+ rake refinery:podcast:install
30
+
31
+ ## Setup
32
+
33
+ Edit ``/app/views/podcasts/index.rss.builder`` and fill out the documented parts with your podcast
34
+ channel information.
35
+
36
+ ## Usage
37
+
38
+ Now on the backend of Refinery you should see a new "Podcast" tab. You can add your podcasts one by one there as you wish to publish them.
39
+
40
+ ## iTunes Setup
41
+
42
+ Your iTunes Podcast URL should now be available at:
43
+
44
+ http://yoursite.com/podcast.rss
45
+
46
+ Now you need to tell iTunes about your podcast URL. Read: [How to publish a podcast on the iTunes Store](http://support.apple.com/kb/TA23478)
47
+
48
+ For more detailed technical information about making iTunes podcasts read: [Making a Podcast](http://www.apple.com/itunes/podcasts/specs.html)
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refinerycms-podcast
3
+ version: !ruby/object:Gem::Version
4
+ hash: 1
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ version: "0.5"
10
+ platform: ruby
11
+ authors:
12
+ - David Jones
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-20 00:00:00 +12:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Plugin for Refinery CMS to manage and publish podcasts to iTunes
22
+ email: info@refinerycms.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - app/controllers/admin/podcasts_controller.rb
31
+ - app/controllers/podcasts_controller.rb
32
+ - app/models/podcast.rb
33
+ - app/views/admin/podcasts/_form.html.erb
34
+ - app/views/admin/podcasts/_podcast.html.erb
35
+ - app/views/admin/podcasts/edit.html.erb
36
+ - app/views/admin/podcasts/index.html.erb
37
+ - app/views/admin/podcasts/new.html.erb
38
+ - app/views/podcasts/index.rss.builder
39
+ - config/locales/en.yml
40
+ - config/locales/nl.yml
41
+ - config/routes.rb
42
+ - generators/podcast/podcast_generator.rb
43
+ - generators/podcast/templates/migration.rb
44
+ - lib/gemspec.rb
45
+ - lib/refinery/podcast.rb
46
+ - lib/tasks/podcast.rake
47
+ - license.md
48
+ - rails/init.rb
49
+ - readme.md
50
+ has_rdoc: true
51
+ homepage: http://refinerycms.com
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.7
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Ruby on Rails podcast plugin for RefineryCMS.
84
+ test_files: []
85
+