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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 719b14ef8291c898ba513adf033b0efa82896dd7
4
- data.tar.gz: f5bcc287ecb395b49632e757e146e9711708f695
2
+ SHA256:
3
+ metadata.gz: 52fc895e1a83f7d0fbefd2bda3c7f99de8b1c5965308fa017b69a4741ab48aa6
4
+ data.tar.gz: 8377e8844c19a6edffe62766ff699d726fe9a6aa1e73f619747729a2c682211f
5
5
  SHA512:
6
- metadata.gz: 8c6cf32a44187e8dc76d8e0f82a451872c48d257d0a5ae3a1a0c1ae9cccd01fc4280c75d0fc7b837ebb7b9e4979d5c52bea58b1c4bee5d6f70b180d8ab27f215
7
- data.tar.gz: 9e60e3c48749ea32b5855e05aed26f8c2bb6a7ed337ddc6221628a25a72a7e0dcd9ef3fe87d1f00f7928f6c35ee05209df955f4b5e969c6722d5a39ac2d6c242
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', '>= 0.3.3'
6
+ gem 'yamazaki'
6
7
  gem 'foreverb'
7
8
  gem 'terminal-notifier'
8
9
  gem 'libnotify'
9
10
  gem 'rb-notifu'
10
- gem 'filewatcher', '>= 0.3.6'
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
- refreshEvery: 1h
3
- notifications:
4
- enabled: true
5
-
6
- series:
7
- - name: Mekakucity
8
- fansub: Commie
9
- episodes:
10
- from: 9
11
- skipIfNotSure: true # default: false (download anyway)
12
-
13
- - name: Nisekoi
14
- fansub: Commie
15
- res: 1080p
16
- pattern: "[$fansub] $name - Volume [BD $res AAC]"
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
- Then(/^Miyuki reloads her configuration/) do
32
- expect(Miyuki.config).to_not be equal(@previous_config)
33
- expect(Miyuki.config['refreshEvery']).to_not be @previous_config['refreshEvery']
34
- end
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
- 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
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