jekyll-octopod 0.20.0 → 0.21.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af7f39feb92cfb4b4615bc3d7c4122cb463814e37bf8991c3c553784cfa06268
4
- data.tar.gz: b0d6ebb6e48e8c476526dfb21934efc0ac773e528c48ce23464ee1afeade4e25
3
+ metadata.gz: '08b3d44f4b48f6f493121d5d6bcd4708d4d82f54a386be9a79e8f4cf9df5aceb'
4
+ data.tar.gz: 518582535ee414dcc81f41ad540bf3242bd2fe339067d292733c7c3abe995ca9
5
5
  SHA512:
6
- metadata.gz: 2ae85cc983a4661b5a6cf201cae6bd7c9708ee8c3a15d15134db3947b77ac3af65c0ca584523242f791706852bc3534a087f8eefc9b636543b9dede351a5baaf
7
- data.tar.gz: 771baf577a1ed85e15db658bfa7c87e01890a5bffaf67708b2d4e5bbda029257cb9faa17421d7ef88627226b75328d329f844ade168b33c87839c3d6ad894dc6
6
+ metadata.gz: df52f5ac952f8ce2f4ae7089696183f519f93d0f43133e02011e1f66114c8b9b2e57b32d6da857b69439330af566b53693495f5c7ab733eee8a8e1e7e0d2c256
7
+ data.tar.gz: 61da23c9b801a3f33e011e97723c0dcb2a4d5de86cd15b0e3bdeb8f4cb3f5527eb93c1fc600aaabb6b7e24181b96a223b277c05cc06bc48422a07dc4551b4c47
data/bin/octopod CHANGED
@@ -407,7 +407,7 @@ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == '
407
407
  now_theme_served = theme_shipped_generic_files + %w[
408
408
  podlove-player subscribe-button favicon.ico apple-touch-icon-precomposed.png
409
409
  _includes/sidebar.html _includes/post_header.html _includes/post.html _includes/post_line.html
410
- _includes/disqus_thread.html _includes/disqus_count.html _includes/isso_thread.html
410
+ _includes/isso_thread.html
411
411
  ]
412
412
  found_theme_served = now_theme_served.select { |path| File.exist?(File.join(PWD, path)) }
413
413
 
@@ -420,16 +420,20 @@ if ARGV.size > 0 && (ARGV[0] == 'episode' || ARGV[0] == 'deploy' || ARGV[0] == '
420
420
  puts "===== ... done ===== ", ""
421
421
  end
422
422
 
423
- # As of jekyll-octopod 0.19.0, JSON Feed support is gone outright - not moved to the theme
424
- # gem, just removed (no real podcast client ever consumed it, and a since-fixed bug in this
425
- # gem's own :after_init hook meant it silently never even built). Any 'feed.*.json' marker
426
- # file left over from an older site is now genuinely dead: nothing generates its content, and
427
- # jekyll-octopod-bulma's sidebar no longer links to it. Removed the same way theme-served
428
- # files are removed above.
429
- found_json_feeds = Dir.glob(File.join(PWD, 'feed.*.json'))
430
- unless found_json_feeds.empty?
431
- puts "", "===== Removing feed.*.json marker files (JSON Feed support was removed) ====="
432
- found_json_feeds.each { |path| remove_theme_served_path(path) }
423
+ # As of jekyll-octopod 0.19.0/0.20.0, JSON Feed and Disqus support are gone outright - not
424
+ # moved to the theme gem the way the paths above were, just removed. JSON Feed: no real
425
+ # podcast client ever consumed it, and a since-fixed bug in this gem's own :after_init hook
426
+ # meant it silently never even built. Disqus: unused across every site in this gem's own
427
+ # family (none had disqus_shortname set) and superseded by Isso for self-hosted comments. Any
428
+ # leftover 'feed.*.json' marker file or local copy of the old disqus includes is now genuinely
429
+ # dead - nothing generates or serves it any more. Removed the same way theme-served files are
430
+ # removed above.
431
+ removed_feature_paths = Dir.glob(File.join(PWD, 'feed.*.json')) +
432
+ %w[_includes/disqus_thread.html _includes/disqus_count.html]
433
+ .map { |path| File.join(PWD, path) }.select { |path| File.exist?(path) }
434
+ unless removed_feature_paths.empty?
435
+ puts "", "===== Removing files for features that were removed entirely (JSON Feed, Disqus) ====="
436
+ removed_feature_paths.each { |path| remove_theme_served_path(path) }
433
437
  puts "===== ... done ===== ", ""
434
438
  end
435
439
 
@@ -39,10 +39,78 @@ module Jekyll
39
39
  publicationDate: page["date"].respond_to?(:xmlschema) ? page["date"].xmlschema : page["date"].to_s,
40
40
  duration: page["duration"],
41
41
  audio: audio,
42
- chapters: page["chapters"] ? page["chapters"].map { |chapter| split_chapter(chapter) }.compact : nil
42
+ chapters: page["chapters"] ? page["chapters"].map { |chapter| split_chapter(chapter) }.compact : nil,
43
+ transcripts: transcripts_for(page)
43
44
  }.to_json
