podcast-to-youtube 0.3.1 → 0.3.2
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 +4 -4
- data/lib/podcast-to-youtube.rb +25 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49743b759a5880b2f03bfdf892594aa57ddb5499
|
4
|
+
data.tar.gz: 0e0feecbddc1075abea7160eb6535afb3909f373
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07684c3db91a2adc3c3ed7986f000a418b872d91165a21ac75c1e6b82605ede03b883cba7048d4537fee246210dc7aa50f06071792cfaa58adc1beeb0bb9ddf2
|
7
|
+
data.tar.gz: 2db9212492ef1142699d32da0819cb285278ec947437b09460b0d5c1a3bb2da0746b082428a6f57c1cc9477fd2eccfd65e59336eac460a50a1ff331edd21766d
|
data/lib/podcast-to-youtube.rb
CHANGED
@@ -34,32 +34,40 @@ class PodcastUploader
|
|
34
34
|
def upload(podcast_feed_url, video_category_id, privacy = :private)
|
35
35
|
feed = parse_feed podcast_feed_url
|
36
36
|
feed.entries.reverse_each do |entry|
|
37
|
-
audiofile = download_asset entry.enclosure_url
|
38
|
-
coverart = download_asset entry.itunes_image
|
39
|
-
videofile = generate_videofile audiofile coverart
|
40
|
-
video_description = generate_video_description(entry, feed)
|
41
37
|
video_title = "#{feed.title} - #{entry.title}"
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
if !video_already_exists(video_title)
|
39
|
+
audiofile = download_asset entry.enclosure_url
|
40
|
+
coverart = download_asset entry.itunes_image
|
41
|
+
videofile = generate_videofile audiofile coverart
|
42
|
+
video_description = generate_video_description(entry, feed)
|
43
|
+
tags = %w(podcast)
|
44
|
+
|
45
|
+
upload_video video_title video_description video_category_id privacy tags videofile
|
46
|
+
else
|
47
|
+
puts "video #{video_title} already exists on Youtube. Skipping."
|
48
|
+
end
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
48
52
|
private
|
49
53
|
|
50
|
-
def
|
51
|
-
if @account.
|
52
|
-
|
53
|
-
else
|
54
|
-
puts "uploading videofile to Youtube"
|
55
|
-
# refresh authentication if expired
|
56
|
-
if @account.authentication.expired?
|
57
|
-
authenticate_youtube_by_refresh_token
|
58
|
-
end
|
59
|
-
@account.upload_video videofile, privacy_status: privacy, title: video_title, description: video_description, category_id: video_category_id, tags: tags
|
54
|
+
def refresh_authentication
|
55
|
+
if @account.authentication.expired?
|
56
|
+
authenticate_youtube_by_refresh_token
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
60
|
+
def upload_video(video_title, video_description, video_category_id, privacy, tags, videofile)
|
61
|
+
puts "uploading videofile to Youtube"
|
62
|
+
refresh_authentication
|
63
|
+
@account.upload_video videofile, privacy_status: privacy, title: video_title, description: video_description, category_id: video_category_id, tags: tags
|
64
|
+
end
|
65
|
+
|
66
|
+
def video_already_exists(video_title)
|
67
|
+
refresh_authentication
|
68
|
+
return @account.videos.any? {|video| video.title == video_title }
|
69
|
+
end
|
70
|
+
|
63
71
|
def generate_videofile(audiofile, coverart)
|
64
72
|
videofile = File.basename(audiofile, File.extname(audiofile)) + ".mkv"
|
65
73
|
if !File.file?(videofile)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: podcast-to-youtube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Trauth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: feedjira
|