storyboard 0.2.3 → 0.2.4

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.
data/Gemfile CHANGED
@@ -2,9 +2,11 @@ source :rubygems
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'tvdb_party', :git => 'https://github.com/nddrylliog/tvdb_party'
5
6
  gem 'nokogiri'
6
7
  gem 'suby', :path => 'vendor/suby', :require => 'suby'
7
8
  gem 'rmagick'
8
9
  gem 'prawn'
9
10
  gem 'ruby-progressbar'
10
11
  gem 'rubyzip'
12
+ gem 'levenshtein-ffi', :require => 'levenshtein'
data/Gemfile.lock CHANGED
@@ -1,30 +1,50 @@
1
1
  GIT
2
- remote: http://github.com/markolson/suby
3
- revision: f44e9821f0f6ff07d2729a3a0b3abc386861b9e9
2
+ remote: https://github.com/nddrylliog/tvdb_party
3
+ revision: 60ce3c28e664078da0206075e025ee06547f5826
4
4
  specs:
5
- suby (0.4.0)
5
+ tvdb_party (0.6.2)
6
+ httparty (>= 0.6.1)
7
+
8
+ PATH
9
+ remote: .
10
+ specs:
11
+ storyboard (0.2.3)
12
+ levenshtein-ffi
6
13
  mime-types (>= 1.19)
7
14
  nokogiri
8
15
  path (>= 1.3.0)
16
+ prawn
17
+ rmagick
18
+ ruby-progressbar
9
19
  rubyzip
10
20
  term-ansicolor
11
21
 
12
22
  PATH
13
- remote: .
23
+ remote: vendor/suby
14
24
  specs:
15
- Storyboard (0.1.1)
25
+ suby (0.4.0)
26
+ mime-types (>= 1.19)
16
27
  nokogiri
17
- prawn
18
- rmagick
19
- ruby-progressbar
28
+ path (>= 1.3.0)
29
+ rubyzip
30
+ term-ansicolor
20
31
 
21
32
  GEM
22
33
  remote: http://rubygems.org/
23
34
  specs:
24
35
  Ascii85 (1.0.2)
25
36
  afm (0.2.0)
37
+ ffi (1.1.5)
26
38
  hashery (2.1.0)
39
+ httparty (0.10.0)
40
+ multi_json (~> 1.0)
41
+ multi_xml
42
+ levenshtein-ffi (1.0.3)
43
+ ffi
44
+ ffi (~> 1.1.5)
27
45
  mime-types (1.19)
46
+ multi_json (1.5.0)
47
+ multi_xml (0.5.2)
28
48
  nokogiri (1.5.6)
29
49
  path (1.3.1)
30
50
  pdf-reader (1.3.0)
@@ -47,9 +67,12 @@ PLATFORMS
47
67
  ruby
48
68
 
49
69
  DEPENDENCIES
50
- Storyboard!
70
+ levenshtein-ffi
51
71
  nokogiri
52
72
  prawn
53
73
  rmagick
54
74
  ruby-progressbar
75
+ rubyzip
76
+ storyboard!
55
77
  suby!
78
+ tvdb_party!
data/README.md CHANGED
@@ -4,6 +4,8 @@ Read the TV and Movies you don't have time to watch.
4
4
 
5
5
  ## Storyboard
6
6
 
