soundcloud-downloader 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/soundcloud-downloader.rb +13 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bcbd8f6795ff9e5a385d22a880ccb06143dbcfb
4
- data.tar.gz: a8270e5b3312299e7d4e82face35bae3a45e66d3
3
+ metadata.gz: 094fb46b3a2684269648e5dfbe25ac0e26d53dd4
4
+ data.tar.gz: 957f3fc82d0b4565f238da6f8fc99115f8a6be8c
5
5
  SHA512:
6
- metadata.gz: 2a4c8b955c2011dd2d1a723a40bcb641f095695a7a644bfeaad90e65020977808c8b8edad62c2697567891da3a6bbf9967673b4a04dbec71f10459710b4d7b01
7
- data.tar.gz: a443052c47264b9c38a320ece0275cf203fb214c428e919220042667045007e7f8953c5430dabfd8f617deaea1d49bf216aa7cbcb9ba9f0d9f634dc87808b1d4
6
+ metadata.gz: e48c9f3b8517e8e9adca10de0c9b6a8971d40b227a5f836b0acbf41a654e397d1218c0de612ba6829c15553ddc561b7e9b61007a5b2cca0c66016a8dd0632a94
7
+ data.tar.gz: d2049d48b7f2cb32741e06d2a8f12eaeca14de6de0b9f986428b90020ca4d6969361d77ac3d7a67f0db521f62d872af232e37ad7d844f6564461483da0d7ba50
@@ -52,6 +52,19 @@ module SoundCloud
52
52
  @url = nil
53
53
  end
54
54
 
55
+ # Public: Simplest method to download a file
56
+ #
57
+ # file_name - The file name as a String
58
+ # url - The stream URL of the soundclound sound as a String
59
+ #
60
+ # Returns a File
61
+ def download(url, opts = { display_progress: true, file_name: "unknown" })
62
+ self.resolve(url)
63
+ self.load opts[:file_name] do |length, position, chunk|
64
+ SoundCloud::Downloader::Helpers.progress_bar("=", ">", position) if opts[:display_progress]
65
+ end
66
+ end
67
+
55
68
  # Public: resolves a soundcloud API url
56
69
  #
57
70
  # url - The URL to resolve as a String.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soundcloud-downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Dehan