podtergeist 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzJjMjVjOGZlODVhNzE0YTUyYzZhYmFjNWYzZDQyNjhiMDgxNjJlZA==
4
+ M2JmOGFmMmFhZjY4YmQ5OWFjYTYyODlkODEwYmFmMmEwNzllNzQ4MA==
5
5
  data.tar.gz: !binary |-
6
- ZjI1NGRmNjMxY2RkZDk1ODE1NmMzZmM3NDMzYzlhOTk4YTFlYjUwMA==
6
+ NDg0YTc2YWI4ZjY3M2E2NGVjOTE4Mzk2NjZhOGZlOWE3OWQ5ZmJhOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGJjNjQ4NGI5NzBmMzljOTE4Y2M3YjJkM2I2YjY3MjFjYmFmNjQwOThkNzYw
10
- ZWJiMmY0MjU4OTgxZDYxZWVmMGQ1NTEyZjc2ODY0YjRhZDkyY2I5NGY5YzA4
11
- ZGIxY2EzZTA0YjAzZjczOWQ2NWExMzA2N2Y2MGJkNzM5ODZhYTc=
9
+ MTQxYTg4ODkwYmRhMWJjZWQwMTBkNGJjNDYwZjMxNGUwN2Q3NzcyYWNhZmJj
10
+ NmRlN2YxOWVmMWIyM2U5MDAwYTE1MDY3M2E0N2U3MGUxMTA3NDIxN2RlNjAy
11
+ OWZiNWMzZDcxZGNhNWU4Mzk5NGRjOGUzNjk4NjZiYjQ5ZjNmYzU=
12
12
  data.tar.gz: !binary |-
13
- ZWUwZWQzNDcyYzY0NTNkMmJhZTJiNTk2YWQ0ZjAyNDVkMjNhZjA5ODRlY2E2
14
- NjA5YWU1OTRiNzZlNTZhMjM1ZjU4NzFjZjgxMTZlNjY0ZmM2NDQ3MzI3MzM3
15
- ZTllNDk0Nzg3YjNkOWU0ZWM3YTY1MzA1MWJmM2E2NmRjOWQ2N2U=
13
+ ZmNlMThkNzMzNWU4OGJmYjhlOWQ2ODQ3ZDMwZmNhYjJhZTk4ODU4ZTU3YTFk
14
+ MmNmZTg1YzQ3M2U5MDk1MmZhZDU0Nzg0ZmQ3ZWMzNzBkNzA2MDEwZDUxNTJk
15
+ NDE0ZTAwOWVjMTBmZmQ5Yzk2YmY5MGVlNTRiZDI5MWQ0ZGYxZmE=
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Podtergeist
2
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.
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
5
 
6
- Please note; while this works it's a first release so the API may change drastically.
6
+ Please note; while this works it's a first release so the API may change drastically.
7
7
 
8
8
  ## Installation
9
9
 
@@ -23,5 +23,4 @@ Please note; while this works it's a first release so the API may change drastic
23
23
 
24
24
  ## TODO
25
25
 
26
- * valid basic RSS
27
- * more RSS
26
+ * more RSS, itunes specific features (etc)
data/bin/podtergeist CHANGED
@@ -4,23 +4,34 @@ require 'podtergeist'
4
4
 
5
5
  class PodtergeistCLI < Thor
6
6
  default_task :help
7
-
7
+
8
8
  method_option :destination, :required => true, :type => :string
9
-
10
9
  method_option :show_title, :required => true, :type => :string
11
10
  method_option :show_link, :required => true, :type => :string
12
11
  method_option :show_description, :required => true, :type => :string
13
-
14
12
  method_option :local_file, :required => true, :type => :string
15
13
  method_option :host, :required => true, :type => :string
16
14
  method_option :episode_link, :required => true, :type => :string
17
15
  method_option :episode_pubdate, :required => true, :type => :string
18
-
16
+
19
17
  desc 'add', 'Add item to a podcast feed (creating the feed if does not exist)'
20
18
  def add
21
19
  Podtergeist::Feed.add(options[:destination],options)
22
20
  end
23
21
 
22
+ method_option :destination, :required => true, :type => :string
23
+ method_option :show_title, :required => true, :type => :string
24
+ method_option :show_link, :required => true, :type => :string
25
+ method_option :show_description, :required => true, :type => :string
26
+ method_option :local_directory, :required => true, :type => :string
27
+ method_option :host, :required => true, :type => :string
28
+ method_option :episode_link, :required => false, :type => :string
29
+ method_option :episode_pubdate, :required => false, :type => :string
30
+
31
+ desc 'existing', 'Add items in existing directory to a podcast feed (creating the feed if does not exist)'
32
+ def existing
33
+ Podtergeist::Feed.existing(options[:destination],options)
34
+ end
24
35
  end
25
36
 
26
37
  PodtergeistCLI.start
@@ -11,6 +11,13 @@ module Podtergeist
11
11
  create_channel(feed,params) unless feed_exists?(feed)
12
12
  append_item(feed,params)
13
13
  end
14
+
15
+ def existing(feed,params)
16
+ create_channel(feed,params) unless feed_exists?(feed)
17
+ Dir.glob("#{params['local_directory']}/*").each do |file|
18
+ append_item(feed,params,file)
19
+ end
20
+ end
14
21
 
15
22
  private
16
23
 
@@ -36,11 +43,10 @@ module Podtergeist
36
43
  end
37
44
 
38
45
  # add item
39
- def append_item(path,params)
40
- local = params['local_file']
41
- remote = "#{params['host']}/#{File.basename(local)}"
46
+ def append_item(path,params,file=params['file_file'])
47
+ remote = "#{params['host']}/#{File.basename(file)}"
42
48
 
43
- TagLib::FileRef.open(local) do |fileref|
49
+ TagLib::FileRef.open(file) do |fileref|
44
50
  unless fileref.null?
45
51
  tag = fileref.tag
46
52
  properties = fileref.audio_properties
@@ -49,17 +55,17 @@ module Podtergeist
49
55
 
50
56
  item = RSS::Rss::Channel::Item.new
51
57
  item.title = tag.title
52
- item.link = params['episode_link']
58
+ item.link = params['episode_link'] unless params['episode_link'].nil?
53
59
 
54
- item.pubDate = Date.parse(params['episode_pubdate']).rfc822
60
+ item.pubDate = Date.parse(params['episode_pubdate']).rfc822 unless params['episode_pubdate'].nil?
55
61
 
56
62
  item.guid = RSS::Rss::Channel::Item::Guid.new
57
- item.guid.content = params['episode_link']
63
+ item.guid.content = params['episode_link'] unless params['episode_link'].nil?
58
64
  item.guid.isPermaLink = true
59
65
 
60
66
  item.description = tag.title
61
67
 
62
- item.enclosure = RSS::Rss::Channel::Item::Enclosure.new(remote, properties.length, MIME::Types.type_for(local).first)
68
+ item.enclosure = RSS::Rss::Channel::Item::Enclosure.new(remote, properties.length, MIME::Types.type_for(file).first)
63
69
 
64
70
  rss.items << item
65
71
 
@@ -69,6 +75,7 @@ module Podtergeist
69
75
  end
70
76
  end
71
77
  end
78
+
72
79
  end
73
80
  end
74
81
  end
@@ -1,3 +1,3 @@
1
1
  module Podtergeist
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podtergeist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Coleman