7
+ ![Seinfeld](http://i.imgur.com/lTRuC.jpg)
8
+
7
9
  Storyboard is _very much_ a work in progress, and only works (most of) some of the time. Using it is simple:
8
10
 
9
11
  storyboard /path/to/video-file.mkv
@@ -29,11 +31,12 @@ Storyboard requires a recent version of *ffmpeg*. This gem includes a build of *
29
31
 
30
32
  * If there is a scene change followed by dialog in the next frame or two, the dialog may not be shown.
31
33
  * Subtitles are always downloaded, never extracted from video files. Because the subtitles are searched for based on the filename it's best that you have then named in a standard format, e.g., `The X-Files - 1x21 - Tooms.avi`.
32
- * Sometimes the wrong subtitle file will be returned from the site. In those cases, download it manually and use the `-s` option to pass in the path to an SRT formatted subtitle file.
33
- * Some subtitles are encoded in UTF-16, and I haven't care quite enough yet to get them to work.
34
+ * Sometimes the wrong subtitle file will be returned from the site. In those cases, download it manually and use the `-s` option to pass in the path to an SRT formatted subtitle file. This is because the data lies, and there's nothing I can do about it.
35
+ * Some subtitles are encoded in UTF-16, and I haven't care quite enough yet to get them to work. Others use bad UTF8.
34
36
  * The subtitles are uuuuuugly.
35
37
  * Hardcoding 8 for the number of threads is a bad idea
36
38
  * Almost definitely some path-escaping issues, so avoid files with apostrophes and slashes
39
+ * Some subtitles put all the text on one line, so that has to get broken up.
37
40
 
38
41
  ## Help
39
42
 
Binary file
@@ -1,3 +1,3 @@
1
1
  class Storyboard
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/storyboard.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.summary = %q{Video to PDF/ePub generator}
8
8
  gem.homepage = "http://github.com/markolson/storyboard"
9
9
 
10
- gem.required_ruby_version = '>= 1.9.2'
10
+ gem.required_ruby_version = '>= 1.9.3'
11
11
 
12
12
  gem.files = `git ls-files`.split($\) if File.exist?('.git')
13
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -20,16 +20,15 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'rmagick'
21
21
  gem.add_dependency 'prawn'
22
22
  gem.add_dependency 'ruby-progressbar'
23
+ gem.add_dependency 'levenshtein-ffi'
23
24
 
24
25
  # suby stuff.
25
26
  gem.add_dependency 'path', '>= 1.3.0'
26
- gem.add_dependency 'nokogiri'
27
27
  gem.add_dependency 'rubyzip'
28
28
  gem.add_dependency 'term-ansicolor'
29
29
  gem.add_dependency 'mime-types', '>= 1.19'
30
30
 
31
31
  if File.exist?('.git')
32
- p "RUNNING"
33
32
  `git submodule --quiet foreach 'echo $path'`.split($\).each do |submodule_path|
34
33
  # for each submodule, change working directory to that submodule
35
34
  Dir.chdir(submodule_path) do
@@ -1,3 +1,6 @@
1
+ require 'json'
2
+ require 'levenshtein'
3
+
1
4
  module Suby
2
5
  # Based on https://github.com/byroot/ruby-osdb/blob/master/lib/osdb/server.rb
3
6
  class Downloader::OpenSubtitles < Downloader
@@ -28,12 +31,27 @@ module Suby
28
31
  LANG_MAPPING.default = 'all'
29
32
 
30
33
  def download_url
31
- SEARCH_QUERIES_ORDER.find(lambda { raise NotFoundError, "no subtitles available" }) { |type|
34
+ s = SEARCH_QUERIES_ORDER.find(lambda { raise NotFoundError, "no subtitles available" }) { |type|
32
35
  if subs = search_subtitles(search_query(type))['data']
33
36
  @type = type
34
37
  break subs
35
38
  end
36
- }.first['SubDownloadLink']
39
+ }
40
+ x = s.select { |t| t['SeriesSeason'].to_i == @video_data[:season].to_i } if @video_data[:season]
41
+ x.each {|t|
42
+ puts t['MovieName'] + '/' + "\"#{@video_data[:show]}\" #{@video_data[:title]}" + " - " + Levenshtein.distance(t['MovieName'], "\"#{@video_data[:show]}\" #{@video_data[:title]}").to_i.to_s
43
+ }
44
+ x.sort_by! { |t| Levenshtein.distance(t['MovieName'], "\"#{@video_data[:show]}\" #{@video_data[:title]}").to_i }
45
+ p "|||||||||||||||"
46
+ x.each {|t|
47
+ puts t['MovieName'] + '/' + "\"#{@video_data[:show]}\" #{@video_data[:title]}" + " - " + Levenshtein.distance(t['MovieName'], "\"#{@video_data[:show]}\" #{@video_data[:title]}").to_i.to_s
48
+ }
49
+
50
+ p "======"
51
+ p x.first
52
+ p x.last
53
+ p "-------"
54
+ x.first['SubDownloadLink']
37
55
  end
38
56
 
39
57
  def search_subtitles(query)
@@ -11,7 +11,7 @@ module Suby
11
11
  [Ss](?<season>[0-9]{2})
12
12
  [\.\- ]?
13
13
  (?<episode>[0-9]{2})
14
- [^0-9]*$/x,
14
+ (?<title>[^0-9]*)$/x,
15
15
 
16
16
  # foo.1x09*
17
17
  /^(?<show>.+?)
@@ -21,7 +21,8 @@ module Suby
21
21
  [xX]
22
22
  (?<episode>[0-9]+)
23
23
  \]?
