storyboard 0.5.0.pre3 → 0.5.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/INSTALL.md +19 -3
- data/lib/storyboard/generators/sub.rb +1 -1
- data/lib/storyboard/subtitles.rb +17 -8
- data/lib/storyboard/time.rb +3 -2
- data/lib/storyboard/version.rb +1 -1
- data/lib/storyboard.rb +3 -7
- metadata +3 -4
- data/Gemfile.lock +0 -59
data/INSTALL.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Installing Storybard
|
2
2
|
|
3
|
-
Storyboard relies on a number of external
|
3
|
+
Storyboard relies on a number of external tools to handle the video files and generate any output. Primarily, it requires Ruby 1.9.3 or greater, FFMpeg 1.1 or greater, Imagemagick (which in turn requires ghostscript), and a compiler.
|
4
4
|
|
5
5
|
## OS X: Simply
|
6
6
|
|
@@ -10,7 +10,7 @@ Opening a terminal and running the following command will install **everything**
|
|
10
10
|
|
11
11
|
## OS X: More In Depth
|
12
12
|
|
13
|
-
To begin, you'll need to download GCC, a set of tools that will let you compile
|
13
|
+
To begin, you'll need to download GCC, a set of tools that will let you compile the outside programs that Storyboard needs. You can find a nice installer for it at [osx-gcc-installer](https://github.com/kennethreitz/osx-gcc-installer). Once GCC is available, download and install [homebrew](http://mxcl.github.com/homebrew/), which is a tool that will automate of the installation process for Imagemagick and FFmpeg. If you haven't installed homebrew before, open a Terminal window and do the following:
|
14
14
|
|
15
15
|
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
|
16
16
|
brew install ffmpeg imagemagick ghostscript
|
@@ -27,7 +27,23 @@ Finally, if you don't have Ruby 1.9.3 installed on your system, you can use <a h
|
|
27
27
|
rvm install 1.9.3-p374
|
28
28
|
rvm default 1.9.3-p374
|
29
29
|
|
30
|
-
When all of those are installed, you can install Storyboard with the `gem` command, and create a link to it so that it runs with 1.9.3.
|
30
|
+
When all of those are installed, you can install Storyboard with the `gem` command, and create a link to it so that it runs only with Ruby 1.9.3.
|
31
31
|
|
32
32
|
gem install storyboard
|
33
33
|
rvm wrapper 1.9.3-p374 --no-prefix storyboard
|
34
|
+
|
35
|
+
## Linux
|
36
|
+
|
37
|
+
For Ubuntu/Debian, Storyboard needs the following packages, which will install Ruby 1.9.3 and Imagemagick.
|
38
|
+
|
39
|
+
sudo apt-get install make
|
40
|
+
sudo apt-get install ruby1.9.1-dev
|
41
|
+
sudo apt-get install yasm imagemagick
|
42
|
+
sudo gem install bundler
|
43
|
+
|
44
|
+
The version of FFmpeg that Storyboard requires isn't in any package repos yet, and so you need to download and compile your own version
|
45
|
+
|
46
|
+
wget http://ffmpeg.org/releases/ffmpeg-1.1.1.tar.gz
|
47
|
+
tar xvf ffmpeg-1.1.1.tar.gz
|
48
|
+
cd ffmpeg-1.1.1
|
49
|
+
./configure && make && make install
|
@@ -14,7 +14,7 @@ class Storyboard
|
|
14
14
|
def add_subtitle(image, subtitle, dimensions)
|
15
15
|
offset = 0
|
16
16
|
subtitle.lines.reverse.each_with_index {|caption,i|
|
17
|
-
escaped = caption.gsub('
|
17
|
+
escaped = caption.gsub("'", "\\\\'")
|
18
18
|
font_size = 30
|
19
19
|
text_width = dimensions[0] + 1
|
20
20
|
while(text_width > (dimensions[0] * 0.9))
|
data/lib/storyboard/subtitles.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pp'
|
2
|
+
require 'iconv'
|
2
3
|
|
3
4
|
class Storyboard
|
4
5
|
def get_subtitles
|
@@ -34,7 +35,7 @@ class Storyboard
|
|
34
35
|
chosen = nil
|
35
36
|
|
36
37
|
if @cache.subtitles.nil?
|
37
|
-
LOG.
|
38
|
+
LOG.debug("No subtitles cache found")
|
38
39
|
@cache.subtitles = downloader.possible_urls
|
39
40
|
@cache.save
|
40
41
|
end
|
@@ -96,7 +97,7 @@ class Storyboard
|
|
96
97
|
@needs_KFhimaji = false
|
97
98
|
check_bom(@text.lines.first)
|
98
99
|
Storyboard.current_encoding = @encoding
|
99
|
-
@text =
|
100
|
+
@text = text.force_encoding(Storyboard.current_encoding)
|
100
101
|
parse
|
101
102
|
clean_promos
|
102
103
|
LOG.info("Parsed subtitle file. #{count} entries found.")
|
@@ -117,13 +118,21 @@ class Storyboard
|
|
117
118
|
end
|
118
119
|
|
119
120
|
|
121
|
+
def fix_encoding(l)
|
122
|
+
# The only ISO8859-1 I hit so far. I expec this to grow.
|
123
|
+
if !(l.bytes.to_a | [233,146]).empty? && @encoding == 'UTF-8'
|
124
|
+
l = l.unpack("C*").pack("U*")
|
125
|
+
end
|
126
|
+
l
|
127
|
+
end
|
128
|
+
|
120
129
|
#There are some horrid files, so I want to be able to have more than just a single regex
|
121
130
|
#to parse the srt file. Eventually, handling these errors will be a thing to do.
|
122
131
|
def parse
|
123
132
|
phase = :line_no
|
124
133
|
page = nil
|
125
|
-
|
126
134
|
@text.each_line {|l|
|
135
|
+
l = fix_encoding(l)
|
127
136
|
l = l.strip
|
128
137
|
#p l.bytes.to_a
|
129
138
|
case phase
|
@@ -151,7 +160,7 @@ class Storyboard
|
|
151
160
|
@pages << page
|
152
161
|
else
|
153
162
|
Storyboard.needs_KFhimaji(true) if l.contains_cjk?
|
154
|
-
page[:lines] << l.gsub(Storyboard.encode_regexp("<\/?[^>]*>"), "")
|
163
|
+
page[:lines] << l.gsub(Storyboard.encode_regexp("<\/?[^>]*>"), "").encode!("UTF-8")
|
155
164
|
end
|
156
165
|
end
|
157
166
|
}
|
@@ -160,10 +169,10 @@ class Storyboard
|
|
160
169
|
# Strip out obnoxious "CREATED BY L33T DUD3" or "DOWNLOADED FROM ____" text
|
161
170
|
def clean_promos
|
162
171
|
@pages.delete_if {|page|
|
163
|
-
!page[:lines].grep(
|
164
|
-
!page[:lines].grep(
|
165
|
-
!page[:lines].grep(
|
166
|
-
!page[:lines].grep(
|
172
|
+
!page[:lines].grep(/Subtitles downloaded/).empty? ||
|
173
|
+
!page[:lines].grep(/addic7ed/).empty? ||
|
174
|
+
!page[:lines].grep(/OpenSubtitles/).empty? ||
|
175
|
+
!page[:lines].grep(/sync, corrected by/).empty? ||
|
167
176
|
false
|
168
177
|
}
|
169
178
|
end
|
data/lib/storyboard/time.rb
CHANGED
@@ -3,8 +3,9 @@ class STRTime
|
|
3
3
|
attr_reader :value
|
4
4
|
|
5
5
|
class <<self
|
6
|
-
def parse(str)
|
7
|
-
|
6
|
+
def parse(str, skip_encode=false)
|
7
|
+
matcher = skip_encode ? Regexp.new(REGEX) : Storyboard.encode_regexp(REGEX)
|
8
|
+
hh,mm,ss,ms = str.scan(matcher).flatten.map{|i|
|
8
9
|
Float(i.force_encoding("ASCII-8bit").delete("\000"))
|
9
10
|
}
|
10
11
|
value = ((((hh*60)+mm)*60)+ss) + ms/1000
|
data/lib/storyboard/version.rb
CHANGED
data/lib/storyboard.rb
CHANGED
@@ -98,7 +98,7 @@ class Storyboard
|
|
98
98
|
begin
|
99
99
|
# trolololol
|
100
100
|
o = stdout.gets.split('|').inject({}){|hold,value| s = value.split('='); hold[s[0]]=s[1]; hold }
|
101
|
-
t = STRTime.parse(o['pkt_pts_time'])
|
101
|
+
t = STRTime.parse(o['pkt_pts_time'], true)
|
102
102
|
pbar.progress = t.value
|
103
103
|
@capture_points << t
|
104
104
|
end while !stdout.eof?
|
@@ -158,12 +158,8 @@ class Storyboard
|
|
158
158
|
@capture_points.each_with_index {|f,i|
|
159
159
|
next if i >= @stop_frame
|
160
160
|
image_name = File.join(@options[:save_directory], "%04d.jpg" % [i])
|
161
|
-
capture_point_subtitles = @subtitles.pages.select { |page| f.value >= page.start_time.value and f.value <= page.end_time.value }.
|
162
|
-
|
163
|
-
@renderers.each{|r| r.render_frame(image_name, capture_point_subtitles) }
|
164
|
-
rescue
|
165
|
-
p $!
|
166
|
-
end
|
161
|
+
capture_point_subtitles = @subtitles.pages.select { |page| f.value >= page.start_time.value and f.value <= page.end_time.value }.last
|
162
|
+
@renderers.each{|r| r.render_frame(image_name, capture_point_subtitles) }
|
167
163
|
pbar.increment
|
168
164
|
}
|
169
165
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: storyboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.pre4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -168,7 +168,6 @@ files:
|
|
168
168
|
- .rvmrc
|
169
169
|
- CHANGELOG
|
170
170
|
- Gemfile
|
171
|
-
- Gemfile.lock
|
172
171
|
- INSTALL.md
|
173
172
|
- LICENSE
|
174
173
|
- README.md
|
@@ -235,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
234
|
version: 1.3.1
|
236
235
|
requirements: []
|
237
236
|
rubyforge_project:
|
238
|
-
rubygems_version: 1.8.
|
237
|
+
rubygems_version: 1.8.25
|
239
238
|
signing_key:
|
240
239
|
specification_version: 3
|
241
240
|
summary: Video to PDF/ePub generator
|
data/Gemfile.lock
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
storyboard (0.5.0.pre2)
|
5
|
-
bundler
|
6
|
-
levenshtein-ffi
|
7
|
-
mime-types (>= 1.19)
|
8
|
-
mini_magick
|
9
|
-
path (>= 1.3.0)
|
10
|
-
prawn
|
11
|
-
ruby-progressbar
|
12
|
-
rubyzip
|
13
|
-
term-ansicolor
|
14
|
-
|
15
|
-
PATH
|
16
|
-
remote: vendor/suby
|
17
|
-
specs:
|
18
|
-
suby (0.4.0)
|
19
|
-
mime-types (>= 1.19)
|
20
|
-
path (>= 1.3.0)
|
21
|
-
rubyzip
|
22
|
-
term-ansicolor
|
23
|
-
|
24
|
-
GEM
|
25
|
-
remote: http://rubygems.org/
|
26
|
-
specs:
|
27
|
-
Ascii85 (1.0.2)
|
28
|
-
afm (0.2.0)
|
29
|
-
ffi (1.1.5)
|
30
|
-
hashery (2.1.0)
|
31
|
-
levenshtein-ffi (1.0.3)
|
32
|
-
ffi
|
33
|
-
ffi (~> 1.1.5)
|
34
|
-
mime-types (1.19)
|
35
|
-
mini_magick (3.4)
|
36
|
-
subexec (~> 0.2.1)
|
37
|
-
path (1.3.1)
|
38
|
-
pdf-reader (1.3.0)
|
39
|
-
Ascii85 (~> 1.0.0)
|
40
|
-
afm (~> 0.2.0)
|
41
|
-
hashery (~> 2.0)
|
42
|
-
ruby-rc4
|
43
|
-
ttfunk
|
44
|
-
prawn (0.12.0)
|
45
|
-
pdf-reader (>= 0.9.0)
|
46
|
-
ttfunk (~> 1.0.2)
|
47
|
-
ruby-progressbar (1.0.2)
|
48
|
-
ruby-rc4 (0.1.5)
|
49
|
-
rubyzip (0.9.9)
|
50
|
-
subexec (0.2.2)
|
51
|
-
term-ansicolor (1.0.7)
|
52
|
-
ttfunk (1.0.3)
|
53
|
-
|
54
|
-
PLATFORMS
|
55
|
-
ruby
|
56
|
-
|
57
|
-
DEPENDENCIES
|
58
|
-
storyboard!
|
59
|
-
suby!
|