44
45
  end
45
46
 
47
+ # Finds a WebVTT transcript for this episode and parses it into the cue list Podlove Web
48
+ # Player's "transcripts" config field expects (see the same docs link above the config
49
+ # method: a plain list of { start, start_ms, end, end_ms, speaker, voice, text } cues - the
50
+ # player has no native understanding of WebVTT itself, so this is doing that conversion, not
51
+ # just passing the file through). Looks for an explicit page["transcript"] filename first,
52
+ # then falls back to the audio file's own basename with a .vtt extension (i.e.
53
+ # "episode1.mp3" -> "episode1.vtt"), resolved on disk the same way file_size() locates audio
54
+ # files: relative to the site root if the filename already contains a "/", otherwise under
55
+ # episodes/. Returns nil if there's no matching, parseable file, so the config field is
56
+ # simply omitted rather than sent empty.
57
+ def transcripts_for(page)
58
+ filename = page["transcript"] || vtt_sibling_of(page["audio"])
59
+ return nil unless filename
60
+
61
+ path = filename =~ /\// ? filename : File.join('episodes', filename)
62
+ return nil unless File.exist?(path)
63
+
64
+ cues = parse_vtt(File.read(path, encoding: 'UTF-8'))
65
+ cues.empty? ? nil : cues
66
+ end
67
+
68
+ def vtt_sibling_of(audio_hash)
69
+ return nil unless audio_hash
70
+ primary = audio(audio_hash)
71
+ return nil unless primary
72
+
73
+ primary.sub(/\.[^.\/]+\z/, '.vtt')
74
+ end
75
+
76
+ # Parses WebVTT cues, including Auphonic's "<v Speaker>text</v>" voice-tag convention. Not a
77
+ # full WebVTT implementation (no styling, regions, or nested tags) - just enough to turn
78
+ # timed, optionally speaker-tagged captions into Podlove's transcript-cue shape.
79
+ def parse_vtt(content)
80
+ content = content.sub(/\A\xEF\xBB\xBF/, '').gsub("\r\n", "\n")
81
+
82
+ content.split(/\n\n+/).filter_map do |block|
83
+ lines = block.strip.split("\n")
84
+ next nil if lines.empty?
85
+
86
+ # Discard the "WEBVTT" header, NOTE/STYLE/REGION blocks, and any cue identifier line -
87
+ # everything up to the "start --> end" timing line, which is left in place once found.
88
+ lines.shift while lines.first && !lines.first.include?('-->')
89
+ timing = lines.shift
90
+ next nil unless timing
91
+
92
+ match = timing.match(/((?:\d{2}:)?\d{2}:\d{2}\.\d{3})\s*-->\s*((?:\d{2}:)?\d{2}:\d{2}\.\d{3})/)
93
+ next nil unless match
94
+
95
+ text = lines.join(' ').strip
96
+ voice = text[/\A<v\s+([^>]+)>/, 1]
97
+ text = text.sub(/\A<v\s+[^>]+>/, '').sub(%r{</v>\z}, '').strip
98
+
99
+ { start: match[1], start_ms: ms_from_vtt_timestamp(match[1]),
100
+ end: match[2], end_ms: ms_from_vtt_timestamp(match[2]),
101
+ speaker: nil, voice: voice, text: text }
102
+ end
103
+ end
104
+
105
+ def ms_from_vtt_timestamp(timestamp)
106
+ parts = timestamp.split(':')
107
+ seconds, millis = parts.pop.split('.')
108
+ minutes = parts.pop.to_i
109
+ hours = parts.empty? ? 0 : parts.pop.to_i
110
+
111
+ (((hours * 60) + minutes) * 60 + seconds.to_i) * 1000 + millis.to_i
112
+ end
113
+
46
114
  def playerbaseconfig(context)
