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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/bin/ucli +29 -2
  3. metadata +2 -2
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake'
5
5
  require 'rake/gempackagetask'
6
6
 
7
7
  GEM = "ucli"
8
- GEM_VERSION = "0.2.1"
8
+ GEM_VERSION = "0.2.2"
9
9
  SUMMARY = "Commandline interface to uTorrent WebUI 0.361"
10
10
  AUTHOR = "Georg Alexander Bøe"
11
11
  EMAIL = "georg.boe@gmail.com"
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.0'
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
- Trollop.die("No option selected") unless opts[:list] or opts[:upload] or opts[:download] or opts[:oldepisodes] or opts[:remove] or opts[:ls]
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.1
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-08 00:00:00 -07:00
12
+ date: 2009-05-25 00:00:00 -07:00
13
13
  default_executable: ucli
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency