matthewtodd-downloads 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/TODO.rdoc +1 -0
- data/bin/downloads +2 -1
- data/lib/downloads/commands/video.rb +48 -0
- data/lib/downloads/commands.rb +2 -1
- data/lib/downloads/servers/remote.rb +1 -1
- data/lib/downloads/tabtab_definitions.rb +5 -0
- metadata +17 -3
data/README.rdoc
CHANGED
@@ -59,8 +59,8 @@ To update these parameters, pass the key and the new value like so:
|
|
59
59
|
*/30 0-5,22-23 * * * downloads sync
|
60
60
|
30 6 * * * downloads sync kill
|
61
61
|
|
62
|
-
4. I
|
62
|
+
4. I used to set up a <b>GeekTool window</b> showing the results of <tt>downloads status</tt>. (If you like, you can bottom-justify this text by piping it through http://gist.github.com/43363.) I've since written <b>a similar tool called HeadsUp</b> that you may appreciate: http://matthewtodd.github.com/heads_up.
|
63
63
|
|
64
|
-
5. Install Downloads on your mail server, and you can set up a special email address, say <tt>big.files@downloads.example.com</tt>, that pipes all its messages through <tt>downloads attachments</tt>. Currently, the messages will be dropped on the floor, but <b>any attachments will be
|
64
|
+
5. Install Downloads on your mail server, and you can set up a special email address, say <tt>big.files@downloads.example.com</tt>, that pipes all its messages through <tt>downloads attachments</tt>. Currently, the messages will be dropped on the floor, but <b>any attachments will be saved into your downloads folder</b>, ready to be sync'ed down.
|
65
65
|
|
66
66
|
6. I've been noodling with some <b>applescripts</b>. Check out the <tt>resources</tt> folder.
|
data/TODO.rdoc
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
* MAYBE download into different buckets? So that I can get podcasts without waiting for, say, a big linux distro.
|
data/bin/downloads
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'hpricot'
|
3
|
+
|
4
|
+
# TODO could remove duplication with Add command, perhaps by seeing this as a filter of sorts...
|
5
|
+
module Downloads
|
6
|
+
module Commands
|
7
|
+
class Video < Base
|
8
|
+
attr_accessor :uris
|
9
|
+
|
10
|
+
def self.usage
|
11
|
+
"#{super} URL ..."
|
12
|
+
end
|
13
|
+
|
14
|
+
def configure(argv)
|
15
|
+
self.uris = []
|
16
|
+
while uri = shift_argument(argv)
|
17
|
+
self.uris << parse_uri(uri)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
remote.run("wget '#{download_uris.join("' '")}' --no-check-certificate")
|
23
|
+
end
|
24
|
+
|
25
|
+
def valid?
|
26
|
+
download_uris.any?
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def download_uris
|
32
|
+
@download_uris ||= uris.map do |uri|
|
33
|
+
open(keepvid(uri)) { |stream| Hpricot(stream).at('a.link').attributes['href'] }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def keepvid(uri)
|
38
|
+
"http://keepvid.com/?url=#{uri}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def parse_uri(uri)
|
42
|
+
URI.parse(uri)
|
43
|
+
rescue URI::InvalidURIError => error
|
44
|
+
puts error.message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/downloads/commands.rb
CHANGED
@@ -52,4 +52,9 @@ TabTab::Definition.register('downloads') do |c|
|
|
52
52
|
c.command(:sync) do |sync|
|
53
53
|
sync.command :kill
|
54
54
|
end
|
55
|
+
|
56
|
+
# FIXME waiting for tabtab to support completion for multiple filenames
|
57
|
+
c.command(:video) do |add|
|
58
|
+
add.default { clipboard_contents.grep(/^http:/) }
|
59
|
+
end
|
55
60
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matthewtodd-downloads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Todd
|
@@ -9,11 +9,22 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-14 00:00:00 -08:00
|
13
13
|
default_executable: downloads
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hpricot
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.6.164
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: net-ssh
|
27
|
+
type: :runtime
|
17
28
|
version_requirement:
|
18
29
|
version_requirements: !ruby/object:Gem::Requirement
|
19
30
|
requirements:
|
@@ -23,6 +34,7 @@ dependencies:
|
|
23
34
|
version:
|
24
35
|
- !ruby/object:Gem::Dependency
|
25
36
|
name: tabtab
|
37
|
+
type: :runtime
|
26
38
|
version_requirement:
|
27
39
|
version_requirements: !ruby/object:Gem::Requirement
|
28
40
|
requirements:
|
@@ -32,6 +44,7 @@ dependencies:
|
|
32
44
|
version:
|
33
45
|
- !ruby/object:Gem::Dependency
|
34
46
|
name: tmail
|
47
|
+
type: :runtime
|
35
48
|
version_requirement:
|
36
49
|
version_requirements: !ruby/object:Gem::Requirement
|
37
50
|
requirements:
|
@@ -64,6 +77,7 @@ files:
|
|
64
77
|
- lib/downloads/commands/shell.rb
|
65
78
|
- lib/downloads/commands/status.rb
|
66
79
|
- lib/downloads/commands/sync.rb
|
80
|
+
- lib/downloads/commands/video.rb
|
67
81
|
- lib/downloads/commands.rb
|
68
82
|
- lib/downloads/configuration.rb
|
69
83
|
- lib/downloads/servers/local.rb
|
@@ -82,7 +96,7 @@ rdoc_options:
|
|
82
96
|
- --main
|
83
97
|
- README.rdoc
|
84
98
|
- --title
|
85
|
-
- downloads-0.6.
|
99
|
+
- downloads-0.6.9
|
86
100
|
- --inline-source
|
87
101
|
- --line-numbers
|
88
102
|
require_paths:
|