legendario 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -17
- data/{get_all_subtitles.rb → bin/get_all_subtitles} +0 -0
- data/legendario.gemspec +1 -1
- data/lib/legendario/version.rb +1 -1
- metadata +4 -5
- data/legendario.log +0 -135
- data/legendario.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98628539a957070b5797122c28b6ddc98e2fa53e
|
4
|
+
data.tar.gz: 667b815ddb282b93d50d73d32588ffad6b72f666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5be8ae7e37e7323bce0e5dc88a227bc59d15561bc7e9a43c09fc4b2d48feda8cceb376005ad5f2ff2bfb4b9494277e21dc0e7e00b54ccd5e4c4a3497cf731ab3
|
7
|
+
data.tar.gz: e4768f95f6d07eaaa4015518e2ac2812c7ac6a9139a10c7c0e4df52baa6f740ebd427c7a8999f6acca81d2eb3883ed1f3e5b17771d196e383438c339899e874d
|
data/README.md
CHANGED
@@ -1,38 +1,36 @@
|
|
1
1
|
# Legendario
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/legendario.svg)](https://badge.fury.io/rb/legendario)
|
4
4
|
|
5
|
-
|
5
|
+
When a movie finishes downloading `Legendario` will search and download its subtitles automatically.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
9
|
|
11
|
-
|
12
|
-
gem 'legendario'
|
13
|
-
```
|
10
|
+
Install it yourself as:
|
14
11
|
|
15
|
-
|
12
|
+
$ gem install legendario
|
16
13
|
|
17
|
-
|
14
|
+
## Usage
|
18
15
|
|
19
|
-
Or install it yourself as:
|
20
16
|
|
21
|
-
|
17
|
+
Please, try:
|
22
18
|
|
23
|
-
|
19
|
+
$ legendario "folder-where-movies-will-land" eng por
|
20
|
+
|
21
|
+
for example.
|
24
22
|
|
25
|
-
|
23
|
+
Default languages are: eng por spa ger on this sequence of priority. [Sub language ISO 639-2](https://www.loc.gov/standards/iso639-2/php/code_list.php) code like fre or eng.
|
26
24
|
|
27
|
-
|
25
|
+
Edit your rc.local file to start legendario after boot
|
28
26
|
|
29
|
-
|
27
|
+
su (username) -lc "legendario folder-where-movies-will-land subs-langs"
|
30
28
|
|
31
|
-
|
29
|
+
Example
|
30
|
+
`su evandro -lc "legendario /home/evandro/Downloads por spa"`
|
32
31
|
|
33
|
-
## Contributing
|
34
32
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/evandrojr/legendario. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
34
|
|
37
35
|
|
38
36
|
## License
|
File without changes
|
data/legendario.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
25
|
spec.bindir = "bin"
|
26
|
-
spec.executables = ["legendario"]
|
26
|
+
spec.executables = ["legendario", "get_all_subtitles"]
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.10"
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/legendario/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legendario
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evandro Junior
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,6 +99,7 @@ email:
|
|
99
99
|
- evandrojr@gmail.com
|
100
100
|
executables:
|
101
101
|
- legendario
|
102
|
+
- get_all_subtitles
|
102
103
|
extensions: []
|
103
104
|
extra_rdoc_files: []
|
104
105
|
files:
|
@@ -112,12 +113,10 @@ files:
|
|
112
113
|
- README.md
|
113
114
|
- Rakefile
|
114
115
|
- bin/console
|
116
|
+
- bin/get_all_subtitles
|
115
117
|
- bin/legendario
|
116
118
|
- bin/setup
|
117
|
-
- get_all_subtitles.rb
|
118
119
|
- legendario.gemspec
|
119
|
-
- legendario.log
|
120
|
-
- legendario.rb
|
121
120
|
- lib/legendario.rb
|
122
121
|
- lib/legendario/version.rb
|
123
122
|
homepage: https://github.com/evandrojr/legendario
|
data/legendario.log
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
ERROR legendario.log : A folder must be defined for watching
|
2
|
-
ERROR legendario.log : A folder must be defined for watching
|
3
|
-
INFO legendario.log : Will look for subtitles on these languages:
|
4
|
-
INFO legendario.log : ["eng", "por", "spa", "ger"]
|
5
|
-
INFO legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv] .avi
|
6
|
-
INFO legendario.log : Language: eng
|
7
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
8
|
-
|
9
|
-
Something crashed.
|
10
|
-
Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues
|
11
|
-
With the following debug informations:
|
12
|
-
|
13
|
-
Errno::ENOENT: No such file or directory @ rb_file_s_size - /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv] .avi:
|
14
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `size'
|
15
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `compute_hash'
|
16
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:29:in `hash'
|
17
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/search/movie_hash.rb:12:in `search_subs_for'
|
18
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:13:in `block in find_sub_for'
|
19
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `each'
|
20
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `find_sub_for'
|
21
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:62:in `block in run!'
|
22
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `each'
|
23
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `run!'
|
24
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:157:in `<top (required)>'
|
25
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `load'
|
26
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `<main>'
|
27
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
|
28
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
|
29
|
-
|
30
|
-
0
|
31
|
-
INFO legendario.log : Language: por
|
32
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
33
|
-
|
34
|
-
Something crashed.
|
35
|
-
Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues
|
36
|
-
With the following debug informations:
|
37
|
-
|
38
|
-
Errno::ENOENT: No such file or directory @ rb_file_s_size - /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv] .avi:
|
39
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `size'
|
40
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `compute_hash'
|
41
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:29:in `hash'
|
42
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/search/movie_hash.rb:12:in `search_subs_for'
|
43
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:13:in `block in find_sub_for'
|
44
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `each'
|
45
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `find_sub_for'
|
46
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:62:in `block in run!'
|
47
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `each'
|
48
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `run!'
|
49
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:157:in `<top (required)>'
|
50
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `load'
|
51
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `<main>'
|
52
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
|
53
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
|
54
|
-
|
55
|
-
0
|
56
|
-
INFO legendario.log : Language: spa
|
57
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
58
|
-
|
59
|
-
Something crashed.
|
60
|
-
Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues
|
61
|
-
With the following debug informations:
|
62
|
-
|
63
|
-
Errno::ENOENT: No such file or directory @ rb_file_s_size - /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv] .avi:
|
64
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `size'
|
65
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `compute_hash'
|
66
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:29:in `hash'
|
67
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/search/movie_hash.rb:12:in `search_subs_for'
|
68
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:13:in `block in find_sub_for'
|
69
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `each'
|
70
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `find_sub_for'
|
71
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:62:in `block in run!'
|
72
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `each'
|
73
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `run!'
|
74
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:157:in `<top (required)>'
|
75
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `load'
|
76
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `<main>'
|
77
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
|
78
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
|
79
|
-
|
80
|
-
0
|
81
|
-
INFO legendario.log : Language: ger
|
82
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
83
|
-
|
84
|
-
Something crashed.
|
85
|
-
Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues
|
86
|
-
With the following debug informations:
|
87
|
-
|
88
|
-
Errno::ENOENT: No such file or directory @ rb_file_s_size - /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv] .avi:
|
89
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `size'
|
90
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:44:in `compute_hash'
|
91
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/movie_file.rb:29:in `hash'
|
92
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/search/movie_hash.rb:12:in `search_subs_for'
|
93
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:13:in `block in find_sub_for'
|
94
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `each'
|
95
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/lib/osdb/subtitle_finder.rb:12:in `find_sub_for'
|
96
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:62:in `block in run!'
|
97
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `each'
|
98
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:53:in `run!'
|
99
|
-
/home/j/.rvm/gems/ruby-2.2.2/gems/osdb-0.2.1/bin/getsub:157:in `<top (required)>'
|
100
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `load'
|
101
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/getsub:23:in `<main>'
|
102
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
|
103
|
-
/home/j/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
|
104
|
-
|
105
|
-
0
|
106
|
-
INFO legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].avi
|
107
|
-
INFO legendario.log : Language: eng
|
108
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
109
|
-
* download http://dl.opensubtitles.org/en/download/filead/src-api/vrf-19e30c5f/sid-hpbo2h84dqb03or3fh4p67dp65/1954971828.gz to /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].eng.srt ... done
|
110
|
-
|
111
|
-
0
|
112
|
-
INFO legendario.log : Language: por
|
113
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
114
|
-
* download http://dl.opensubtitles.org/en/download/filead/src-api/vrf-19da0c58/sid-p38gl0gf545h1bdtd6qafilth5/1954971803.gz to /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].por.srt ... done
|
115
|
-
|
116
|
-
0
|
117
|
-
INFO legendario.log : Language: spa
|
118
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
119
|
-
* download http://dl.opensubtitles.org/en/download/filead/src-api/vrf-19da0c59/sid-bh05u7qcash204slbaphm5hd74/1954972524.gz to /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].spa.srt ... done
|
120
|
-
|
121
|
-
0
|
122
|
-
INFO legendario.log : Language: ger
|
123
|
-
DEBUG legendario.log : * Search subtitles for Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]
|
124
|
-
* No sub found
|
125
|
-
|
126
|
-
0
|
127
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].eng.srt
|
128
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].srt
|
129
|
-
DEBUG legendario.log : 0
|
130
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].por.srt
|
131
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].srt
|
132
|
-
DEBUG legendario.log : 256
|
133
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].spa.srt
|
134
|
-
DEBUG legendario.log : /home/j/Downloads/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv]/Marvels.Jessica.Jones.S01E02.WEBRip.XviD-FUM[ettv].srt
|
135
|
-
DEBUG legendario.log : 256
|
data/legendario.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'awesome_print'
|
6
|
-
require 'file-monitor'
|
7
|
-
require 'find'
|
8
|
-
|
9
|
-
lib_dir = File.join File.dirname(__FILE__), '../lib'
|
10
|
-
$:.unshift lib_dir unless $:.include? lib_dir
|
11
|
-
|
12
|
-
class Legendario
|
13
|
-
@dir = ""
|
14
|
-
def lang
|
15
|
-
["eng", "por", "spa", "ger"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.watch
|
19
|
-
Legendario.new.watch_dirs(@dir)
|
20
|
-
end
|
21
|
-
|
22
|
-
def se(command)
|
23
|
-
puts command
|
24
|
-
o = `#{command}`
|
25
|
-
r = $?.to_i
|
26
|
-
puts "#{o} #{r}"
|
27
|
-
r
|
28
|
-
end
|
29
|
-
|
30
|
-
def download_subs(file)
|
31
|
-
lang().each do |l|
|
32
|
-
puts "Language: #{l}"
|
33
|
-
se("getsub -aLl #{l} \"#{file}\"")
|
34
|
-
end
|
35
|
-
symlink(File.dirname(file))
|
36
|
-
end
|
37
|
-
|
38
|
-
def symlink(dir)
|
39
|
-
Find.find(dir) do |path|
|
40
|
-
if FileTest.directory?(path)
|
41
|
-
if File.basename(path)[0] == ?.
|
42
|
-
Find.prune # Don't look any further into this directory.
|
43
|
-
else
|
44
|
-
next
|
45
|
-
end
|
46
|
-
else
|
47
|
-
if FileTest.symlink?(path)
|
48
|
-
se("rm \"#{path}\"")
|
49
|
-
end
|
50
|
-
symlinked = false
|
51
|
-
lang().each do |l|
|
52
|
-
if /\.#{l}\.srt$/i =~ File.basename(path) and !symlinked
|
53
|
-
puts path
|
54
|
-
link = path.sub(/\.#{l}\.srt$/i, '.srt')
|
55
|
-
puts link
|
56
|
-
symlinked = true
|
57
|
-
se("ln -s \"#{path}\" \"#{link}\"")
|
58
|
-
break #this break is not working so using !symlinked
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def watch_dirs(dir)
|
66
|
-
FileMonitor.watch dir do
|
67
|
-
dirs {
|
68
|
-
disallow /\.git$/
|
69
|
-
}
|
70
|
-
|
71
|
-
files {
|
72
|
-
disallow /.*/
|
73
|
-
allow /\.mkv$|\.mp4$|\.avi$/
|
74
|
-
}
|
75
|
-
begin
|
76
|
-
exec do |events|
|
77
|
-
events.each do |ev|
|
78
|
-
file = File.join(ev.watcher.path(), ev.name())
|
79
|
-
puts file
|
80
|
-
Legendario.new.download_subs(file)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
#Avoids breaking after a directory been deleted
|
84
|
-
rescue => error
|
85
|
-
puts("#{error.class} and #{error.message}")
|
86
|
-
Legendario.watch
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
Legendario.watch
|