distorted-jekyll 0.5.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/distorted-jekyll.rb +1 -1
- data/lib/distorted-jekyll/_config_default.yml +9 -7
- data/lib/distorted-jekyll/floor.rb +122 -4
- data/lib/distorted-jekyll/invoker.rb +80 -221
- data/lib/distorted-jekyll/{injection_of_love.rb → md_injection.rb} +0 -0
- data/lib/distorted-jekyll/molecule/font.rb +48 -15
- data/lib/distorted-jekyll/molecule/image.rb +11 -22
- data/lib/distorted-jekyll/molecule/lastresort.rb +51 -0
- data/lib/distorted-jekyll/molecule/pdf.rb +42 -51
- data/lib/distorted-jekyll/molecule/svg.rb +9 -21
- data/lib/distorted-jekyll/molecule/text.rb +6 -18
- data/lib/distorted-jekyll/molecule/video.rb +54 -12
- data/lib/distorted-jekyll/static_state.rb +201 -0
- data/lib/distorted-jekyll/template/13th-style.css +1 -0
- metadata +7 -44
- data/lib/distorted-jekyll/error_code.rb +0 -24
- data/lib/distorted-jekyll/molecule/abstract.rb +0 -238
- data/lib/distorted-jekyll/molecule/last-resort.rb +0 -54
- data/lib/distorted-jekyll/static/font.rb +0 -42
- data/lib/distorted-jekyll/static/image.rb +0 -55
- data/lib/distorted-jekyll/static/lastresort.rb +0 -28
- data/lib/distorted-jekyll/static/pdf.rb +0 -53
- data/lib/distorted-jekyll/static/state.rb +0 -141
- data/lib/distorted-jekyll/static/svg.rb +0 -52
- data/lib/distorted-jekyll/static/text.rb +0 -57
- data/lib/distorted-jekyll/static/video.rb +0 -90
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
require 'distorted/video'
|
4
|
-
require 'distorted-jekyll/static/state'
|
5
|
-
|
6
|
-
module Jekyll
|
7
|
-
module DistorteD
|
8
|
-
module Static
|
9
|
-
class Video < Jekyll::DistorteD::Static::State
|
10
|
-
|
11
|
-
DRIVER = Cooltrainer::DistorteD::Video
|
12
|
-
|
13
|
-
MEDIA_TYPE = DRIVER::MEDIA_TYPE
|
14
|
-
MIME_TYPES = DRIVER::MIME_TYPES
|
15
|
-
|
16
|
-
ATTRS = DRIVER::ATTRS
|
17
|
-
ATTRS_DEFAULT = DRIVER::ATTRS_DEFAULT
|
18
|
-
ATTRS_VALUES = DRIVER::ATTRS_VALUES
|
19
|
-
|
20
|
-
|
21
|
-
# dest: string realpath to `_site_` directory
|
22
|
-
def write(dest)
|
23
|
-
orig_dest = destination(dest)
|
24
|
-
|
25
|
-
# TODO: Make this smarter. Need to see if there's an easy way to
|
26
|
-
# get a list of would-be-generated filenames from GStreamer.
|
27
|
-
return false if File.exist?(path) && !modified?
|
28
|
-
self.class.mtimes[path] = mtime
|
29
|
-
|
30
|
-
distorted = DRIVER.new(path, orig_dest, basename)
|
31
|
-
|
32
|
-
distorted.generate
|
33
|
-
end
|
34
|
-
|
35
|
-
# Return a Set of extant video variations due to inability/unwillingness
|
36
|
-
# to exactly predict GStreamer's HLS/DASH segment output naming
|
37
|
-
# even if we are controlling all variables like segment length etc.
|
38
|
-
# This implementation may give stale segments but will at least speed
|
39
|
-
# up site generation by not having to regenerate the video every time.
|
40
|
-
def destinations(dest)
|
41
|
-
wanted = Set[]
|
42
|
-
if Dir.exist?(dd_dest(dest))
|
43
|
-
hls_dir = File.join(dd_dest(dest), "#{basename}.hls")
|
44
|
-
if Dir.exist?(hls_dir)
|
45
|
-
wanted.merge(Dir.entries(hls_dir).to_set.map{|f| File.join(hls_dir, f)})
|
46
|
-
end
|
47
|
-
end
|
48
|
-
wanted
|
49
|
-
end
|
50
|
-
|
51
|
-
def modified?
|
52
|
-
# We can't use the standard Static::State#modified? here until
|
53
|
-
# I figure out how to cleanly get a duplicate of what would be
|
54
|
-
# the generated filenames from GStreamer's sink.
|
55
|
-
#
|
56
|
-
# For now for the sake of speeding up my site generation
|
57
|
-
# I'll assume not-modified that if the output variant (e.g. DASH/HLS)
|
58
|
-
# container dir exists and contains at least two files:
|
59
|
-
# the playlist and at least one segment.
|
60
|
-
#
|
61
|
-
# Hacky HLS-only right now until dashsink2 lands in upstream Gst.
|
62
|
-
#
|
63
|
-
# Assume modified for the sake of freshness :)
|
64
|
-
modified = true
|
65
|
-
|
66
|
-
site_dest = Jekyll::DistorteD::Floor::config(:destination).to_s
|
67
|
-
if Dir.exist?(site_dest)
|
68
|
-
|
69
|
-
dd_dest = dd_dest(site_dest)
|
70
|
-
if Dir.exist?(dd_dest)
|
71
|
-
|
72
|
-
hls_dir = File.join(dd_dest, "#{basename}.hls")
|
73
|
-
if Dir.exist?(hls_dir)
|
74
|
-
need_filez = Set["#{basename}.m3u8"]
|
75
|
-
var_filez = Dir.entries(hls_dir).to_set
|
76
|
-
if need_filez.subset?(var_filez) and var_filez.count > 2
|
77
|
-
modified = false
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
83
|
-
Jekyll.logger.debug("#{@name} modified?", modified)
|
84
|
-
modified
|
85
|
-
end
|
86
|
-
|
87
|
-
end # Video
|
88
|
-
end # Static
|
89
|
-
end # DistorteD
|
90
|
-
end # Jekyll
|