miyuki 0.5.7 → 0.5.10
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 +5 -5
- data/Gemfile +4 -3
- data/README.md +23 -23
- data/Rakefile +18 -18
- data/bin/miyuki +34 -34
- data/example/miyuki.conf +24 -16
- data/features/load_config.feature +26 -18
- data/features/step_definitions/load_config_step.rb +52 -34
- data/features/step_definitions/track_step.rb +20 -17
- data/features/step_definitions/tracker_step.rb +79 -79
- data/features/support/changedtrackfile.db +1 -0
- data/features/support/env.rb +25 -19
- data/features/support/miyuki.conf +17 -21
- data/features/support/turn_off_notifications.patch +13 -0
- data/features/track.feature +11 -11
- data/features/tracker.feature +29 -32
- data/lib/miyuki.rb +34 -32
- data/lib/miyuki/miyuki.rb +85 -83
- data/lib/miyuki/notifier.rb +39 -39
- data/lib/miyuki/notifiers/libnotify.rb +22 -22
- data/lib/miyuki/notifiers/notifu.rb +22 -22
- data/lib/miyuki/notifiers/terminal-notifier.rb +22 -22
- data/lib/miyuki/parser.rb +55 -55
- data/lib/miyuki/tracker.rb +76 -69
- data/lib/miyuki/version.rb +17 -17
- metadata +37 -53
- data/.gitignore +0 -5
- data/.travis.yml +0 -8
- data/CHANGELOG.md +0 -30
- data/Gemfile.lock +0 -70
- data/miyuki.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 52fc895e1a83f7d0fbefd2bda3c7f99de8b1c5965308fa017b69a4741ab48aa6
|
4
|
+
data.tar.gz: 8377e8844c19a6edffe62766ff699d726fe9a6aa1e73f619747729a2c682211f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32cff812dfa07a079c86c49844ba2cb18002c7f62703e820c3cd41a08b634c4bb26cabb8cce8a980ec38499eae25dbdb36db2ce15c8b86da07d8942361e28841
|
7
|
+
data.tar.gz: fc4571afd59c879b7a80f9f0b51be032780f94c3c29dd064162342afdd75a6f67c40d02e798557ab01cbf8fde3e348165534e08ff930653a72d2932847a3a11d
|
data/Gemfile
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rake'
|
4
|
+
gem 'tzinfo-data'
|
4
5
|
gem 'rufus-scheduler'
|
5
|
-
gem 'yamazaki'
|
6
|
+
gem 'yamazaki'
|
6
7
|
gem 'foreverb'
|
7
8
|
gem 'terminal-notifier'
|
8
9
|
gem 'libnotify'
|
9
10
|
gem 'rb-notifu'
|
10
|
-
gem 'filewatcher'
|
11
|
+
gem 'filewatcher'
|
11
12
|
gem 'ruby_deep_clone'
|
12
13
|
|
13
14
|
gem 'cucumber'
|
14
|
-
gem 'rspec'
|
15
|
+
gem 'rspec'
|
data/README.md
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
Miyuki – Non ti lascia mai solo
|
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 [nyaa](http://nyaa.se).
|
4
|
-
|
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
|
-
|
7
|
-
Features
|
8
|
-
--------
|
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
|
-
- Miyuki gives you a powerful way to search anime series through patterns
|
12
|
-
|
13
|
-
How to use
|
14
|
-
----------
|
15
|
-
`$ gem install miyuki`
|
16
|
-
|
17
|
-
`$ miyuki start example/miyuki.conf`
|
18
|
-
|
19
|
-
`$ miyuki stop` (or `$ miyuki kill`)
|
20
|
-
|
21
|
-
Contributors
|
22
|
-
------------
|
23
|
-
- [alfateam123](https://github.com/alfateam123) — libnotify
|
1
|
+
Miyuki – Non ti lascia mai solo
|
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 [nyaa](http://nyaa.se).
|
4
|
+
|
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
|
+
|
7
|
+
Features
|
8
|
+
--------
|
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
|
+
- Miyuki gives you a powerful way to search anime series through patterns
|
12
|
+
|
13
|
+
How to use
|
14
|
+
----------
|
15
|
+
`$ gem install miyuki`
|
16
|
+
|
17
|
+
`$ miyuki start example/miyuki.conf`
|
18
|
+
|
19
|
+
`$ miyuki stop` (or `$ miyuki kill`)
|
20
|
+
|
21
|
+
Contributors
|
22
|
+
------------
|
23
|
+
- [alfateam123](https://github.com/alfateam123) — libnotify
|
data/Rakefile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
require 'rake'
|
3
|
-
require 'cucumber'
|
4
|
-
require 'cucumber/rake/task'
|
5
|
-
|
6
|
-
task default: [ :build, :install, :test ]
|
7
|
-
|
8
|
-
task :build do
|
9
|
-
sh 'gem build *.gemspec'
|
10
|
-
end
|
11
|
-
|
12
|
-
task :install do
|
13
|
-
sh 'gem install *.gem'
|
14
|
-
end
|
15
|
-
|
16
|
-
Cucumber::Rake::Task.new(:test) do |t|
|
17
|
-
t.cucumber_opts = %w{--format pretty}
|
18
|
-
end
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'rake'
|
3
|
+
require 'cucumber'
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
task default: [ :build, :install, :test ]
|
7
|
+
|
8
|
+
task :build do
|
9
|
+
sh 'gem build *.gemspec'
|
10
|
+
end
|
11
|
+
|
12
|
+
task :install do
|
13
|
+
sh 'gem install *.gem'
|
14
|
+
end
|
15
|
+
|
16
|
+
Cucumber::Rake::Task.new(:test) do |t|
|
17
|
+
t.cucumber_opts = %w{--format pretty}
|
18
|
+
end
|
data/bin/miyuki
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
##
|
3
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
-
# Version 2, December 2004
|
5
|
-
#
|
6
|
-
# Everyone is permitted to copy and distribute verbatim or modified
|
7
|
-
# copies of this license document, and changing it is allowed as long
|
8
|
-
# as the name is changed.
|
9
|
-
#
|
10
|
-
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
-
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
-
#
|
13
|
-
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
-
##
|
15
|
-
require 'miyuki'
|
16
|
-
require 'forever'
|
17
|
-
|
18
|
-
config_file = File.expand_path(ARGV.last) if ARGV.any?
|
19
|
-
|
20
|
-
unless ['kill', 'stop'].include?(ARGV[0])
|
21
|
-
abort 'Please provide a configuration file.' if ARGV.length <= 1
|
22
|
-
abort 'Given configuration file does not exist.' unless File.exists?(config_file)
|
23
|
-
end
|
24
|
-
|
25
|
-
Forever.run do
|
26
|
-
dir File.expand_path('..', __FILE__)
|
27
|
-
log File.join(dir, '/miyuki.log')
|
28
|
-
pid File.join(dir, '/miyuki.pid')
|
29
|
-
|
30
|
-
before :all do
|
31
|
-
Miyuki.config = config_file
|
32
|
-
Miyuki.track!
|
33
|
-
end
|
34
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
##
|
3
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
+
# Version 2, December 2004
|
5
|
+
#
|
6
|
+
# Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
# copies of this license document, and changing it is allowed as long
|
8
|
+
# as the name is changed.
|
9
|
+
#
|
10
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
#
|
13
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
##
|
15
|
+
require 'miyuki'
|
16
|
+
require 'forever'
|
17
|
+
|
18
|
+
config_file = File.expand_path(ARGV.last) if ARGV.any?
|
19
|
+
|
20
|
+
unless ['kill', 'stop'].include?(ARGV[0])
|
21
|
+
abort 'Please provide a configuration file.' if ARGV.length <= 1
|
22
|
+
abort 'Given configuration file does not exist.' unless File.exists?(config_file)
|
23
|
+
end
|
24
|
+
|
25
|
+
Forever.run do
|
26
|
+
dir File.expand_path('..', __FILE__)
|
27
|
+
log File.join(dir, '/miyuki.log')
|
28
|
+
pid File.join(dir, '/miyuki.pid')
|
29
|
+
|
30
|
+
before :all do
|
31
|
+
Miyuki.config = config_file
|
32
|
+
Miyuki.track!
|
33
|
+
end
|
34
|
+
end
|
data/example/miyuki.conf
CHANGED
@@ -1,16 +1,24 @@
|
|
1
|
-
watchDir: "~/.watch"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
watchDir: "~/.watch"
|
2
|
+
trackFile: "~/.miyuki.db"
|
3
|
+
refreshEvery: 20m
|
4
|
+
notifications:
|
5
|
+
enabled: true
|
6
|
+
|
7
|
+
series:
|
8
|
+
# Download the whole anime series
|
9
|
+
- name: The Rolling Girls
|
10
|
+
- fansub: Commie
|
11
|
+
|
12
|
+
# Download from the episode 9 (included)
|
13
|
+
# `skipIfNotSure` is optional and also `false` by default
|
14
|
+
- name: Mekakucity
|
15
|
+
fansub: Commie
|
16
|
+
episodes:
|
17
|
+
from: 9
|
18
|
+
skipIfNotSure: true
|
19
|
+
|
20
|
+
# Use a custom pattern to download the BD 1080p release
|
21
|
+
- name: Nisekoi
|
22
|
+
fansub: Commie
|
23
|
+
res: 1080p
|
24
|
+
pattern: "[$fansub] $name - Volume [BD $res AAC]"
|
@@ -1,18 +1,26 @@
|
|
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
|
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
|
19
|
+
|
20
|
+
Scenario: Track files is updated in yamazaki when configuration file path is changed
|
21
|
+
When I set the configuration file path to "features/support/miyuki.conf"
|
22
|
+
And I modify track file in "features/support/miyuki.conf"
|
23
|
+
Then Miyuki reloads her configuration
|
24
|
+
And I invoke "track!"
|
25
|
+
And Yamazaki creates the new track file
|
26
|
+
And I modify track file in "features/support/miyuki.conf" #to restore the old miyuki.conf
|
@@ -1,34 +1,52 @@
|
|
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 = DeepClone.clone(Miyuki.config)
|
19
|
-
|
20
|
-
config = File.read(file)
|
21
|
-
|
22
|
-
if config.include?('6s')
|
23
|
-
config.gsub!('6s', '5s')
|
24
|
-
elsif config.include?('5s')
|
25
|
-
config.gsub!('5s', '6s')
|
26
|
-
end
|
27
|
-
|
28
|
-
File.open(file, ?w) { |f| f.puts(config) }
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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 = DeepClone.clone(Miyuki.config)
|
19
|
+
|
20
|
+
config = File.read(file)
|
21
|
+
|
22
|
+
if config.include?('6s')
|
23
|
+
config.gsub!('6s', '5s')
|
24
|
+
elsif config.include?('5s')
|
25
|
+
config.gsub!('5s', '6s')
|
26
|
+
end
|
27
|
+
|
28
|
+
File.open(file, ?w) { |f| f.puts(config) }
|
29
|
+
end
|
30
|
+
|
31
|
+
And(/I modify track file in "(.*?)"/) do |file|
|
32
|
+
@previous_config = DeepClone.clone(Miyuki.config)
|
33
|
+
|
34
|
+
config = File.read(file)
|
35
|
+
|
36
|
+
if config.include?('changedtrackfile.db')
|
37
|
+
config.gsub!('changedtrackfile.db', '.miyuki.db')
|
38
|
+
elsif config.include?('.miyuki.db')
|
39
|
+
config.gsub!('.miyuki.db', 'changedtrackfile.db')
|
40
|
+
end
|
41
|
+
|
42
|
+
File.open(file, ?w) { |f| f.puts(config) }
|
43
|
+
end
|
44
|
+
|
45
|
+
And(/Yamazaki creates the new track file/) do
|
46
|
+
expect(File.exists?('features/support/changedtrackfile.db')).to be_truthy
|
47
|
+
end
|
48
|
+
|
49
|
+
Then(/^Miyuki reloads her configuration/) do
|
50
|
+
expect(Miyuki.config).to_not be equal(@previous_config)
|
51
|
+
expect(Miyuki.config['refreshEvery']).to_not be @previous_config['refreshEvery']
|
52
|
+
end
|
@@ -1,17 +1,20 @@
|
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
+
track_file = Miyuki.config['trackFile']
|
10
|
+
FileUtils.rm(track_file) if File.exists?(track_file)
|
11
|
+
|
12
|
+
expect { Miyuki.track! }.to change { Dir.exists?(watch_dir) }.from(false).to(true)
|
13
|
+
end
|
14
|
+
|
15
|
+
And(/watch folder is not created if it exists already/) do
|
16
|
+
watch_dir = Miyuki.config['watchDir']
|
17
|
+
Dir.mkdir(watch_dir) unless Dir.exists?(watch_dir)
|
18
|
+
|
19
|
+
expect { Miyuki.track! }.to_not change { Dir.exists?(watch_dir) }
|
20
|
+
end
|
@@ -1,79 +1,79 @@
|
|
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.contains?(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.contains?(string) }
|
15
|
-
|
16
|
-
expect(torrent_files.count).to be >= count.to_i
|
17
|
-
end
|
18
|
-
|
19
|
-
And(/I have not the episodes? (.+) of "(.+)"/) do |episodes, string|
|
20
|
-
watch_dir = Miyuki.config['watchDir']
|
21
|
-
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
22
|
-
|
23
|
-
episodes = episodes.split(',').map(&:to_i)
|
24
|
-
|
25
|
-
torrent_files.select! do |f|
|
26
|
-
episode = f.scan(/- [0-9]*\.?[0-9]+/).flatten.last.to_i
|
27
|
-
episodes.include?(episode)
|
28
|
-
end
|
29
|
-
|
30
|
-
expect(torrent_files.empty?).to be_truthy
|
31
|
-
end
|
32
|
-
|
33
|
-
And(/I have the episodes? (.+) of "(.+)"/) do |episodes, string|
|
34
|
-
watch_dir = Miyuki.config['watchDir']
|
35
|
-
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
36
|
-
torrent_files_count = torrent_files.length
|
37
|
-
|
38
|
-
episodes = episodes.split(',').map(&:to_i)
|
39
|
-
|
40
|
-
torrent_files.select! do |f|
|
41
|
-
episode = f.scan(/- [0-9]*\.?[0-9]+/).flatten.last.to_i
|
42
|
-
episodes.include?(episode)
|
43
|
-
end
|
44
|
-
|
45
|
-
expect(torrent_files.length).to_not be torrent_files_count
|
46
|
-
end
|
47
|
-
|
48
|
-
And(/there are (\d+) torrent files? containing "(.+)"/) do |count, string|
|
49
|
-
watch_dir = Miyuki.config['watchDir']
|
50
|
-
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
51
|
-
|
52
|
-
expect(torrent_files.count).to be count.to_i
|
53
|
-
end
|
54
|
-
|
55
|
-
And(/there are (\d+) torrent files? that do not contain "(.+)"/) do |count, string|
|
56
|
-
watch_dir = Miyuki.config['watchDir']
|
57
|
-
torrent_files = Dir["#{watch_dir}/*.torrent"].reject { |f| f.contains?(string) }
|
58
|
-
|
59
|
-
expect(torrent_files.count).to be count.to_i
|
60
|
-
end
|
61
|
-
|
62
|
-
And(/there are some torrent files by "(.+)"/) do |fansub|
|
63
|
-
watch_dir = Miyuki.config['watchDir']
|
64
|
-
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.include?("[#{fansub}]") }
|
65
|
-
|
66
|
-
expect(torrent_files.any?).to be_truthy
|
67
|
-
end
|
68
|
-
|
69
|
-
And(/I consider the currently downloaded torrent files/) do
|
70
|
-
watch_dir = Miyuki.config['watchDir']
|
71
|
-
@previous_torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
72
|
-
end
|
73
|
-
|
74
|
-
Then(/I expect (\d+) torrent files? (have|has) been overwritten/) do |count, plural|
|
75
|
-
watch_dir = Miyuki.config['watchDir']
|
76
|
-
torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
77
|
-
|
78
|
-
expect(@previous_torrent_files_ctime).to match_array(torrent_files_ctime)
|
79
|
-
end
|
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.contains?(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.contains?(string) }
|
15
|
+
|
16
|
+
expect(torrent_files.count).to be >= count.to_i
|
17
|
+
end
|
18
|
+
|
19
|
+
And(/I have not the episodes? (.+) of "(.+)"/) do |episodes, string|
|
20
|
+
watch_dir = Miyuki.config['watchDir']
|
21
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
22
|
+
|
23
|
+
episodes = episodes.split(',').map(&:to_i)
|
24
|
+
|
25
|
+
torrent_files.select! do |f|
|
26
|
+
episode = f.scan(/- [0-9]*\.?[0-9]+/).flatten.last.to_i
|
27
|
+
episodes.include?(episode)
|
28
|
+
end
|
29
|
+
|
30
|
+
expect(torrent_files.empty?).to be_truthy
|
31
|
+
end
|
32
|
+
|
33
|
+
And(/I have the episodes? (.+) of "(.+)"/) do |episodes, string|
|
34
|
+
watch_dir = Miyuki.config['watchDir']
|
35
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
36
|
+
torrent_files_count = torrent_files.length
|
37
|
+
|
38
|
+
episodes = episodes.split(',').map(&:to_i)
|
39
|
+
|
40
|
+
torrent_files.select! do |f|
|
41
|
+
episode = f.scan(/- [0-9]*\.?[0-9]+/).flatten.last.to_i
|
42
|
+
episodes.include?(episode)
|
43
|
+
end
|
44
|
+
|
45
|
+
expect(torrent_files.length).to_not be torrent_files_count
|
46
|
+
end
|
47
|
+
|
48
|
+
And(/there are (\d+) torrent files? containing "(.+)"/) do |count, string|
|
49
|
+
watch_dir = Miyuki.config['watchDir']
|
50
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.contains?(string) }
|
51
|
+
|
52
|
+
expect(torrent_files.count).to be count.to_i
|
53
|
+
end
|
54
|
+
|
55
|
+
And(/there are (\d+) torrent files? that do not contain "(.+)"/) do |count, string|
|
56
|
+
watch_dir = Miyuki.config['watchDir']
|
57
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].reject { |f| f.contains?(string) }
|
58
|
+
|
59
|
+
expect(torrent_files.count).to be count.to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
And(/there are some torrent files by "(.+)"/) do |fansub|
|
63
|
+
watch_dir = Miyuki.config['watchDir']
|
64
|
+
torrent_files = Dir["#{watch_dir}/*.torrent"].select { |f| f.include?("[#{fansub}]") }
|
65
|
+
|
66
|
+
expect(torrent_files.any?).to be_truthy
|
67
|
+
end
|
68
|
+
|
69
|
+
And(/I consider the currently downloaded torrent files/) do
|
70
|
+
watch_dir = Miyuki.config['watchDir']
|
71
|
+
@previous_torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
72
|
+
end
|
73
|
+
|
74
|
+
Then(/I expect (\d+) torrent files? (have|has) been overwritten/) do |count, plural|
|
75
|
+
watch_dir = Miyuki.config['watchDir']
|
76
|
+
torrent_files_ctime = Dir["#{watch_dir}/*.torrent"].map { |f| File.ctime(f) }
|
77
|
+
|
78
|
+
expect(@previous_torrent_files_ctime).to match_array(torrent_files_ctime)
|
79
|
+
end
|