soundyoink 0.0.3 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af141f8ba90235d457f3c120e1972a672526ab8f
4
- data.tar.gz: 2b11d488db76fb48c5fbc42f52bfb2d122e09fff
3
+ metadata.gz: 6bad03133506824e715c20d272509f002c46d285
4
+ data.tar.gz: 99f41cb63400b8cf004fa0f8b8e299d76a17b52d
5
5
  SHA512:
6
- metadata.gz: 827ad6d4c2a90483d817062a46e008114d0e6635a08375b0fea74cf61547b1ea991af87df0b0a6f7d31ae018091cfd19d90f55a5810c720aaf46002d74e8ae45
7
- data.tar.gz: 113a092feb781c40fc895546efab2737b5870d41f24c9c2e36e8307f49b518a0dfba0728e653429ca3d115be6b11e864434694bc6f5a09d7eef62549bae24cc2
6
+ metadata.gz: f88d22cb3f0df2f2801f34ef1c63233aa04094cda76792fa749a708545bccb7c79c282b8c508ea6ed0008e03d11d526b439386c3488bd39a4526cbe878996df4
7
+ data.tar.gz: 89c575746f0a51e1cbcc0e1087814f55426a26c2992229b0e6cb8367b8c1f73acce8e4c11240ce80ecd1d4dd6ae74d5007c2977bb81c50245d33ce3b41cffb57
@@ -8,6 +8,7 @@ module Soundyoink
8
8
  # Drawing the title from the URL is a little uglier than drawing it from
9
9
  # the page text itself, but lets us skip files we already have without
10
10
  # having to request the page. This saves a ton of time on user profiles.
11
+ # @param url [String] URL for a specific audio post.
11
12
  def initialize(url)
12
13
  user = url.match(%r{\/u\/(.+)\/})[1]
13
14
  title = url.match(%r{\/u\/.+\/(.+)})[1]
@@ -1,10 +1,8 @@
1
1
  module Soundyoink
2
-
3
2
  # Manages a queue of Audio instances to be downloaded, and knows how to
4
3
  # create many Audio instances from a user profile link.
5
4
  class Downloader
6
-
7
- # @param workers [Integer] Number of threads to use to work the download queue.
5
+ # @param workers [Integer] Number of download threads to run in parallel.
8
6
  def initialize(workers: 2)
9
7
  @audios = Queue.new
10
8
  @workers = workers
@@ -24,9 +22,11 @@ module Soundyoink
24
22
  # Find every audio link on a user's profile and add them to the queue.
25
23
  # @param profile [String] Link to a user's profile page.
26
24
  def add_profile(profile)
27
- open(profile).read.scan(%r{(https://[^.]+[.]net/u/[^"]+)}).flat_map do |audio|
28
- @audios << Audio.new(audio)
29
- end
25
+ open(profile).read
26
+ .scan(%r{(https://[^.]+[.]net/u/[^"]+)})
27
+ .flatten.map do |a|
28
+ @audios << Audio.new(a)
29
+ end
30
30
  end
31
31
 
32
32
  # +@workers+ number of threads work on the +@audios+ queue in parallel.
@@ -40,7 +40,5 @@ module Soundyoink
40
40
  end
41
41
  worker_threads.map(&:join)
42
42
  end
43
-
44
43
  end
45
-
46
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soundyoink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Plant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Command-line utility for downloading SG material, either specific titles
14
14
  or entire user histories.