c3d 0.4.2 → 0.4.3
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/bin/c3d +10 -0
- data/lib/c3d/util/blobber.rb +6 -3
- data/lib/c3d/version.rb +1 -1
- data/lib/c3d.rb +13 -0
- 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: cba87cfada3d0f209978c188472b608ca9b5ed4d
|
4
|
+
data.tar.gz: a6fb9de8ad38c14c5bdc54e9256a1643f280e800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a768247dc03572a96150790826ecc29f6e980df222e712eb04119a0af74afbb1009064423cedc7471c11464788b01e06ad7b46a18dd3db7ad794a03aac76525
|
7
|
+
data.tar.gz: 0f554543ddd4f1bef4e66944ea80bac244f301f8cc94edac0381e2aa56ba09b5914c623e289c56bf7a645a29bc37e359f9b893d44f3f095662835bf758b13c09
|
data/bin/c3d
CHANGED
@@ -37,4 +37,14 @@ command :restart do |c|
|
|
37
37
|
C3D.restart
|
38
38
|
print "Server has been restarted.\n"
|
39
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
command :blob do |c|
|
44
|
+
c.syntax = 'c3d blob'
|
45
|
+
c.summary = ''
|
46
|
+
c.description = 'Blob a file and throw into the default torrent client.'
|
47
|
+
c.action do |args|
|
48
|
+
mag_link = C3D.blob args
|
49
|
+
end
|
40
50
|
end
|
data/lib/c3d/util/blobber.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
module C3D
|
6
6
|
class Blobber
|
7
7
|
include Celluloid
|
8
|
-
attr_accessor :tor_file, :blob_file, :sha1_trun, :btih
|
8
|
+
attr_accessor :tor_file, :blob_file, :sha1_trun, :btih, :mag_link
|
9
9
|
|
10
10
|
def initialize blob
|
11
11
|
@piecelength = 32 * 1024
|
@@ -20,6 +20,9 @@ module C3D
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def prepare blob
|
23
|
+
if File.exists? blob
|
24
|
+
blob = File.read blob
|
25
|
+
end
|
23
26
|
sha1_full = Digest::SHA1.hexdigest blob
|
24
27
|
@sha1_trun = sha1_full[0..23]
|
25
28
|
@tor_file = File.join(ENV['TORRENTS_DIR'], "#{sha1_trun}.torrent")
|
@@ -77,8 +80,8 @@ module C3D
|
|
77
80
|
rescue
|
78
81
|
@btih = torrent["torrent-duplicate"]['hashString']
|
79
82
|
end
|
80
|
-
mag_link = "magnet:?xt=urn:btih:" + @btih + "&dn=" + @sha1_trun
|
81
|
-
puts "[C3D-EPM::#{Time.now.strftime( "%F %T" )}] Magnet Link >>\t\t" + mag_link
|
83
|
+
@mag_link = "magnet:?xt=urn:btih:" + @btih + "&dn=" + @sha1_trun
|
84
|
+
puts "[C3D-EPM::#{Time.now.strftime( "%F %T" )}] Magnet Link >>\t\t" + @mag_link
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|
data/lib/c3d/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION ||= "0.4.
|
1
|
+
VERSION ||= "0.4.3"
|
data/lib/c3d.rb
CHANGED
@@ -49,6 +49,19 @@ module C3D
|
|
49
49
|
C3D.start
|
50
50
|
end
|
51
51
|
|
52
|
+
def blob args
|
53
|
+
C3D::SetupC3D.new
|
54
|
+
opts = { username: ENV['TORRENT_USER'],
|
55
|
+
password: ENV['TORRENT_PASS'],
|
56
|
+
url: ENV['TORRENT_RPC'] }
|
57
|
+
$puller = C3D::ConnectTorrent.new opts
|
58
|
+
until args.empty?
|
59
|
+
file = args.shift
|
60
|
+
c = C3D::Blobber.new file
|
61
|
+
print "The magnet link for the file is: #{c.mag_link}\n"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
52
65
|
def version
|
53
66
|
return VERSION
|
54
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c3d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Casey Kuhlman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|