subfinder 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8323b636f29cd3dded264d4aef54e1651cfd3df4
4
- data.tar.gz: 99728e0a71eb056c1fc9f4cde5e9b8e5a02ab474
2
+ SHA256:
3
+ metadata.gz: 9b2258bd01dc4ef23a2b5463d84088fd1be9a905087952d521c263d6e5d40afa
4
+ data.tar.gz: d28e29ee52b15e5d7f98c5909d20ee78afefafc8b33a268acf96e7311e8e5de7
5
5
  SHA512:
6
- metadata.gz: '059d0f14b7462abc97757a1b529e373fa8cd6fa018c6359fecef9edb133cd60ef1cddb8860c70cca0fd649db11852ae11c977dc4530e5c7dfed4a740c0f2f387'
7
- data.tar.gz: ea281d82d419298224f2d4943d5e09c366e75f814033cdc83fc55f2a5db76b9b90a68f3f79ef6c48a11dbaedd9754885907d25aac8517d600e37c7d83ad7aabe
6
+ metadata.gz: 21b615303289eea1f97611116c2bc97f82047ba9b7c45e8b043facf9523d4d3ca62088d8771c058e295888be604c3706e9638dcce01ef0cf1f5ba6688ac70594
7
+ data.tar.gz: 2ec5e654f7c6ebbb494c656cd3c07d2ac3a1cc9025f25cc9a8ede8ee1c734c82537610cfa6d163fcce3af983c9f1b89e20d888a41de21ea7164d7f3c661924d1
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
-
2
+ ruby "2.5.1"
3
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in subfinder.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- subfinder (0.0.1)
4
+ subfinder (0.0.2)
5
5
  colorize (~> 0.8)
6
6
  nokogiri (~> 1.10.1)
7
7
  rubyzip (~> 1.2.2)
@@ -16,29 +16,29 @@ GEM
16
16
  safe_yaml (~> 1.0.0)
17
17
  domain_name (0.5.20180417)
18
18
  unf (>= 0.0.5, < 1.0.0)
19
- hashdiff (0.3.8)
19
+ hashdiff (0.4.0)
20
20
  http-cookie (1.0.3)
21
21
  domain_name (~> 0.5)
22
22
  mime-types (2.99.3)
23
23
  mini_portile2 (2.4.0)
24
24
  minitest (5.11.3)
25
25
  netrc (0.11.0)
26
- nokogiri (1.10.1)
26
+ nokogiri (1.10.3)
27
27
  mini_portile2 (~> 2.4.0)
28
- power_assert (1.1.3)
29
- public_suffix (3.0.3)
28
+ power_assert (1.1.4)
29
+ public_suffix (3.1.0)
30
30
  rake (10.5.0)
31
31
  rest-client (1.8.0)
32
32
  http-cookie (>= 1.0.2, < 2.0)
33
33
  mime-types (>= 1.16, < 3.0)
34
34
  netrc (~> 0.7)
35
- rubyzip (1.2.2)
36
- safe_yaml (1.0.4)
35
+ rubyzip (1.2.3)
36
+ safe_yaml (1.0.5)
37
37
  test-unit (3.1.9)
38
38
  power_assert
39
39
  unf (0.1.4)
40
40
  unf_ext
41
- unf_ext (0.0.7.5)
41
+ unf_ext (0.0.7.6)
42
42
  vcr (4.0.0)
43
43
  webmock (3.5.1)
44
44
  addressable (>= 2.3.6)
@@ -49,7 +49,7 @@ PLATFORMS
49
49
  ruby
50
50
 
51
51
  DEPENDENCIES
52
- bundler (~> 1.16)
52
+ bundler (~> 2.0.1)
53
53
  minitest (~> 5.0)
54
54
  rake (~> 10.0)
55
55
  rest-client (~> 1.8.0)
@@ -58,5 +58,8 @@ DEPENDENCIES
58
58
  vcr (~> 4.0.0)
59
59
  webmock (~> 3.5.1)
60
60
 
61
+ RUBY VERSION
62
+ ruby 2.5.1p57
63
+
61
64
  BUNDLED WITH
