miyuki 0.3 → 0.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.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.travis.yml +8 -0
- data/Gemfile +8 -1
- data/Gemfile.lock +46 -2
- data/README.md +5 -10
- data/Rakefile +7 -1
- data/example/miyuki.conf +1 -1
- data/features/load_config.feature +18 -0
- data/features/step_definitions/load_config_step.rb +25 -0
- data/features/step_definitions/track_step.rb +17 -0
- data/features/step_definitions/tracker_step.rb +43 -0
- data/features/support/env.rb +12 -0
- data/features/support/miyuki.conf +13 -0
- data/features/track.feature +11 -0
- data/features/tracker.feature +27 -0
- data/lib/miyuki/miyuki.rb +21 -13
- data/lib/miyuki/notifier.rb +6 -1
- data/lib/miyuki/notifiers/notifu.rb +22 -0
- data/lib/miyuki/tracker.rb +9 -5
- data/lib/miyuki/version.rb +1 -1
- data/lib/miyuki.rb +3 -0
- data/miyuki.gemspec +6 -0
- metadata +68 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e1f6766c6de32f19ca19a15b0d50c4aac6462cd
|
|
4
|
+
data.tar.gz: 71406609632d18bcded6d20be2ffb1f3d1d9f867
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4251deb61c0d65ce5a88fc2667a8904a64ce665c1817b5a87e0437e478e0ebeea1d5b7070e2a0ec054d29c2af230630b995db0d98c29a45dcdc686fc7372b442
|
|
7
|
+
data.tar.gz: 2d5ce0c653fd560c64f2d7ad13ec5382dcf89c1064727696748818db7c73a453cddde89bac4e51bab8bb020066eda6853ff6c28a8835189387dc63dfedbf85b6
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
+
gem 'rake'
|
|
3
4
|
gem 'rufus-scheduler'
|
|
4
|
-
gem 'yamazaki', '>= 0.3'
|
|
5
|
+
gem 'yamazaki', '>= 0.3.1'
|
|
5
6
|
gem 'foreverb'
|
|
6
7
|
gem 'terminal-notifier'
|
|
7
8
|
gem 'libnotify'
|
|
9
|
+
gem 'rb-notifu'
|
|
10
|
+
gem 'filewatcher'
|
|
11
|
+
gem 'ruby_deep_clone'
|
|
12
|
+
|
|
13
|
+
gem 'cucumber'
|
|
14
|
+
gem 'rspec'
|
data/Gemfile.lock
CHANGED
|
@@ -1,26 +1,70 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
+
builder (3.2.2)
|
|
4
5
|
color (1.7.1)
|
|
5
6
|
colorb (0.0.9)
|
|
6
7
|
color
|
|
8
|
+
cucumber (1.3.17)
|
|
9
|
+
builder (>= 2.1.2)
|
|
10
|
+
diff-lcs (>= 1.1.3)
|
|
11
|
+
gherkin (~> 2.12)
|
|
12
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
13
|
+
multi_test (>= 0.1.1)
|
|
14
|
+
diff-lcs (1.2.5)
|
|
15
|
+
ffi (1.9.6)
|
|
16
|
+
ffi (1.9.6-x86-mingw32)
|
|
17
|
+
filewatcher (0.3.5)
|
|
18
|
+
trollop (~> 2.0)
|
|
7
19
|
foreverb (0.3.2)
|
|
8
20
|
thor (>= 0.15.0)
|
|
21
|
+
gherkin (2.12.2)
|
|
22
|
+
multi_json (~> 1.3)
|
|
23
|
+
gherkin (2.12.2-x86-mingw32)
|
|
24
|
+
multi_json (~> 1.3)
|
|
25
|
+
libnotify (0.8.4)
|
|
26
|
+
ffi (>= 1.0.11)
|
|
27
|
+
multi_json (1.10.1)
|
|
28
|
+
multi_test (0.1.1)
|
|
29
|
+
rake (10.4.2)
|
|
30
|
+
rb-notifu (0.0.4)
|
|
31
|
+
rspec (3.1.0)
|
|
32
|
+
rspec-core (~> 3.1.0)
|
|
33
|
+
rspec-expectations (~> 3.1.0)
|
|
34
|
+
rspec-mocks (~> 3.1.0)
|
|
35
|
+
rspec-core (3.1.7)
|
|
36
|
+
rspec-support (~> 3.1.0)
|
|
37
|
+
rspec-expectations (3.1.2)
|
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
+
rspec-support (~> 3.1.0)
|
|
40
|
+
rspec-mocks (3.1.3)
|
|
41
|
+
rspec-support (~> 3.1.0)
|
|
42
|
+
rspec-support (3.1.2)
|
|
43
|
+
ruby_deep_clone (0.6.0)
|
|
9
44
|
rufus-scheduler (3.0.9)
|
|
10
45
|
tzinfo
|
|
11
46
|
terminal-notifier (1.6.2)
|
|
12
47
|
thor (0.19.1)
|
|
13
48
|
thread_safe (0.3.4)
|
|
49
|
+
trollop (2.0)
|
|
14
50
|
tzinfo (1.2.2)
|
|
15
51
|
thread_safe (~> 0.1)
|
|
16
|
-
yamazaki (0.3)
|
|
52
|
+
yamazaki (0.3.1)
|
|
17
53
|
colorb (~> 0)
|
|
18
54
|
|
|
19
55
|
PLATFORMS
|
|
20
56
|
ruby
|
|
57
|
+
x86-mingw32
|
|
21
58
|
|
|
22
59
|
DEPENDENCIES
|
|
60
|
+
cucumber
|
|
61
|
+
filewatcher
|
|
23
62
|
foreverb
|
|
63
|
+
libnotify
|
|
64
|
+
rake
|
|
65
|
+
rb-notifu
|
|
66
|
+
rspec
|
|
67
|
+
ruby_deep_clone
|
|
24
68
|
rufus-scheduler
|
|
25
69
|
terminal-notifier
|
|
26
|
-
yamazaki (>= 0.3)
|
|
70
|
+
yamazaki (>= 0.3.1)
|
data/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Miyuki – Non ti lascia mai solo
|
|
2
2
|
===============================
|
|
3
|
-
After having configured the `example/miyuki.conf` configuration file, Miyuki lets you to have always the latest episodes of anime you're watching, downloading the episodes whenever they're available on
|
|
3
|
+
After having configured the `example/miyuki.conf` configuration file, Miyuki lets you to have always the latest episodes of anime you're watching, downloading the episodes whenever they're available on [nyaa](http://nyaa.se).
|
|
4
4
|
|
|
5
|
-
Of course, set the watch directory inside the configuration file to the one you've set in your torrent client.
|
|
5
|
+
Of course, remember set the watch directory inside the configuration file (`example/miyuki.conf`) to the one you've set in your torrent client.
|
|
6
6
|
|
|
7
7
|
Features
|
|
8
8
|
--------
|
|
9
|
-
- After having launched the daemon, the changes to the configuration file will be always syncronized without having restart Miyuki
|
|
10
|
-
- Whenever Miyuki finds out a new episode to download, you'll be notified with
|
|
9
|
+
- After having launched the daemon, the changes to the configuration file will be always syncronized without having to restart Miyuki
|
|
10
|
+
- Whenever Miyuki finds out a new episode to download, you'll be notified with a system alert (compatible with OSX and Windows natively and with Linux installing `libnotify`)
|
|
11
11
|
- Miyuki gives you a powerful way to search anime series through patterns
|
|
12
12
|
|
|
13
13
|
How to use
|
|
@@ -18,11 +18,6 @@ How to use
|
|
|
18
18
|
|
|
19
19
|
`$ miyuki stop` (or `$ miyuki kill`)
|
|
20
20
|
|
|
21
|
-
Known bugs
|
|
22
|
-
----------
|
|
23
|
-
- Nisekoi BDs in `example/miyuki.conf` are downloaded both in 720p and 1080p
|
|
24
|
-
|
|
25
21
|
Contributors
|
|
26
22
|
------------
|
|
27
|
-
- [alfateam123](https://github.com/alfateam123) —
|
|
28
|
-
|
|
23
|
+
- [alfateam123](https://github.com/alfateam123) — libnotify
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#! /usr/bin/env ruby
|
|
2
2
|
require 'rake'
|
|
3
|
+
require 'cucumber'
|
|
4
|
+
require 'cucumber/rake/task'
|
|
3
5
|
|
|
4
|
-
task default: [ :build, :install ]
|
|
6
|
+
task default: [ :build, :install, :test ]
|
|
5
7
|
|
|
6
8
|
task :build do
|
|
7
9
|
sh 'gem build *.gemspec'
|
|
@@ -10,3 +12,7 @@ end
|
|
|
10
12
|
task :install do
|
|
11
13
|
sh 'gem install *.gem'
|
|
12
14
|
end
|
|
15
|
+
|
|
16
|
+
Cucumber::Rake::Task.new(:test) do |t|
|
|
17
|
+
t.cucumber_opts = %w{--format pretty}
|
|
18
|
+
end
|
data/example/miyuki.conf
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Feature: Load configuration file
|
|
2
|
+
In order to load a custom configuration inside Miyuki
|
|
3
|
+
As a user who wants to run her
|
|
4
|
+
I give her the path to the configuration file
|
|
5
|
+
|
|
6
|
+
Scenario: The file exists and is valid
|
|
7
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
8
|
+
Then I expect no exception raised
|
|
9
|
+
|
|
10
|
+
Scenario: The file does not exist
|
|
11
|
+
When I set the configuration file path to "features/support/nopls.conf"
|
|
12
|
+
Then I expect an exception raised
|
|
13
|
+
|
|
14
|
+
Scenario: The configuration is refreshed as soon as the file is modified
|
|
15
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
16
|
+
And I modify something in "features/support/miyuki.conf"
|
|
17
|
+
Then Miyuki reloads her configuration
|
|
18
|
+
And I get a notification about the reloading
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
When(/I set the configuration file path to "(.*)"/) do |path|
|
|
2
|
+
@path = path
|
|
3
|
+
begin
|
|
4
|
+
Miyuki.config = @path
|
|
5
|
+
rescue
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Then(/I expect an exception raised/) do
|
|
10
|
+
expect { Miyuki.config = @path }.to raise_error
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/I expect no exception raised/) do
|
|
14
|
+
expect { Miyuki.config = @path }.to_not raise_error
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
And(/^I modify something in "(.*?)"/) do |file|
|
|
18
|
+
@previous_config = Miyuki.config
|
|
19
|
+
|
|
20
|
+
FileUtils.touch(file)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Then(/^Miyuki reloads her configuration/) do
|
|
24
|
+
expect(Miyuki.config).to_not be equal(@previous_config)
|
|
25
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
When(/I invoke "(.*)"/) do |command|
|
|
2
|
+
Miyuki.send(command.to_sym)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
And(/watch folder is created if it does not exists/) do
|
|
6
|
+
watch_dir = Miyuki.config['watchDir']
|
|
7
|
+
FileUtils.rm_r(watch_dir) if Dir.exists?(watch_dir)
|
|
8
|
+
|
|
9
|
+
expect { Miyuki.track! }.to change { Dir.exists?(watch_dir) }.from(false).to(true)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
And(/watch folder is not created if it exists already/) do
|
|
13
|
+
watch_dir = Miyuki.config['watchDir']
|
|
14
|
+
Dir.mkdir(watch_dir) unless Dir.exists?(watch_dir)
|
|
15
|
+
|
|
16
|
+
expect { Miyuki.track! }.to_not change { Dir.exists?(watch_dir) }
|
|
17
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
And(/I wait (\d+) seconds?/) do |seconds|
|
|
2
|
+
sleep seconds.to_f
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then(/I have almost (\d+) torrent files? containing "(.*?)"/) do |count, string|
|
|
6
|
+
watch_dir = Miyuki.config['watchDir']
|
|
7
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.include?(string) }
|
|
8
|
+
|
|
9
|
+
expect(torrent_files.count).to be >= count.to_i
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
And(/I have almost (\d+) torrent files? that do not contain "(.*?)"/) do |count, string|
|
|
13
|
+
watch_dir = Miyuki.config['watchDir']
|
|
14
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].reject { |f| f.include?(string) }
|
|
15
|
+
|
|
16
|
+
expect(torrent_files.count).to be >= count.to_i
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
And(/there are (\d+) torrent files? containing "(.*?)"/) do |count, string|
|
|
20
|
+
watch_dir = Miyuki.config['watchDir']
|
|
21
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.include?(string) }
|
|
22
|
+
|
|
23
|
+
expect(torrent_files.count).to be count.to_i
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
And(/there are (\d+) torrent files? that do not contain "(.*?)"/) do |count, string|
|
|
27
|
+
watch_dir = Miyuki.config['watchDir']
|
|
28
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].reject { |f| f.include?(string) }
|
|
29
|
+
|
|
30
|
+
expect(torrent_files.count).to be count.to_i
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
And(/I consider the currently downloaded torrent files/) do
|
|
34
|
+
watch_dir = Miyuki.config['watchDir']
|
|
35
|
+
@previous_torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Then(/I expect (\d+) torrent files? (have|has) been overwritten/) do |count, plural|
|
|
39
|
+
watch_dir = Miyuki.config['watchDir']
|
|
40
|
+
torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
|
41
|
+
|
|
42
|
+
expect(@previous_torrent_files_ctime).to match_array(torrent_files_ctime)
|
|
43
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'miyuki'
|
|
2
|
+
require 'rspec'
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
Miyuki.join_scheduler = false
|
|
6
|
+
|
|
7
|
+
After do |s|
|
|
8
|
+
watch_dir = 'features/support/testWatchDir'
|
|
9
|
+
FileUtils.rm_r(watch_dir) if Dir.exists?(watch_dir)
|
|
10
|
+
|
|
11
|
+
Cucumber.wants_to_quit = true if s.failed?
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Feature: Start the tracking of anime series
|
|
2
|
+
In order to keep track of new episodes of the anime series I'm watching
|
|
3
|
+
As user who wants to actually start Miyuki
|
|
4
|
+
I call Miyuki::track!
|
|
5
|
+
|
|
6
|
+
Scenario: The tracking starts without launching exceptions
|
|
7
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
8
|
+
And I invoke "track!"
|
|
9
|
+
Then I expect no exception raised
|
|
10
|
+
And watch folder is created if it does not exists
|
|
11
|
+
And watch folder is not created if it exists already
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Download new episodes
|
|
2
|
+
In order to download the new episodes of the anime series I'm watching
|
|
3
|
+
As user who wants to have the torrent files downloaded automatically as soon as they're available
|
|
4
|
+
I expect the episodes are tracked and the torrent files are downloaded
|
|
5
|
+
|
|
6
|
+
Scenario: The episodes are downloaded according to the configuration file
|
|
7
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
8
|
+
And I invoke "track!"
|
|
9
|
+
And I wait 5 seconds to let Miyuki to find and download the episodes
|
|
10
|
+
Then I have almost 2 torrent files containing "BD"
|
|
11
|
+
And I have almost 12 torrent file that do not contain "BD"
|
|
12
|
+
And there are 0 torrent files containing "BD 720p"
|
|
13
|
+
And there are 0 torrent files that do not contain "[Commie]"
|
|
14
|
+
|
|
15
|
+
Scenario: Episodes already downloaded are ignored
|
|
16
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
17
|
+
And I invoke "track!"
|
|
18
|
+
And I wait 5 seconds to let Miyuki to find and download the episodes
|
|
19
|
+
And I consider the currently downloaded torrent files
|
|
20
|
+
And I wait 6 seconds in order to have a new check of the new anime episodes
|
|
21
|
+
And I wait 5 seconds in case this scenario would fail
|
|
22
|
+
Then I expect 0 torrent files have been overwritten by their duplicates
|
|
23
|
+
|
|
24
|
+
Scenario: There is a notification for every episode downloaded if enabled
|
|
25
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
|
26
|
+
And I invoke "track!"
|
|
27
|
+
Then I get a notification for every torrent file downloaded
|
data/lib/miyuki/miyuki.rb
CHANGED
|
@@ -14,26 +14,32 @@
|
|
|
14
14
|
|
|
15
15
|
module Miyuki
|
|
16
16
|
class << self
|
|
17
|
+
attr_reader :config, :config_file
|
|
18
|
+
attr_accessor :join_scheduler
|
|
19
|
+
|
|
17
20
|
def config=(config_file)
|
|
18
21
|
@notifier = Notifier.new
|
|
19
22
|
|
|
20
23
|
@config_file = config_file
|
|
21
24
|
@config = load_config
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
Thread.new do
|
|
27
|
+
FileWatcher.new([config_file]).watch { refresh_config }
|
|
28
|
+
end
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
def track!
|
|
32
|
+
raise Exception, 'You have to provide a proper configuration file to start the tracking.' unless @config
|
|
33
|
+
|
|
28
34
|
watch_dir = File.expand_path(@config['watchDir'])
|
|
29
|
-
FileUtils.mkdir_p(watch_dir) unless
|
|
35
|
+
FileUtils.mkdir_p(watch_dir) unless Dir.exists?(watch_dir)
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
@tracker = Tracker.new(watch_dir,
|
|
37
|
+
config = DeepClone.clone(@config)
|
|
38
|
+
@tracker = Tracker.new(watch_dir, config['series']) do |torrent|
|
|
33
39
|
notify_torrents(torrent)
|
|
34
40
|
end
|
|
35
41
|
|
|
36
|
-
run_scheduler
|
|
42
|
+
run_scheduler!
|
|
37
43
|
end
|
|
38
44
|
|
|
39
45
|
private
|
|
@@ -45,7 +51,6 @@ module Miyuki
|
|
|
45
51
|
notify_configuration
|
|
46
52
|
|
|
47
53
|
@config = new_config
|
|
48
|
-
@scheduler.pause if defined?(@scheduler)
|
|
49
54
|
track!
|
|
50
55
|
end
|
|
51
56
|
end
|
|
@@ -54,19 +59,22 @@ module Miyuki
|
|
|
54
59
|
old_torrents = @tracker.torrents
|
|
55
60
|
|
|
56
61
|
@tracker.refresh
|
|
62
|
+
@tracker.remove_duplicates(old_torrents)
|
|
57
63
|
|
|
58
|
-
new_torrents = @tracker.
|
|
59
|
-
new_torrents.each { |
|
|
64
|
+
new_torrents = @tracker.torrents
|
|
65
|
+
new_torrents.each { |new_torrent| notify_torrents(new_torrent) }
|
|
60
66
|
end
|
|
61
67
|
|
|
62
68
|
def load_config
|
|
63
69
|
YAML.load(File.read(@config_file))
|
|
64
70
|
end
|
|
65
71
|
|
|
66
|
-
def run_scheduler
|
|
67
|
-
@
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
def run_scheduler!
|
|
73
|
+
@scheduled_job.kill if @scheduled_job
|
|
74
|
+
|
|
75
|
+
scheduler = Rufus::Scheduler.new
|
|
76
|
+
@scheduled_job = scheduler.schedule_every @config['refreshEvery'] { refresh_torrents }
|
|
77
|
+
scheduler.join if @join_scheduler != false
|
|
70
78
|
end
|
|
71
79
|
|
|
72
80
|
def notify_torrents(torrent)
|
data/lib/miyuki/notifier.rb
CHANGED
|
@@ -19,7 +19,11 @@ module Miyuki
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def notify(title, message)
|
|
22
|
-
@notifier.notify(title, message)
|
|
22
|
+
@notifier.notify(title, message) if has_notifier?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def has_notifier?
|
|
26
|
+
!!@notifier
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
private
|
|
@@ -28,6 +32,7 @@ module Miyuki
|
|
|
28
32
|
case RUBY_PLATFORM
|
|
29
33
|
when /darwin/ then Miyuki::TerminalNotifier.new
|
|
30
34
|
when /linux/ then Miyuki::Libnotify.new
|
|
35
|
+
when /mswin|msys|mingw|cygwin/ then Miyuki::Notifu.new
|
|
31
36
|
end
|
|
32
37
|
end
|
|
33
38
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
##
|
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
3
|
+
# Version 2, December 2004
|
|
4
|
+
#
|
|
5
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
|
6
|
+
# copies of this license document, and changing it is allowed as long
|
|
7
|
+
# as the name is changed.
|
|
8
|
+
#
|
|
9
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
10
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
11
|
+
#
|
|
12
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
13
|
+
##
|
|
14
|
+
require 'rb-notifu'
|
|
15
|
+
|
|
16
|
+
module Miyuki
|
|
17
|
+
class Notifu
|
|
18
|
+
def notify(title, message)
|
|
19
|
+
::Notifu.show(title: message, message: title, type: :info, time: 1)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/miyuki/tracker.rb
CHANGED
|
@@ -28,22 +28,26 @@ module Miyuki
|
|
|
28
28
|
refresh
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
def for_every_torrent(&callback)
|
|
32
|
+
if block_given?
|
|
33
|
+
@callback = callback
|
|
34
|
+
else
|
|
35
|
+
yield
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
def refresh
|
|
32
40
|
@torrents = []
|
|
33
41
|
|
|
34
42
|
fetch_torrents
|
|
35
43
|
|
|
36
44
|
@torrents.each do |torrent|
|
|
37
|
-
|
|
38
|
-
Yamazaki.download_torrent(torrent.title, torrent.link)
|
|
39
|
-
downloaded = !existed && File.exists?("#{Yamazaki::WATCH_DIR}/#{torrent.title}.torrent")
|
|
45
|
+
downloaded = Yamazaki.download_torrent(torrent.title, torrent.link)
|
|
40
46
|
|
|
41
|
-
# TODO: `downloaded` should be returned by Yamazaki natively
|
|
42
47
|
@callback.call(torrent) if downloaded && @callback
|
|
43
48
|
end
|
|
44
49
|
end
|
|
45
50
|
|
|
46
|
-
# TODO: Refactor
|
|
47
51
|
def remove_duplicates(other_torrents)
|
|
48
52
|
@torrents.delete_if do |torrent|
|
|
49
53
|
other_torrents.each do |other_torrent|
|
data/lib/miyuki/version.rb
CHANGED
data/lib/miyuki.rb
CHANGED
|
@@ -16,6 +16,8 @@ require 'fileutils'
|
|
|
16
16
|
require 'yaml'
|
|
17
17
|
require 'rufus-scheduler'
|
|
18
18
|
require 'yamazaki'
|
|
19
|
+
require 'filewatcher'
|
|
20
|
+
require 'deep_clone'
|
|
19
21
|
|
|
20
22
|
require 'miyuki/notifier'
|
|
21
23
|
require 'miyuki/tracker'
|
|
@@ -25,4 +27,5 @@ require 'miyuki/version'
|
|
|
25
27
|
case RUBY_PLATFORM
|
|
26
28
|
when /darwin/ then require 'miyuki/notifiers/terminal-notifier.rb'
|
|
27
29
|
when /linux/ then require 'miyuki/notifiers/libnotify.rb'
|
|
30
|
+
when /mswin|msys|mingw|cygwin/ then require 'miyuki/notifiers/notifu.rb'
|
|
28
31
|
end
|
data/miyuki.gemspec
CHANGED
|
@@ -17,9 +17,15 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.add_dependency 'yamazaki', '~> 0.3'
|
|
18
18
|
s.add_dependency 'rufus-scheduler', '~> 3.0'
|
|
19
19
|
s.add_dependency 'foreverb', '~> 0.3'
|
|
20
|
+
s.add_dependency 'filewatcher', '~> 0.3'
|
|
21
|
+
s.add_dependency 'ruby_deep_clone', '~> 0.6'
|
|
20
22
|
|
|
21
23
|
case RUBY_PLATFORM
|
|
22
24
|
when /darwin/ then s.add_dependency 'terminal-notifier', '~> 1.6'
|
|
23
25
|
when /linux/ then s.add_dependency 'libnotify', '~> 0.8'
|
|
26
|
+
when /mswin|msys|mingw|cygwin/ then s.add_dependency 'libnotify', '~> 0.0'
|
|
24
27
|
end
|
|
28
|
+
|
|
29
|
+
s.add_development_dependency 'cucumber', '~> 1.3'
|
|
30
|
+
s.add_development_dependency 'rspec', '~> 3.2'
|
|
25
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: miyuki
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.4'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roxas Shadow
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-12-
|
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: yamazaki
|
|
@@ -52,6 +52,34 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0.3'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: filewatcher
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0.3'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0.3'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: ruby_deep_clone
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0.6'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0.6'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
84
|
name: terminal-notifier
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,6 +94,34 @@ dependencies:
|
|
|
66
94
|
- - "~>"
|
|
67
95
|
- !ruby/object:Gem::Version
|
|
68
96
|
version: '1.6'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: cucumber
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.3'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '1.3'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '3.2'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '3.2'
|
|
69
125
|
description: Miyuki downloads automatically every episode of anime you're watching
|
|
70
126
|
email: webmaster@giovannicapuano.net
|
|
71
127
|
executables:
|
|
@@ -74,16 +130,26 @@ extensions: []
|
|
|
74
130
|
extra_rdoc_files: []
|
|
75
131
|
files:
|
|
76
132
|
- ".gitignore"
|
|
133
|
+
- ".travis.yml"
|
|
77
134
|
- Gemfile
|
|
78
135
|
- Gemfile.lock
|
|
79
136
|
- README.md
|
|
80
137
|
- Rakefile
|
|
81
138
|
- bin/miyuki
|
|
82
139
|
- example/miyuki.conf
|
|
140
|
+
- features/load_config.feature
|
|
141
|
+
- features/step_definitions/load_config_step.rb
|
|
142
|
+
- features/step_definitions/track_step.rb
|
|
143
|
+
- features/step_definitions/tracker_step.rb
|
|
144
|
+
- features/support/env.rb
|
|
145
|
+
- features/support/miyuki.conf
|
|
146
|
+
- features/track.feature
|
|
147
|
+
- features/tracker.feature
|
|
83
148
|
- lib/miyuki.rb
|
|
84
149
|
- lib/miyuki/miyuki.rb
|
|
85
150
|
- lib/miyuki/notifier.rb
|
|
86
151
|
- lib/miyuki/notifiers/libnotify.rb
|
|
152
|
+
- lib/miyuki/notifiers/notifu.rb
|
|
87
153
|
- lib/miyuki/notifiers/terminal-notifier.rb
|
|
88
154
|
- lib/miyuki/tracker.rb
|
|
89
155
|
- lib/miyuki/version.rb
|