looperman_samples 0.1.7 → 0.1.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/looperman_samples/cli.rb +2 -0
- data/lib/looperman_samples/concerns/cli_methods.rb +5 -2
- data/lib/looperman_samples/creator.rb +2 -1
- data/lib/looperman_samples/sample.rb +3 -0
- data/lib/looperman_samples/sample_scraper.rb +4 -2
- data/lib/looperman_samples/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d51af276e38afab1a32be6c0f2ab825c2d86cfb9e5c3ab8f48635e7379c5c856
|
4
|
+
data.tar.gz: ad45e1aaa9a9849ef8e571c857f1caa05cecfece5403913e9c2f5805be8b24c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcccd70885b93d959bb35df85577b7cb628cabc20512a8e208575bc13ef19675e03f7ad247b7dd30958d60efcead59df97f1671101078caef9b995754cae27bc
|
7
|
+
data.tar.gz: 0d6dc3e89fc29c1e497f5965e04cac6201f7cc4db97ce2dd7f55f41380ecdf331825fee35b6ba3bdfeec68ba821ec4c54cd66e171062511e380f42777462e7c3
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module CliMethods
|
2
|
-
|
2
|
+
|
3
3
|
module Findable
|
4
4
|
def find_all_by_creator(sample) #returns an array of sample objects
|
5
|
-
|
5
|
+
if !sample.creator.scraped
|
6
|
+
LoopermanSamples::SampleScraper.scrape_more_samples_by_creator(sample.creator)
|
7
|
+
end
|
6
8
|
sample.creator.samples
|
7
9
|
end
|
8
10
|
end
|
@@ -27,6 +29,7 @@ module CliMethods
|
|
27
29
|
end
|
28
30
|
|
29
31
|
def list_all_samples_by_creator(sample_objects) #puts samples in numbered list
|
32
|
+
# creator = sample_objects.first.creator
|
30
33
|
sample_objects.each_with_index do |sample, index|
|
31
34
|
puts "#{index + 1}." + " #{sample.title}"
|
32
35
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module LoopermanSamples
|
2
2
|
class Creator
|
3
3
|
|
4
|
-
attr_accessor :name, :samples
|
4
|
+
attr_accessor :name, :samples, :scraped
|
5
5
|
|
6
6
|
@@creators = []
|
7
7
|
|
@@ -10,6 +10,7 @@ module LoopermanSamples
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(name = nil)
|
13
|
+
self.scraped = false
|
13
14
|
@name = name
|
14
15
|
@samples = []
|
15
16
|
@@creators << self
|
@@ -27,6 +27,7 @@ module LoopermanSamples
|
|
27
27
|
|
28
28
|
def self.list_samples_by_key
|
29
29
|
sort_by_key.each_with_index do |item, index|
|
30
|
+
#get rid of this! puts shouldn't be in sample class
|
30
31
|
puts "#{index + 1}." + " #{item.title} - " + "#{item.key}"
|
31
32
|
end
|
32
33
|
end
|
@@ -37,6 +38,7 @@ module LoopermanSamples
|
|
37
38
|
|
38
39
|
def self.list_samples_by_tempo
|
39
40
|
sort_by_tempo.each_with_index do |item, index|
|
41
|
+
#get rid of this! puts shouldn't be in sample class
|
40
42
|
puts "#{index + 1}." + " #{item.title}" + "- #{item.bpm}"
|
41
43
|
end
|
42
44
|
end
|
@@ -47,6 +49,7 @@ module LoopermanSamples
|
|
47
49
|
|
48
50
|
def self.list_samples_by_download_count
|
49
51
|
sort_by_download_count.each_with_index do |item, index|
|
52
|
+
#get rid of this! puts shouldn't be in sample class
|
50
53
|
puts "#{index + 1}." + " #{item.title}" + " - #{item.download_count} downloads"
|
51
54
|
end
|
52
55
|
end
|
@@ -28,20 +28,22 @@ module LoopermanSamples
|
|
28
28
|
the_sample.key = the_sample.key.sub(/(Key)\s[:]\s/, "")
|
29
29
|
end
|
30
30
|
#inserts the sample into the Sample.all array
|
31
|
-
Sample.all << the_sample
|
31
|
+
Sample.all << the_sample #this should happen within initialize statement
|
32
32
|
end
|
33
33
|
#returns all the samples
|
34
|
-
Sample.all
|
34
|
+
Sample.all #unnecessary...
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.scrape_more_samples_by_creator(sample_creator) #dives into samples of a particular creator
|
38
38
|
sample_creator.samples = []
|
39
|
+
puts "scraping more tracks by #{sample_creator.name} *********************"
|
39
40
|
doc = Nokogiri::HTML(open("https://www.looperman.com/loops?mid=#{sample_creator.name}"))
|
40
41
|
doc.css("div#body-content").css("div div.player-wrapper").each do |sample_bundle|
|
41
42
|
the_sample = Sample.new
|
42
43
|
the_sample.title = sample_bundle.css(".player-title").text
|
43
44
|
the_sample.creator = sample_creator
|
44
45
|
end
|
46
|
+
sample_creator.scraped = true
|
45
47
|
end
|
46
48
|
|
47
49
|
end
|