Skip to content

Commit

Permalink
Update to Ruby 1.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
boncey committed Jul 6, 2013
1 parent fd0d54a commit 60dbea0
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 36 deletions.
24 changes: 0 additions & 24 deletions README

This file was deleted.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Podcast is a simple library and command line utility for creating podcast files from a directory of mp3 files.
Podcast will examine mp3s, extract metadata from ID3 tags, and build an RSS file which can then be podcast clients to download the mp3s.

### To build and install ruby-podcast

You'll need to install the Ruby mp3info library installed before podcast
will work:

gem install ruby-mp3info

Or you can grab ruby-mp3info here:

http://rubyforge.org/projects/ruby-mp3info/

Then get the ruby-podcast source:

git clone https://github.com/boncey/ruby-podcast.git (or download from https://github.com/boncey/ruby-podcast/archive/master.zip)
cd ruby-podcast
gem build podcast.gemspec
gem install podcast-*.gem (this may need a sudo prefix depending on your ruby setup)

### Usage

Once you've installed ruby-mp3info and podcast you should have a
command line utility you can run on a directory of mp3 files:

% podcast --dir my/mp3/dir --out podcast.rss --title "Title" --description "Description" --link http://mypodcastserver/

#### Please note
This used to be hosted at http://podcast.rubyforge.org/
However, that version no longer works with newer versions of Ruby.

I (https://github.com/boncey) have made changes so it to works and after getting no answer from the author or via the list on rubyforge have decided to upload my version to https://github.com/boncey/ruby-podcast
24 changes: 19 additions & 5 deletions bin/podcast
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby -d
#!/usr/bin/env ruby

# == Synopsis
#
Expand All @@ -7,7 +7,7 @@
#
# == Usage
#
# podcast --dir my/mp3/dir --out podcast.rss --title "Title" --description "Description"
# podcast --dir my/mp3/dir --out podcast.rss --title "Title" --description "Description" --link http://mypodcastserver/
#
# == Author
# Ed Summers <[email protected]>
Expand All @@ -18,10 +18,16 @@
# Licensed under the same terms as Ruby.

require 'optparse'
require 'rdoc/usage'
require 'rubygems'
require 'podcast'

def usage(opts)
puts 'podcast --dir my/mp3/dir --out podcast.rss --title "Title" --description "Description" --link http://mypodcastserver/'
puts "Version: #{Podcast::NAME}"
puts opts.help
exit
end

# the location to look for mp3s
dir = ''

Expand All @@ -45,8 +51,16 @@ opts.on("-a", "--about VAL", String) { |val| podcast.about=val }
opts.on("-i", "--image VAL", String) { |val| podcast.image=val }
opts.on("-v", "--version VAL", String) { |val| version=val }
opts.on("-e", "--description VAL", String) { |val| podcast.description=val }
opts.parse(ARGV) rescue RDoc::usage('usage')
RDoc::usage('usage') if dir == nil || podcast.title == nil || podcast.description == nil
begin
opts.parse(ARGV)
rescue => e
usage(opts)
end

if dir == nil || !File.directory?(dir) || !podcast.valid?
usage(opts)
end


# add a directory
podcast.add_dir(dir)
Expand Down
9 changes: 8 additions & 1 deletion lib/podcast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Feed
def initialize
@mp3s = []
@language = "English"
@about = "Made with #{NAME}"
@base = ''
end

Expand All @@ -31,6 +32,10 @@ def add_mp3(file)
end
end

def valid?
title != nil && description != nil && link != nil
end

# add a directory location to the podcast
# the directory will be recursively search
# for mp3 files.
Expand Down Expand Up @@ -58,13 +63,15 @@ def get_rss
#version = "1.0" # ["0.9", "1.0", "2.0"]
version = @version

content = RSS::Maker.make(version) do |m|
content = RSS::Maker.make(@version) do |m|
m.channel.title = @title
m.channel.description = @description
m.channel.link = @link
m.channel.language = @language
m.channel.about = @about
m.items.do_sort = true # sort items by date
m.channel.updated = Time.now.to_s
m.channel.author = NAME

if @image != nil
m.image.url = @image
Expand Down
3 changes: 2 additions & 1 deletion lib/podcast/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Podcast
VERSION = "0.0.5"
VERSION = "0.0.6"
NAME = "ruby-podcast-#{VERSION}"
end
10 changes: 5 additions & 5 deletions podcast.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ $:.push File.expand_path("../lib", __FILE__)
require "podcast/version"

Gem::Specification.new do |s|
s.name = "podcast"
s.name = "ruby-podcast"
s.version = Podcast::VERSION
s.authors = ["Ed Summers", "Darren Greaves"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/boncey/ruby-podcast"
s.summary = %q{Create podcasts from MP3 files}
s.description = %q{Iterate over a directory of mp3 files and write out a podcast RSS file}

s.rubyforge_project = "podcast"
s.rubyforge_project = "ruby-podcast"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.files = %w{bin/podcast lib/podcast.rb lib/podcast/version.rb}
s.test_files = %w{test/test_podcast.rb}
s.executables = %w{podcast}
s.require_paths = ["lib"]
s.add_dependency "ruby-mp3info"
end
1 change: 1 addition & 0 deletions test/test_podcast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_get_rss
items = rss.items()
assert(items.size == 1)
assert_equal(items[0].link, 'http://www.example.org/torrents/test.mp3')
assert_equal(rss.channel.title, p.title)
end

end

0 comments on commit 60dbea0

Please sign in to comment.