24
- [^\/]*$/x,
24
+ [ \._\-]*
25
+ (?<title>[^\/]*)$/x,
25
26
 
26
27
  # foo.s01.e01, foo.s01_e01
27
28
  /^(?<show>.+?)
@@ -30,7 +31,8 @@ module Suby
30
31
  [Ss](?<season>[0-9]+)[\. _-]?
31
32
  [Ee]?(?<episode>[0-9]+)
32
33
  \]?
33
- [^\/]*$/x,
34
+ [ \._\-]*
35
+ (?<title>[^\/]*)$/x,
34
36
 
35
37
  # foo - [01.09]
36
38
  /^(?<show>.+?)
@@ -41,14 +43,14 @@ module Suby
41
43
  (?<episode>[0-9]+?)
42
44
  \]
43
45
  [ \._\-]?
44
- [^\/]*$/x,
46
+ (?<title>[^\/]*)$/x,
45
47
 
46
48
  # Foo - S2 E 02 - etc
47
49
  /^(?<show>.+?)
48
50
  [ ]?[ \._\-][ ]?
49
51
  [Ss](?<season>[0-9]+)[\.\- ]?
50
52
  [Ee]?[ ]?(?<episode>[0-9]+)
51
- [^\/]*$/x,
53
+ (?<title>[^\/]*)$/x,
52
54
 
53
55
  # Show - Episode 9999 [S 12 - Ep 131] - etc
54
56
  /(?<show>.+)
@@ -60,22 +62,22 @@ module Suby
60
62
  ([ ]|[ ]-[ ]|-)
61
63
  ([eE]|[eE]p)[ ]?(?<episode>\d+)
62
64
  \]
63
- .*$/x,
65
+ (?<title>.*)$/x,
64
66
 
65
67
  # foo.103*
66
68
  /^(?<show>.+)
67
69
  [ \._\-]
68
70
  (?<season>[0-9]{1})
69
71
  (?<episode>[0-9]{2})
70
- [\._ -][^\/]*$/x,
72
+ (?<title>[\._ -][^\/]*)$/x,
71
73
  ]
72
74
  MOVIE_PATTERN = /^(?<movie>.*)[.\[( ](?<year>(?:19|20)\d{2})/
73
75
 
74
76
  def parse(file)
75
- filename = file.basename.to_s
77
+ filename = File.basename(file, ".*")
76
78
  if TVSHOW_PATTERNS.find { |pattern| pattern.match(filename) }
77
79
  m = $~
78
- { type: :tvshow, show: clean_show_name(m[:show]), season: m[:season].to_i, episode: m[:episode].to_i }
80
+ { type: :tvshow, show: clean_show_name(m[:show]), season: m[:season].to_i, episode: m[:episode].to_i, title: m[:title] }
79
81
  elsif m = MOVIE_PATTERN.match(filename)
80
82
  { type: :movie, name: clean_show_name(m[:movie]), year: m[:year].to_i }
81
83
  else
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.2.3
4
+ version: 0.2.4
5
5
  prerelease:
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-01-13 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -76,13 +76,13 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: path
79
+ name: levenshtein-ffi
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: 1.3.0
85
+ version: '0'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,15 +90,15 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: 1.3.0
93
+ version: '0'
94
94
  - !ruby/object:Gem::Dependency
95
- name: nokogiri
95
+ name: path
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: 1.3.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 1.3.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: rubyzip
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,6 @@ extensions: []
165
165
  extra_rdoc_files: []
166
166
  files:
167
167
  - .gitignore
168
- - .gitmodules
169
168
  - .rvmrc
170
169
  - Gemfile
171
170
  - Gemfile.lock
@@ -216,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
215
  requirements:
217
216
  - - ! '>='
218
217
  - !ruby/object:Gem::Version
219
- version: 1.9.2
218
+ version: 1.9.3
220
219
  required_rubygems_version: !ruby/object:Gem::Requirement
221
220
  none: false
222
221
  requirements:
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "vendor/suby"]
2
- path = vendor/suby
3
- url = http://github.com/markolson/suby