miyuki 0.5.3 → 0.5.4

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: e8d12566ada7af101b2899243788af5bbd66823d
4
- data.tar.gz: bee74de42bd0226f6113033af03db665fbabc8fc
3
+ metadata.gz: ece863c7d2c499fd826a696bdf7b68f2a1e99d2a
4
+ data.tar.gz: 6e30d0fafe4d5a7b0df6ef07525060a10c6ef931
5
5
  SHA512:
6
- metadata.gz: 8b24d0636cb778efb53a3d8b3fd24bda42a7d4663d1cd444cb361e74fb65b4eab87adb5cf4ae0db0c2d4f7b398571ff21855d9f988496047d809139db6eb97a2
7
- data.tar.gz: 0560f862e9b91e7075b22b26270abdb44608a6fb3a30be0b8dd15d11aff5b23f87a7ebb316399357e3ad217caa0de88f65450e72f1a407fa53f6e3b520204044
6
+ metadata.gz: 979c27a62c7d15902d0fc1b4b88548c85f0379c2fd25ce148e308d7277f399e35feda378a26ba4e4174da36ff2dd846369dd93cf202e33aea176536cc400ba5b
7
+ data.tar.gz: bddbbe6458a66a4297ed8273a6b34973dacc6ef2fd2f595b5870be0591c2b740f3490fda934e644856f4093918c6443cf3a568a636d300c0724b88e66a62cd13
@@ -15,5 +15,5 @@ After do |s|
15
15
  watch_dir = 'features/support/testWatchDir'
16
16
  FileUtils.rm_r(watch_dir) if Dir.exists?(watch_dir)
17
17
 
18
- Cucumber.wants_to_quit = true if s.failed?
18
+ # Cucumber.wants_to_quit = true if s.failed? # TODO: Uncomment this when filewatcher will be fixed
19
19
  end
data/lib/miyuki/miyuki.rb CHANGED
@@ -39,7 +39,7 @@ module Miyuki
39
39
  notify_torrents(torrent)
40
40
  end
41
41
 
42
- run_scheduler!
42
+ @tracker.refresh! && run_scheduler!
43
43
  end
44
44
 
45
45
  private
@@ -55,15 +55,6 @@ module Miyuki
55
55
  end
56
56
  end
57
57
 
58
- def refresh_torrents
59
- old_torrents = @tracker.torrents
60
-
61
- @tracker.refresh
62
- @tracker.remove_duplicates_from(old_torrents)
63
-
64
- old_torrents.each { |new_torrent| notify_torrents(new_torrent) }
65
- end
66
-
67
58
  def load_config
68
59
  YAML.load(File.read(@config_file))
69
60
  end
@@ -72,7 +63,7 @@ module Miyuki
72
63
  @scheduled_job.kill if @scheduled_job
73
64
 
74
65
  scheduler = Rufus::Scheduler.new
75
- @scheduled_job = scheduler.schedule_every @config['refreshEvery'] { refresh_torrents }
66
+ @scheduled_job = scheduler.schedule_every @config['refreshEvery'] { @tracker.refresh! }
76
67
  scheduler.join if @join_scheduler != false
77
68
  end
78
69
 
@@ -24,8 +24,6 @@ module Miyuki
24
24
 
25
25
  @series = series || []
26
26
  @callback = callback if block_given?
27
-
28
- refresh
29
27
  end
30
28
 
31
29
  def for_every_torrent(&callback)
@@ -36,10 +34,13 @@ module Miyuki
36
34
  end
37
35
  end
38
36
 
39
- def refresh
37
+ def refresh!
38
+ old_torrents = @torrents || []
39
+
40
40
  @torrents = []
41
41
 
42
42
  fetch_torrents!
43
+ @torrents -= old_torrents
43
44
 
44
45
  @torrents.each do |torrent|
45
46
  downloaded = Yamazaki.download_torrent(torrent.title, torrent.link)
@@ -48,12 +49,6 @@ module Miyuki
48
49
  end
49
50
  end
50
51
 
51
- def remove_duplicates_from(other_torrents)
52
- other_torrents.delete_if do |torrent|
53
- @torrents.select { |other_torrent| torrent.link == other_torrent.link }.any?
54
- end
55
- end
56
-
57
52
  private
58
53
 
59
54
  def fetch_torrents!
@@ -13,5 +13,5 @@
13
13
  ##
14
14
 
15
15
  module Miyuki
16
- VERSION = '0.5.3'
16
+ VERSION = '0.5.4'
17
17
  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.5.3
4
+ version: 0.5.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-29 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yamazaki