georgboe-ucli 0.2.1 → 0.2.2
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/Rakefile +1 -1
- data/bin/ucli +29 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/bin/ucli
CHANGED
@@ -10,7 +10,7 @@ require 'lsfile.rb'
|
|
10
10
|
require 'torrent.rb'
|
11
11
|
require 'utilities.rb'
|
12
12
|
|
13
|
-
PROGRAM_VERSION = '0.2.
|
13
|
+
PROGRAM_VERSION = '0.2.2'
|
14
14
|
|
15
15
|
begin
|
16
16
|
|
@@ -37,10 +37,12 @@ opts = Trollop::options do
|
|
37
37
|
opt :category, "Category for uploaded file", :type => :string, :default => nil
|
38
38
|
opt :oldepisodes, "Show and remove old tv episodes"
|
39
39
|
opt :remove, "Remove torrents by name", :type => :strings
|
40
|
+
opt :ratioremove, "Removes torrent with ratio high than input", :type => :float
|
40
41
|
opt :ls, "Show files for a given torrent", :type => :string
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
+
has_selected_options = [:list, :upload, :oldepisodes, :remove, :ratioremove, :ls].inject(false) { |result, x| opts[x] ? true : result }
|
45
|
+
Trollop.die("No option selected") unless has_selected_options
|
44
46
|
Trollop.die("Category is required for uploaded torrent") if opts[:upload] and !opts[:category]
|
45
47
|
|
46
48
|
if opts[:list]
|
@@ -123,6 +125,31 @@ elsif opts[:remove]
|
|
123
125
|
puts "#{torrent.name} removed."
|
124
126
|
end
|
125
127
|
end
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
elsif opts[:ratioremove]
|
132
|
+
torrents = Torrent.all.reject { |torrent| torrent.ratio.to_f < opts[:ratioremove] }
|
133
|
+
|
134
|
+
if torrents.length == 0
|
135
|
+
puts "No torrents with a ratio above #{opts[:ratioremove]}"
|
136
|
+
exit 1
|
137
|
+
end
|
138
|
+
|
139
|
+
message = "Found the following torrents with ratio above #{opts[:ratioremove]}"
|
140
|
+
|
141
|
+
puts message
|
142
|
+
puts "=" * message.length
|
143
|
+
torrents.each { |torrent| puts "#{torrent.name} (#{torrent.ratio})" }
|
144
|
+
puts
|
145
|
+
should_remove = Utilities.agree?("Are you sure you want to remove these torrents?")
|
146
|
+
|
147
|
+
if should_remove
|
148
|
+
torrents.each do |torrent|
|
149
|
+
torrent.remove
|
150
|
+
puts "#{torrent.name} removed."
|
151
|
+
end
|
152
|
+
end
|
126
153
|
|
127
154
|
elsif opts[:ls]
|
128
155
|
torrents = Torrent.find_by_name(opts[:ls])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: georgboe-ucli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Georg Alexander B\xC3\xB8e"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-25 00:00:00 -07:00
|
13
13
|
default_executable: ucli
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|