cherrypicker 0.1.4 → 0.1.5
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.
- data/.gitignore +2 -1
- data/README.md +4 -1
- data/lib/cherrypicker/download.rb +5 -4
- data/lib/cherrypicker/hotfile.rb +4 -3
- data/lib/cherrypicker/rapidshare.rb +4 -3
- data/lib/cherrypicker/version.rb +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,10 @@ Examples
|
|
29
29
|
|
30
30
|
check = LinkChecker.new([
|
31
31
|
"http://rapidshare.com/files/329036215/myfile.rar",
|
32
|
-
"http://rapidshare.com/files/329036764/deadfile.rar"]).status
|
32
|
+
"http://rapidshare.com/files/329036764/deadfile.rar"]).status
|
33
|
+
|
34
|
+
test3 = Rapidshare.new("http://rapidshare.com/files/329036215/myfile.rar", "username", "password", "size", "location")
|
35
|
+
test3.download
|
33
36
|
|
34
37
|
Contributing
|
35
38
|
------------
|
@@ -5,14 +5,15 @@ require 'net/http'
|
|
5
5
|
require 'progressbar'
|
6
6
|
|
7
7
|
class Download
|
8
|
-
attr_accessor :hostname, :url, :filename, :size, :progress
|
8
|
+
attr_accessor :hostname, :url, :filename, :size, :progress, :location
|
9
9
|
|
10
|
-
def initialize(hostname, url, filename, size = nil)
|
10
|
+
def initialize(hostname, url, filename, size = nil, location = nil)
|
11
11
|
@hostname = hostname
|
12
12
|
@url = url
|
13
13
|
@filename = filename
|
14
14
|
@size = size
|
15
|
-
@
|
15
|
+
@location = location
|
16
|
+
@progress = 0
|
16
17
|
|
17
18
|
download_file
|
18
19
|
end
|
@@ -23,7 +24,7 @@ private
|
|
23
24
|
http = Net::HTTP.new("#{self.hostname}")
|
24
25
|
http.request_get("#{self.url}") do |response|
|
25
26
|
bar = ProgressBar.new("#{self.filename}", self.size.to_i)
|
26
|
-
File.open("#{self.filename}", "wb") do |file|
|
27
|
+
File.open("#{self.location}" + "#{self.filename}", "wb") do |file|
|
27
28
|
response.read_body do |segment|
|
28
29
|
self.progress += segment.length
|
29
30
|
bar.set(self.progress)
|
data/lib/cherrypicker/hotfile.rb
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
# puts hotfile.hostname
|
6
6
|
# hotfile.download
|
7
7
|
class Hotfile
|
8
|
-
attr_accessor :link, :hostname, :filename, :username, :password, :size
|
8
|
+
attr_accessor :link, :hostname, :filename, :username, :password, :size, :location
|
9
9
|
|
10
|
-
def initialize(link, username, password, size = nil)
|
10
|
+
def initialize(link, username, password, size = nil, location = "")
|
11
11
|
if link =~ /hotfile.com\/dl\/\d*\/[0-9a-f]*\/.*.*\.html/
|
12
12
|
@link = link[/(.*)\.html/, 1]
|
13
13
|
else
|
@@ -18,10 +18,11 @@ class Hotfile
|
|
18
18
|
@hostname = hostname
|
19
19
|
@filename = filename
|
20
20
|
@size = size
|
21
|
+
@location = location
|
21
22
|
end
|
22
23
|
|
23
24
|
def download
|
24
|
-
Download.new(self.hostname, remote_url, self.filename, self.size)
|
25
|
+
Download.new(self.hostname, remote_url, self.filename, self.size, self.location)
|
25
26
|
end
|
26
27
|
|
27
28
|
def filename
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# puts rapid.host
|
8
8
|
# rapid.download
|
9
9
|
class Rapidshare
|
10
|
-
attr_accessor :link, :fileid, :filename, :hostname, :username, :password, :size
|
10
|
+
attr_accessor :link, :fileid, :filename, :hostname, :username, :password, :size, :location
|
11
11
|
|
12
|
-
def initialize(link, username, password, size = nil)
|
12
|
+
def initialize(link, username, password, size = nil, location = "")
|
13
13
|
@link = link
|
14
14
|
@fileid = fileid
|
15
15
|
@filename = filename
|
@@ -17,10 +17,11 @@ class Rapidshare
|
|
17
17
|
@username = username
|
18
18
|
@password = password
|
19
19
|
@size = size
|
20
|
+
@location = location
|
20
21
|
end
|
21
22
|
|
22
23
|
def download
|
23
|
-
Download.new(self.hostname, remote_url, self.filename, self.size)
|
24
|
+
Download.new(self.hostname, remote_url, self.filename, self.size, self.location)
|
24
25
|
end
|
25
26
|
|
26
27
|
def fileid
|
data/lib/cherrypicker/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cherrypicker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Karl Entwistle
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-07 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|