62
- 1.17.3
65
+ 2.0.1
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
2
  [![CircleCI](https://circleci.com/gh/sizief/subfinder.svg?style=svg)](https://circleci.com/gh/sizief/subfinder) [![Maintainability](https://api.codeclimate.com/v1/badges/847c36c4319bef81de03/maintainability)](https://codeclimate.com/github/sizief/subfinder/maintainability)
3
+ [![Gem Version](https://badge.fury.io/rb/subfinder.svg)](https://badge.fury.io/rb/subfinder)
3
4
 
4
5
 
5
6
 
@@ -35,6 +36,8 @@ Then simply run:
35
36
 
36
37
  - Use `-u` or `--url` to specify a URL page of a TV series on `subscene.com` website.
37
38
 
39
+ - Also see `sunfinder -h` for help
40
+
38
41
 
39
42
 
40
43
 
@@ -44,7 +47,8 @@ Then simply run:
44
47
 
45
48
  To run tests, run `rake test`.
46
49
 
47
-
50
+
51
+ To see all logs, run with `-d` or `--degub`
48
52
 
49
53
 
50
54
  Clone the project. Make changes and then `rake build` inside the project folder to create Gem.
@@ -93,10 +97,10 @@ The gem is available as open source under the terms of the [MIT License](https:/
93
97
 
94
98
  - [x] check for internet connectivity or issue for accessing blocked websites
95
99
 
96
- - [ ] move all other files from sub folders to main folder when extracting
97
-
98
100
  - [ ] add all language codes
99
101
 
102
+ - [ ] move all other files from sub folders to main folder when extracting
103
+
100
104
  - [ ] add messages for timeout on web browsing
101
105
 
102
106
  - [ ] save user entered config for later use
@@ -32,7 +32,7 @@ module Subfinder
32
32
  usage = '
33
33
  Usage:
34
34
  subfinder [options]
35
- See https://github.com/sizief/subfinder for more information. Emm, nothing there really, just source code, if you want to improve the code or report a bug visit the page.
35
+ See https://github.com/sizief/subfinder for more information.
36
36
  '
37
37
  usage
38
38
  end
@@ -1,13 +1,15 @@
1
1
  module Subfinder
2
2
  class Subtitle
3
+
3
4
  def initialize
4
5
  @success = 0
5
6
  @failure = 0
6
7
  end
7
8
 
8
9
  def match
9
- Subfinder::Parser::Files.list.each do |video_file|
10
- next unless Subfinder::Config.video_formats.include? File.extname(video_file)
10
+ Parser::Files.list.each do |video_file|
11
+ # only consider video file types listed in confi
12
+ next unless Config.video_formats.include? File.extname(video_file)
11
13
  next if subtitle_exists? video_file
12
14
 
13
15
  if episode_number(video_file).nil?
@@ -28,16 +30,19 @@ module Subfinder
28
30
  end
29
31
 
30
32
  def subtitle_exists?(video_file)
31
- return true if Subfinder::Parser::Files.list.include? video_file.split('.')[0..-2].join('.') + '.srt'
33
+ subtitle_file_name = video_file.split('.')[0..-2].join('.') + '.srt'
34
+ if Parser::Files.list.include? subtitle_file_name
35
+ return true
36
+ end
32
37
  end
33
38
 
34
39
  def find_subtitle_for(video_file)
35
- subtitles = Subfinder::Parser::Files.list.select { |item| item[/#{episode_number(video_file)}/i] && item[/.srt/] }
40
+ subtitles = Parser::Files.list.select { |item| item[/#{episode_number(video_file)}/i] && item[/.srt/] }
36
41
  if subtitles.empty?
37
- Logger.info "Subtitle for #{File.basename(video_file)} is not exists on disk "
38
- subscene = Subfinder::Parser::Subscene.new(video_file)
42
+ Logger.info "Subtitle for #{File.basename(video_file)} is not exists on disk. Trying to download..."
43
+ subscene = Parser::Subscene.new(video_file)
39
44
  if !Config.url.nil? && subscene.get
40
- Subfinder::Parser::Files.prepare_file_list
45
+ Parser::Files.prepare_file_list
41
46
  Logger.info "Subtitle downloaded for #{File.basename(video_file)}"
42
47
  else
43
48
  Logger.info "Subtitle can not found on Subscene for #{File.basename(video_file)}".red
@@ -50,8 +55,12 @@ module Subfinder
50
55
  end
51
56
 
52
57
  def rename_subtitle(video_file)
53
- subtitles = Subfinder::Parser::Files.list.select { |item| item[/#{episode_number(video_file)}/i] && item[/.srt/] }
54
- File.rename(subtitles.first, File.dirname(subtitles.first) + '/' + File.basename(video_file).split('.')[0..-2].join('.') + '.srt')
58
+ subtitles = Parser::Files.list.select do
59
+ |item| item[/#{episode_number(video_file)}/i] && item[/.srt/]
60
+ end
61
+ video_name = File.basename(video_file).split('.')[0..-2].join('.')
62
+ subtitle_name = File.dirname(subtitles.first) + '/' + video_name + '.srt'
63
+ File.rename(subtitles.first, subtitle_name)
55
64
  Logger.info "Subtitle renamed for: #{File.basename(video_file)}"
56
65
  @success += 1
57
66
  end
@@ -1,3 +1,3 @@
1
1
  module Subfinder
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
data/subfinder.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ['sizief@gmail.com']
10
10
 
11
11
  spec.summary = 'Find or rename subtitle for your videos'
12
- spec.description = 'I would rename your current subtitle to amtch your video files or if it is not available then I would download it!'
12
+ spec.description = 'I would rename your current subtitle to match your video files or if it is not available then I would download it!'
13
13
  spec.homepage = 'https://github.com/sizief/subfinder'
14
14
  spec.license = 'MIT'
15
15
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.16'
25
+ spec.add_development_dependency 'bundler', '~> 2.0.1'
26
26
  spec.add_development_dependency 'minitest', '~> 5.0'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_runtime_dependency 'colorize', '~> 0.8'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subfinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sizief
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-26 00:00:00.000000000 Z
11
+ date: 2019-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.0.1
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 3.5.1
153
- description: I would rename your current subtitle to amtch your video files or if
153
+ description: I would rename your current subtitle to match your video files or if
154
154
  it is not available then I would download it!
155
155
  email:
156
156
  - sizief@gmail.com
@@ -207,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubyforge_project:
211
- rubygems_version: 2.5.2.3
210
+ rubygems_version: 3.0.3
212
211
  signing_key:
213
212
  specification_version: 4
214
213
  summary: Find or rename subtitle for your videos