podtergeist 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmIzNDA1MTJmMWZjYTQ1NmQyYjQ0NGZmNDczMTlkZGNlNjE4NTM1Nw==
5
+ data.tar.gz: !binary |-
6
+ NzUyNzliMDgwOGNmYjY0MjBjZDQ0NmRkNjYzNzIxMzI1MWQ0OGFlZQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Yjk1ZDk5MWE4YTYyYjlmMjJlNmUwNDE0MTgxMzBlMmU1NzEyYjRiY2ZmNjQ3
10
+ Mzk4MGJlNjUzNWUwNGQ3MDk3MGFjZDlkYWZmNjVmMjc3YjFlZGZlYzM1MDhh
11
+ NWI0NDJhNWY1ZWNmNGNlZWUzZWYwYWUyZDRmOTIxYjdlMTBiZmI=
12
+ data.tar.gz: !binary |-
13
+ NzliMWVjZmI2NWU4ZjkzNzhlYzc1MmUwOWRlNTgxYjJmMzE2NWYwYjYyNWFk
14
+ MWI1YWY3ZTQ4Y2M0NzYxZjNlM2UwMDUzZDZlM2M2MDYyYzVlN2E3MTFmZTEz
15
+ ZGUyNGViMWU5NzM5MDFjYzYwNDQ5MWMxMWVjNDdjMmI2ZDA3M2I=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Robert Coleman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Podtergeist
2
+
3
+ Command line interface to create or append to podcast-compatible rss feeds via arguments.
4
+ Uses [taglib](http://robinst.github.io/taglib-ruby/) to pull some information directly from podcast files.
5
+
6
+ Please note; while this works it's a first release so the API may change drastically.
7
+
8
+ ## Installation
9
+
10
+ `$ gem install podtergeist`
11
+
12
+ ## Usage
13
+
14
+ `$ podtergeist help`
15
+
16
+ ## Contributing
17
+
18
+ 1. Fork it
19
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
20
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
21
+ 4. Push to the branch (`git push origin my-new-feature`)
22
+ 5. Create new Pull Request
23
+
24
+ ## TODO
25
+
26
+ * valid basic RSS
27
+ * more RSS
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/podtergeist ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ require 'thor'
3
+ require 'podtergeist'
4
+
5
+ class PodtergeistCLI < Thor
6
+ default_task :help
7
+
8
+ method_option :destination, :required => true, :type => :string
9
+
10
+ method_option :show_title, :required => true, :type => :string
11
+ method_option :show_link, :required => true, :type => :string
12
+ method_option :show_url, :required => true, :type => :string
13
+ method_option :show_description, :required => true, :type => :string
14
+
15
+ method_option :local_file, :required => true, :type => :string
16
+ method_option :host, :required => true, :type => :string
17
+ method_option :episode_link, :required => true, :type => :string
18
+ method_option :episode_pubdate, :required => true, :type => :string
19
+
20
+ desc 'add', 'Add item to a podcast feed (creating the feed if does not exist)'
21
+ def add
22
+ Podtergeist::Feed.add(options[:destination],options)
23
+ end
24
+
25
+ end
26
+
27
+ PodtergeistCLI.start
@@ -0,0 +1,5 @@
1
+ require 'podtergeist/version'
2
+ require 'podtergeist/feed'
3
+
4
+ module Podtergeist
5
+ end
@@ -0,0 +1,74 @@
1
+ require 'rss/2.0'
2
+ require 'rss/itunes'
3
+ require 'mime/types'
4
+ require 'taglib'
5
+
6
+ module Podtergeist
7
+ class Feed
8
+ class << self
9
+
10
+ def add(feed,params)
11
+ create_channel(feed,params) unless feed_exists?(feed)
12
+ append_item(feed,params)
13
+ end
14
+
15
+ private
16
+
17
+ # check to see if the destination exists
18
+ def feed_exists?(path)
19
+ File.exist?(path)
20
+ end
21
+
22
+ # create
23
+ def create_channel(path,params)
24
+ rss = RSS::Rss.new('2.0')
25
+ channel = RSS::Rss::Channel.new
26
+
27
+ channel.title = params['show_title']
28
+ channel.description = params['show_description']
29
+ channel.link = params['show_link']
30
+
31
+ rss.channel = channel
32
+
33
+ file = File.new(path, 'w')
34
+ file.write(rss.to_s)
35
+ file.close
36
+ end
37
+
38
+ # add item
39
+ def append_item(path,params)
40
+ local = params['local_file']
41
+ remote = "#{params['host']}/#{File.basename(local)}"
42
+
43
+ TagLib::FileRef.open(local) do |fileref|
44
+ unless fileref.null?
45
+ tag = fileref.tag
46
+ properties = fileref.audio_properties
47
+
48
+ rss = RSS::Parser.parse(File.new(path))
49
+
50
+ item = RSS::Rss::Channel::Item.new
51
+ item.title = tag.title
52
+ item.link = params['episode_link']
53
+
54
+ item.pubDate = Date.parse(params['episode_pubdate']).rfc822
55
+
56
+ item.guid = RSS::Rss::Channel::Item::Guid.new
57
+ item.guid.content = params['episode_link']
58
+ item.guid.isPermaLink = true
59
+
60
+ item.description = tag.title
61
+
62
+ item.enclosure = RSS::Rss::Channel::Item::Enclosure.new(remote, properties.length, MIME::Types.type_for(local).first)
63
+
64
+ rss.items << item
65
+
66
+ file = File.new(path, 'w')
67
+ file.write(rss.to_s)
68
+ file.close
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,3 @@
1
+ module Podtergeist
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ require File.expand_path('../lib/podtergeist/version', __FILE__)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'podtergeist'
6
+ spec.version = Podtergeist::VERSION
7
+ spec.authors = ['Robert Coleman']
8
+ spec.email = ['github@robert.net.nz']
9
+ spec.description = %q{CLI to create or append to podcast-compatible rss via args}
10
+ spec.summary = %q{CLI to create or append to podcast-compatible rss via args}
11
+ spec.homepage = 'https://github.com/rjocoleman/podtergeist'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_dependency 'thor', '~> 0.18'
20
+ spec.add_dependency 'taglib-ruby', '~> 0.6'
21
+ spec.add_dependency 'mime-types', '~> 1.23'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'pry-nav'
27
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podtergeist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Robert Coleman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: taglib-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mime-types
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.23'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.23'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-nav
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: CLI to create or append to podcast-compatible rss via args
112
+ email:
113
+ - github@robert.net.nz
114
+ executables:
115
+ - podtergeist
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - Gemfile
121
+ - LICENSE
122
+ - README.md
123
+ - Rakefile
124
+ - bin/podtergeist
125
+ - lib/podtergeist.rb
126
+ - lib/podtergeist/feed.rb
127
+ - lib/podtergeist/version.rb
128
+ - podtergeist.gemspec
129
+ homepage: https://github.com/rjocoleman/podtergeist
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.0.3
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: CLI to create or append to podcast-compatible rss via args
153
+ test_files: []
154
+ has_rdoc: