miyuki 0.1.2 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49ce37e33393def966916d5ca1881a2ec36acaf4
4
- data.tar.gz: 7fdb4d5e4ce03722a1d5c9a7344746d026276f7c
3
+ metadata.gz: a738dc0caf96d28fc8b3807262a1ac9cf8c2a9c0
4
+ data.tar.gz: a3b604faf11c4e3470d4055fdeadcb457323080f
5
5
  SHA512:
6
- metadata.gz: b9beb6a9deafab601d1bada8f2e34096c3dae96c6a56b4f64a69383e9c781f75f67543a1eefe0ede3eba825a847505756aa55e430852b0ba3ea8ece0b5d45fe1
7
- data.tar.gz: 4665c5c9ef29a6babb513bb758c3526ed7397c0f4daae66eaa433571a4d0df0f7e8a4ffd78c851208df394f27a5a8d881b938364693ae2ceb756e6760c55f4ad
6
+ metadata.gz: 52e7cd31f0bcee2b41e9d72bcf012db2fe231ec420abed99c75dfaf6048c92a07282f8161e3c2f5ed8d27267fa22117667dbf116dea3e8a09af360942270d77d
7
+ data.tar.gz: 83cd396adc61d5f6c077ac184cb0e99257ce01d621f2b8a3bb1ad9e83ae522a29bf51eaab7d6a3f365ead4604a6e385066d958afc0593facaeb46ff5be72ea42
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rufus-scheduler'
4
+ gem 'yamazaki', '>= 0.3'
5
+ gem 'foreverb'
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ color (1.7.1)
5
+ colorb (0.0.9)
6
+ color
7
+ foreverb (0.3.2)
8
+ thor (>= 0.15.0)
9
+ rufus-scheduler (3.0.9)
10
+ tzinfo
11
+ thor (0.19.1)
12
+ thread_safe (0.3.4)
13
+ tzinfo (1.2.2)
14
+ thread_safe (~> 0.1)
15
+ yamazaki (0.3)
16
+ colorb (~> 0)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ foreverb
23
+ rufus-scheduler
24
+ yamazaki (>= 0.3)
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ Miyuki – Non ti lascia mai solo
2
+ ===============================
3
+
4
+ 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.
5
+
6
+ Of course, set the watch directory inside the configuration file to the one you've set in your torrent client.
7
+
8
+ How to use
9
+ ----------
10
+ `$ gem install miyuki`
11
+
12
+ `$ miyuki start example/miyuki.conf`
13
+
14
+ `$ miyuki stop` (or `$ miyuki kill`)
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ #! /usr/bin/env ruby
2
+ require 'rake'
3
+
4
+ task default: [ :build, :install ]
5
+
6
+ task :build do
7
+ sh 'gem build *.gemspec'
8
+ end
9
+
10
+ task :install do
11
+ sh 'gem install *.gem'
12
+ end
data/bin/miyuki CHANGED
@@ -1,22 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
  ##
3
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
4
- # Version 2, December 2004
3
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
4
+ # Version 2, December 2004
5
5
  #
6
6
  # Everyone is permitted to copy and distribute verbatim or modified
7
7
  # copies of this license document, and changing it is allowed as long
8
8
  # as the name is changed.
9
9
  #
10
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
10
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
12
  #
13
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
14
14
  ##
15
15
 
16
16
  require 'miyuki'
17
+ require 'forever'
17
18
 
18
- abort 'Please provide a configuration file.' if ARGV.empty?
19
- abort 'Given configuration file does not exist.' unless File.exists?(ARGV[0])
19
+ config_file = File.expand_path(ARGV.last) if ARGV.any?
20
20
 
21
- Miyuki.config = File.expand_path(ARGV[0])
22
- Miyuki.track!
21
+ unless ['kill', 'stop'].include?(ARGV[0])
22
+ abort 'Please provide a configuration file.' if ARGV.length <= 1
23
+ abort 'Given configuration file does not exist.' unless File.exists?(config_file)
24
+ end
25
+
26
+ Forever.run do
27
+ dir File.expand_path('..', __FILE__)
28
+ log File.join(dir, '/miyuki.log')
29
+ pid File.join(dir, '/miyuki.pid')
30
+
31
+ before :all do
32
+ Miyuki.config = config_file
33
+ Miyuki.track!
34
+ end
35
+ end
@@ -0,0 +1,12 @@
1
+ configuration:
2
+ watchDir: "~/.watch"
3
+ refreshEvery: 1h
4
+
5
+ series:
6
+ - name: Nisekoi
7
+ fansub: Commie
8
+
9
+ - name: Nisekoi
10
+ fansub: Commie
11
+ res: 1080p
12
+ pattern: "[$fansub] $name - Volume [BD $res AAC]"
data/lib/miyuki/miyuki.rb CHANGED
@@ -1,29 +1,31 @@
1
1
  ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
4
  #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
8
  #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
11
  #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
15
15
  module Miyuki
16
16
  class << self
17
17
  def config=(config_file)
18
- @@config_file = config_file
19
- @@config = load_config
18
+ @config_file = config_file
19
+ @config = load_config
20
20
 
21
21
  Rufus::Scheduler.singleton.every('10m') { refresh_config! }
22
22
  end
23
23
 
24
24
  def track!
25
- watch_dir = File.expand_path(@@config['configuration']['watchDir'])
26
- @@tracker = Tracker.new(watch_dir, @@config['series'])
25
+ watch_dir = File.expand_path(@config['configuration']['watchDir'])
26
+ FileUtils.mkdir_p(watch_dir) unless File.directory?(watch_dir)
27
+
28
+ @tracker = Tracker.new(watch_dir, @config['series'])
27
29
 
28
30
  run_scheduler
29
31
  end
@@ -33,32 +35,32 @@ module Miyuki
33
35
  def refresh_config!
34
36
  new_config = load_config
35
37
 
36
- if @@config != new_config
37
- @@config = new_config
38
- @@scheduler.pause if defined?(@@scheduler)
38
+ if @config != new_config
39
+ @config = new_config
40
+ @scheduler.pause if defined?(@scheduler)
39
41
  track!
40
42
  end
41
43
  end
42
44
 
43
45
  def load_config
44
- YAML.load(File.read(@@config_file))
46
+ YAML.load(File.read(@config_file))
45
47
  end
46
48
 
47
49
  def run_scheduler
48
- @@scheduler = Rufus::Scheduler.new
49
- @@scheduler.every @@config['configuration']['refreshEvery'] do
50
- old_torrents = @@tracker.torrents
50
+ @scheduler = Rufus::Scheduler.new
51
+ @scheduler.every @config['configuration']['refreshEvery'] do
52
+ old_torrents = @tracker.torrents
51
53
 
52
- @@tracker.refresh
54
+ @tracker.refresh
53
55
 
54
- new_torrents = @@tracker.torrents - old_torrents
56
+ new_torrents = @tracker.torrents - old_torrents
55
57
  if new_torrents.any?
56
58
  puts 'New torrents:'
57
59
  new_torrents.each { |torrent| puts torrent.to_s }
58
60
  end
59
61
  end
60
62
 
61
- @@scheduler.join
63
+ @scheduler.join
62
64
  end
63
65
  end
64
66
  end
@@ -1,15 +1,15 @@
1
1
  ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
4
  #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
8
  #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
11
  #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
15
15
  module Miyuki
@@ -26,8 +26,6 @@ module Miyuki
26
26
  refresh
27
27
  end
28
28
 
29
- private
30
-
31
29
  def refresh
32
30
  @torrents = []
33
31
 
@@ -35,6 +33,8 @@ module Miyuki
35
33
  @torrents.each { |torrent| Yamazaki.download_torrent(torrent.title, torrent.link) }
36
34
  end
37
35
 
36
+ private
37
+
38
38
  def fetch_torrents
39
39
  @series.each do |series|
40
40
  pattern = pattern_of(series)
@@ -1,17 +1,17 @@
1
1
  ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
4
  #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
8
  #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
11
  #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
15
15
  module Miyuki
16
- VERSION = '0.1.2'
16
+ VERSION = '0.2'
17
17
  end
data/lib/miyuki.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  ##
2
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
- # Version 2, December 2004
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
4
  #
5
5
  # Everyone is permitted to copy and distribute verbatim or modified
6
6
  # copies of this license document, and changing it is allowed as long
7
7
  # as the name is changed.
8
8
  #
9
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
11
  #
12
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
12
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
13
13
  ##
14
14
 
15
+ require 'fileutils'
15
16
  require 'yaml'
16
17
  require 'rufus-scheduler'
17
18
  require 'yamazaki'
data/miyuki.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ Kernel.load 'lib/miyuki/version.rb'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'miyuki'
5
+ s.version = Miyuki::VERSION
6
+ s.author = 'Roxas Shadow'
7
+ s.email = 'webmaster@giovannicapuano.net'
8
+ s.homepage = 'https://github.com/RoxasShadow/Miyuki'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'Miyuki allows you to not miss any episode of anime you\'re watching'
11
+ s.description = 'Miyuki downloads automatically every episode of anime you\'re watching'
12
+ s.files = `git ls-files -z`.split("\0")
13
+ s.require_path = 'lib'
14
+ s.executables = 'miyuki'
15
+ s.license = 'WTFPL'
16
+
17
+ s.add_dependency 'yamazaki', '~> 0.3'
18
+ s.add_dependency 'rufus-scheduler', '~> 3.0'
19
+ s.add_dependency 'foreverb', '~> 0.3'
20
+ 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.1.2
4
+ version: '0.2'
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-11-22 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yamazaki
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: foreverb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
41
55
  description: Miyuki downloads automatically every episode of anime you're watching
42
56
  email: webmaster@giovannicapuano.net
43
57
  executables:
@@ -45,12 +59,18 @@ executables:
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
62
+ - Gemfile
63
+ - Gemfile.lock
64
+ - README.md
65
+ - Rakefile
48
66
  - bin/miyuki
67
+ - example/miyuki.conf
49
68
  - lib/miyuki.rb
50
69
  - lib/miyuki/miyuki.rb
51
70
  - lib/miyuki/tracker.rb
52
71
  - lib/miyuki/version.rb
53
- homepage: https://github.com/RoxasShadow
72
+ - miyuki.gemspec
73
+ homepage: https://github.com/RoxasShadow/Miyuki
54
74
  licenses:
55
75
  - WTFPL
56
76
  metadata: {}