soundyoink 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soundyoink/audio.rb +1 -0
- data/lib/soundyoink/downloader.rb +6 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bad03133506824e715c20d272509f002c46d285
|
4
|
+
data.tar.gz: 99f41cb63400b8cf004fa0f8b8e299d76a17b52d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f88d22cb3f0df2f2801f34ef1c63233aa04094cda76792fa749a708545bccb7c79c282b8c508ea6ed0008e03d11d526b439386c3488bd39a4526cbe878996df4
|
7
|
+
data.tar.gz: 89c575746f0a51e1cbcc0e1087814f55426a26c2992229b0e6cb8367b8c1f73acce8e4c11240ce80ecd1d4dd6ae74d5007c2977bb81c50245d33ce3b41cffb57
|
data/lib/soundyoink/audio.rb
CHANGED
@@ -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
|
28
|
-
|
29
|
-
|
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.
|
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
|
+
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.
|