47
115
  config = context.registers[:site].config
48
116
  { version: 5, base: "#{config["url"]}/assets/podlove-player/" }.to_json
@@ -2,7 +2,7 @@ module Jekyll
2
2
  class Octopod
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
- MINOR = 20
5
+ MINOR = 21
6
6
  TINY = 0
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-octopod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arne Eilermann
@@ -105,7 +105,6 @@ extra_rdoc_files: []
105
105
  files:
106
106
  - README.md
107
107
  - Rakefile
108
- - assets/_config.yml
109
108
  - assets/_config.yml.sample
110
109
  - assets/_posts/2016-03-22-episode0.md
111
110
  - assets/_sass/_overrides.scss
data/assets/_config.yml DELETED
@@ -1,47 +0,0 @@
1
- # You have to configure this ###################################################
2
- title: Octopod
3
- # You should configure this ####################################################
4
- url: http://localhost:4000
5
- subtitle: Static Site Podcast Publishing for Geeks
6
- description: My super duper cool podcast.
7
- author: Uncle Octopod
8
- email: octopod@example.com
9
- keywords: [octopod, podcast, magic]
10
- itunes_categories: [Technology]
11
- # additional_feeds:
12
- # itunes: http://itunes.apple.com/de/podcast/podcast_name/id42424242
13
- # torrent_m4a: http://bitlove.org/example_user/example_podcast_m4a/feed
14
- # torrent_mp3: http://bitlove.org/example_user/example_podcast_mp3/feed
15
- episodes_per_feed_page: 100
16
- ## Rsync Deploy config #########################################################
17
- ### Be sure your public key is listed in your server's ~/.ssh/authorized_keys
18
- ### file.
19
- ssh_host: user@host.org
20
- ssh_port: 22
21
- document_root: /path/to/your/htdocs/
22
- rsync_delete: true
23
- # You can configure this #######################################################
24
- twitter_nick: my_twitter_handle
25
- language: en
26
- explicit: 'no' # 'yes'/'no'/clean
27
- license: CC BY 4.0
28
- license_url: https://creativecommons.org/licenses/by/4.0/
29
- license_image_url: https://i.creativecommons.org/l/by/4.0/88x31.png
30
- ## Flattr ######################################################################
31
- flattr_uid: # Flattr will not be used unless this is set
32
- flattr_button: compact # compact | default
33
- flattr_mode: auto # auto | manual(default)
34
- flattr_popout: 1 # 1 | 0 (show popout when hovering mouse over button)
35
- flattr_language: en_GB # available languages - https://api.flattr.com/rest/v2/languages.txt
36
- flattr_category: audio # available categories - https://api.flattr.com/rest/v2/categories.txt
37
- ## Disqus comments #############################################################
38
- disqus_shortname: # Disqus will not be used unless this is set
39
- disqus_developer: 0 # 1 / 0
40
- ## Feed links ###########################################################
41
- itunes_url: https://itunes.apple.com/at/podcast/myname/id#myid#
42
- bitlove_url: https://bitlove.org/myaccount
43
- fyyd_url: https://fyyd.de/podcast/myaccount/myid
44
- gpodder_url: https://gpodder.net/podcast/mypodcast
45
-
46
- gems: [jekyll-octopod]
47
- theme: jekyll-bootflat