layback 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +11 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +71 -0
- data/Rakefile +6 -0
- data/bin/console +15 -0
- data/bin/crawl4subs +32 -0
- data/bin/lang4subs +32 -0
- data/bin/setup +7 -0
- data/bin/watch4subs +38 -0
- data/layback.gemspec +34 -0
- data/lib/crawler.rb +43 -0
- data/lib/language.rb +39 -0
- data/lib/layback/version.rb +3 -0
- data/lib/os.rb +57 -0
- data/lib/settings.rb +8 -0
- data/lib/sl.rb +23 -0
- data/lib/watcher.rb +35 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b6449e3778fbd3998055e8414d35b16c56618a06
|
4
|
+
data.tar.gz: d73076306e178c9599c6ddd4b9a8043ddbe80e57
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4cd3693502b8b06a437ab15065e74033d7891af5bbe84064e37c38d68000a48f1e3e835c66e80821c697874fcea1161684c78a94975c736f09ae4cffaf6dd45
|
7
|
+
data.tar.gz: e3dd4af2d508466a7208328d927a18d66716602da7905bd9d75128a5037d44e8d3f2f894b51b9245481794cc1fb39d7a373ada759392a9dde6bfd906d47e9fed
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gem "file-monitor", "~> 0.1"
|
3
|
+
gem "awesome_print", "~> 1.6"
|
4
|
+
gem "logging", "~> 2.0"
|
5
|
+
gem "rake"
|
6
|
+
gem "rspec"
|
7
|
+
gem "osdb", :git => 'https://github.com/evandrojr/ruby-osdb.git'
|
8
|
+
#Specify your gem's dependencies in layback.gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Evandro Junior
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Layback RubyGem
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/evandrojr/layback.png)](http://travis-ci.org/evandrojr/layback)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/layback.svg)](https://badge.fury.io/rb/layback)
|
5
|
+
|
6
|
+
When a movie finishes downloading `Layback` will search and download its subtitles automatically.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
I don't know the reason for it, but installing the gem using sudo it not working. So I recommend you install RVM or rbenv in advance and then install layback with a non privileved user like yourself.
|
11
|
+
|
12
|
+
see [RVM installtion](https://rvm.io/rvm/install)
|
13
|
+
|
14
|
+
or [rbenv](https://github.com/rbenv/rbenv)
|
15
|
+
|
16
|
+
Then install Layback yourself as:
|
17
|
+
|
18
|
+
$ gem install layback
|
19
|
+
|
20
|
+
|
21
|
+
## Tools
|
22
|
+
|
23
|
+
There are 3 tools at the moment:
|
24
|
+
|
25
|
+
crawl4subs: Will download the subtitles of the movies
|
26
|
+
inside a parent folder recursively.
|
27
|
+
|
28
|
+
watch4subs: Watches a folder for new movies and downloads the subtitles as soon
|
29
|
+
as the movie finishes downloading.
|
30
|
+
|
31
|
+
lang4subs: Change the default language of
|
32
|
+
all the movies in a parent folder recursively.
|
33
|
+
|
34
|
+
|
35
|
+
In case you are a polyglot you can pass as many languages as you like as parameters. The first language available for the movie will be set as the default language for the movie.
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
### Download subtitles in English and Portuguese for all the movies
|
40
|
+
|
41
|
+
$ crawl4subs "folder-with-movies" pob eng por
|
42
|
+
|
43
|
+
for example.
|
44
|
+
|
45
|
+
Default languages are: eng por spa ger on this sequence of priority. [Sub language ISO 639-2](https://github.com/byroot/ruby-osdb/blob/master/lib/osdb/language.rb) code like pob (Brazilian Portuguese), fre or eng.
|
46
|
+
|
47
|
+
### Lay back and let watch4subs do all the work for you. As soon a new movie arrives it will download the subtitles for it.
|
48
|
+
|
49
|
+
Edit your rc.local file to start watch4subs after boot
|
50
|
+
|
51
|
+
su (username) -lc "watch4subs folder-with-movies subs-langs"
|
52
|
+
|
53
|
+
Example
|
54
|
+
`su evandro -lc "watch4subs ~/Downloads pob por spa"`
|
55
|
+
|
56
|
+
|
57
|
+
### Change the languages of the subtitles
|
58
|
+
|
59
|
+
$ lang4subs "folder-with-movies" spa por
|
60
|
+
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/evandrojr/layback. 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.
|
63
|
+
|
64
|
+
|
65
|
+
## License
|
66
|
+
|
67
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
68
|
+
|
69
|
+
## Thanks
|
70
|
+
|
71
|
+
### Subtitles service powered by www.OpenSubtitles.org
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "bundler/setup"
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'layback'
|
5
|
+
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start
|
data/bin/crawl4subs
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'crawler'
|
5
|
+
require 'settings'
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
Sl.error 'The parent folder that will have the language changed is mandatory'
|
9
|
+
puts ''
|
10
|
+
puts 'Please, try something like: '
|
11
|
+
puts ''
|
12
|
+
puts 'crawl4subs "foldername" eng por '
|
13
|
+
puts ''
|
14
|
+
puts 'for example.'
|
15
|
+
puts ''
|
16
|
+
puts 'Default languages are: eng por spa ger on this sequence of priority'
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
Settings.dir = ARGV[0]
|
21
|
+
langs = ["eng", "por", "spa", "ger"]
|
22
|
+
langs = [] if ARGV.size > 1
|
23
|
+
c = 0
|
24
|
+
ARGV.each do|lang|
|
25
|
+
langs << lang if c > 0
|
26
|
+
c+=1
|
27
|
+
end
|
28
|
+
Settings.langs = langs
|
29
|
+
Sl.info "The first language found will be set to the subtitle file"
|
30
|
+
Sl.info Settings.langs.join(" ")
|
31
|
+
|
32
|
+
Layback::Crawler.new.crawl
|
data/bin/lang4subs
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'language'
|
5
|
+
require 'settings'
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
Sl.error 'The parent folder that will have the language changed is mandatory'
|
9
|
+
puts ''
|
10
|
+
puts 'Please, try something like: '
|
11
|
+
puts ''
|
12
|
+
puts 'lang4subs "foldername" eng por '
|
13
|
+
puts ''
|
14
|
+
puts 'for example.'
|
15
|
+
puts ''
|
16
|
+
puts 'Default languages are: eng por spa ger on this sequence of priority'
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
Settings.dir = ARGV[0]
|
21
|
+
langs = ["eng", "por", "spa", "ger"]
|
22
|
+
langs = [] if ARGV.size > 1
|
23
|
+
c = 0
|
24
|
+
ARGV.each do|lang|
|
25
|
+
langs << lang if c > 0
|
26
|
+
c+=1
|
27
|
+
end
|
28
|
+
Settings.langs = langs
|
29
|
+
Sl.info "The first language found will be set as Language for the movie"
|
30
|
+
Sl.info Settings.langs.join(" ")
|
31
|
+
|
32
|
+
Layback::Language.new.set_lang
|
data/bin/setup
ADDED
data/bin/watch4subs
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'watcher'
|
5
|
+
require 'settings'
|
6
|
+
|
7
|
+
if ARGV.size == 0
|
8
|
+
Sl.error 'The folder that will be watched for new movies should be defined'
|
9
|
+
puts ''
|
10
|
+
puts 'Please, try something like: '
|
11
|
+
puts ''
|
12
|
+
puts 'layback "foldername" eng por '
|
13
|
+
puts ''
|
14
|
+
puts 'for example.'
|
15
|
+
puts ''
|
16
|
+
puts 'Default languages are: eng por spa ger on this sequence of priority'
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
Settings.dir = ARGV[0]
|
21
|
+
langs = ["pob", "eng", "por", "spa", "ger"]
|
22
|
+
langs = [] if ARGV.size > 1
|
23
|
+
c = 0
|
24
|
+
ARGV.each do|lang|
|
25
|
+
langs << lang if c > 0
|
26
|
+
c+=1
|
27
|
+
end
|
28
|
+
Settings.langs = langs
|
29
|
+
Sl.info "Will look for subtitles on these languages: "
|
30
|
+
Sl.info Settings.langs.join(" ")
|
31
|
+
|
32
|
+
100.times do
|
33
|
+
begin
|
34
|
+
Layback::Watcher.new.watch_dirs
|
35
|
+
rescue => error
|
36
|
+
Sl.error error.inspect
|
37
|
+
end
|
38
|
+
end
|
data/layback.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'layback/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "layback"
|
8
|
+
spec.version = Layback::VERSION
|
9
|
+
spec.authors = ["Evandro Junior"]
|
10
|
+
spec.email = ["evandrojr@gmail.com"]
|
11
|
+
spec.summary = %q{Subtitles downloader on demand.}
|
12
|
+
spec.description = %q{The script downloads subtitles when a new movie is put to a defined folder.}
|
13
|
+
spec.homepage = "https://github.com/evandrojr/layback"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "bin"
|
26
|
+
spec.executables = ["watch4subs", "crawl4subs", "lang4subs"]
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_runtime_dependency "file-monitor", "~> 0.1"
|
31
|
+
spec.add_runtime_dependency "osdb"
|
32
|
+
spec.add_runtime_dependency "awesome_print", "~> 1.6"
|
33
|
+
spec.add_runtime_dependency "logging", "~> 2.0"
|
34
|
+
end
|
data/lib/crawler.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'find'
|
3
|
+
require 'sl'
|
4
|
+
require 'settings'
|
5
|
+
require 'os'
|
6
|
+
|
7
|
+
module Layback
|
8
|
+
|
9
|
+
class Crawler
|
10
|
+
|
11
|
+
def crawl
|
12
|
+
default_changed = 0
|
13
|
+
Find.find(Settings.dir) do |path|
|
14
|
+
leave = false
|
15
|
+
if FileTest.directory?(path)
|
16
|
+
if File.basename(path)[0] == ?.
|
17
|
+
Find.prune # Don't look any further into this directory.
|
18
|
+
else
|
19
|
+
next
|
20
|
+
end
|
21
|
+
else
|
22
|
+
if /\.mkv$|\.mp4$|\.avi$/i =~ path
|
23
|
+
Settings.langs.each do |lang|
|
24
|
+
Sl.info "Downloading #{File.basename(path)} on #{lang}"
|
25
|
+
Os.download_subs(path)
|
26
|
+
end
|
27
|
+
Settings.langs.each do |lang|
|
28
|
+
Os.delete_video_default_subtitle(path) if Os.check_for_sub(path, lang)
|
29
|
+
# Will to it just for the 1st time
|
30
|
+
if Os.make_default_subtitle(path, lang)
|
31
|
+
Sl.info "Setting #{File.basename(path)} to #{lang}"
|
32
|
+
default_changed += 1
|
33
|
+
break
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
Sl.info "#{default_changed} movie's language changed"
|
40
|
+
end
|
41
|
+
|
42
|
+
end # class
|
43
|
+
end # module
|
data/lib/language.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'find'
|
3
|
+
require 'sl'
|
4
|
+
require 'settings'
|
5
|
+
require 'os'
|
6
|
+
|
7
|
+
module Layback
|
8
|
+
|
9
|
+
class Language
|
10
|
+
|
11
|
+
def set_lang
|
12
|
+
default_changed = 0
|
13
|
+
Find.find(Settings.dir) do |path|
|
14
|
+
leave = false
|
15
|
+
if FileTest.directory?(path)
|
16
|
+
if File.basename(path)[0] == ?.
|
17
|
+
Find.prune # Don't look any further into this directory.
|
18
|
+
else
|
19
|
+
next
|
20
|
+
end
|
21
|
+
else
|
22
|
+
if /\.mkv$|\.mp4$|\.avi$/i =~ path
|
23
|
+
Settings.langs.each do |lang|
|
24
|
+
Os.delete_video_default_subtitle(path) if Os.check_for_sub(path, lang)
|
25
|
+
# Will to it just for the 1st time
|
26
|
+
if Os.make_default_subtitle(path, lang)
|
27
|
+
Sl.info "Setting #{File.basename(path)} to #{lang}"
|
28
|
+
default_changed += 1
|
29
|
+
break
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
Sl.info "#{default_changed} movie's language changed"
|
36
|
+
end
|
37
|
+
|
38
|
+
end # class
|
39
|
+
end # module
|
data/lib/os.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
class Os
|
4
|
+
|
5
|
+
class << self
|
6
|
+
include FileUtils
|
7
|
+
|
8
|
+
def default_movie_subtitle(path)
|
9
|
+
path.sub(/#{File.extname(path)}$/i, '.srt')
|
10
|
+
end
|
11
|
+
|
12
|
+
# Receives the path of a movie file and deletes its subtitle
|
13
|
+
def delete_video_default_subtitle(path)
|
14
|
+
subtitle_file = default_movie_subtitle(path)
|
15
|
+
rm(subtitle_file) if File.exist?(subtitle_file)
|
16
|
+
end
|
17
|
+
|
18
|
+
def make_default_subtitle(path, lang)
|
19
|
+
# path = /tmp/a.avi
|
20
|
+
# lang = por
|
21
|
+
# /tmp/a.por.srt
|
22
|
+
default_sub = default_movie_subtitle(path)
|
23
|
+
specific_sub = path.sub(/#{File.extname(path)}$/i, ".#{lang}.srt")
|
24
|
+
if File.exist?(specific_sub) and !File.exist?(default_sub)
|
25
|
+
Sl.info "cp #{File.basename(specific_sub)} to #{File.basename(default_sub)}"
|
26
|
+
cp specific_sub, default_sub
|
27
|
+
return true
|
28
|
+
end
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
def check_for_sub(path, lang)
|
33
|
+
File.exist?(path.sub(/#{File.extname(path)}$/i, ".#{lang}.srt"))
|
34
|
+
end
|
35
|
+
|
36
|
+
def download_subs(file)
|
37
|
+
delete_video_default_subtitle(file)
|
38
|
+
Settings.langs.each do |lang|
|
39
|
+
Sl.info "Language: #{lang}"
|
40
|
+
se("getsub -s hinp -aLl #{lang} \"#{file}\"")
|
41
|
+
# Will to it just for the 1st time
|
42
|
+
make_default_subtitle(file, lang)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Shell execute
|
48
|
+
def se(command)
|
49
|
+
o = `#{command}`
|
50
|
+
r = $?.to_i
|
51
|
+
Sl.debug "#{o} #{r}"
|
52
|
+
r
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/settings.rb
ADDED
data/lib/sl.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'logging'
|
2
|
+
|
3
|
+
class Sl
|
4
|
+
|
5
|
+
@@l = Logging.logger['layback.log']
|
6
|
+
@@l.level = :debug
|
7
|
+
@@l.add_appenders \
|
8
|
+
Logging.appenders.stdout,
|
9
|
+
Logging.appenders.file('layback.log')
|
10
|
+
|
11
|
+
def self.error(m)
|
12
|
+
@@l.error m
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.info m
|
16
|
+
@@l.info m
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.debug m
|
20
|
+
@@l.debug m
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/watcher.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'file-monitor'
|
3
|
+
require 'find'
|
4
|
+
require 'sl'
|
5
|
+
require 'settings'
|
6
|
+
require 'os'
|
7
|
+
|
8
|
+
module Layback
|
9
|
+
|
10
|
+
class Watcher
|
11
|
+
|
12
|
+
def watch_dirs
|
13
|
+
FileMonitor.watch Settings.dir do
|
14
|
+
dirs {
|
15
|
+
disallow /\.git$/
|
16
|
+
}
|
17
|
+
|
18
|
+
files {
|
19
|
+
disallow /.*/
|
20
|
+
allow /\.mkv$|\.mp4$|\.avi$/
|
21
|
+
}
|
22
|
+
exec do |events|
|
23
|
+
events.each do |ev|
|
24
|
+
file = File.join(ev.watcher.path(), ev.name())
|
25
|
+
if File.exist?(file)
|
26
|
+
Sl.info file
|
27
|
+
Os.download_subs(file)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end # class
|
35
|
+
end # module
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: layback
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evandro Junior
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: file-monitor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: osdb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: awesome_print
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.6'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: logging
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
97
|
+
description: The script downloads subtitles when a new movie is put to a defined folder.
|
98
|
+
email:
|
99
|
+
- evandrojr@gmail.com
|
100
|
+
executables:
|
101
|
+
- watch4subs
|
102
|
+
- crawl4subs
|
103
|
+
- lang4subs
|
104
|
+
extensions: []
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- ".gitignore"
|
108
|
+
- ".rspec"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CODE_OF_CONDUCT.md
|
111
|
+
- Gemfile
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/crawl4subs
|
117
|
+
- bin/lang4subs
|
118
|
+
- bin/setup
|
119
|
+
- bin/watch4subs
|
120
|
+
- layback.gemspec
|
121
|
+
- lib/crawler.rb
|
122
|
+
- lib/language.rb
|
123
|
+
- lib/layback/version.rb
|
124
|
+
- lib/os.rb
|
125
|
+
- lib/settings.rb
|
126
|
+
- lib/sl.rb
|
127
|
+
- lib/watcher.rb
|
128
|
+
homepage: https://github.com/evandrojr/layback
|
129
|
+
licenses:
|
130
|
+
- MIT
|
131
|
+
metadata:
|
132
|
+
allowed_push_host: https://rubygems.org
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.4.8
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: Subtitles downloader on demand.
|
153
|
+
test_files: []
|