Sha256: 7046e45816530cf1eea0dd22ec68f34a18f66808f9824df06125b85f91b16052

Contents?: true

Size: 488 Bytes

Versions: 5

Compression:

Stored size: 488 Bytes

Contents

require "retort"
Retort::Service.configure { |c| c.url = Saber::Rc.scgi_server }

module Saber
  module Task
    class Clean < Base
      desc "clean", "clean"
      def clean
        disk_files = Pa.ls2(Rc.clean.dir, absolute: true)
        bt_files = Retort::Torrent.all.map{|t| Retort::Torrent.action("name", t.info_hash) }.map{|n| Pa.join2(Rc.clean.dir, n)}

        (disk_files - bt_files).each { |file|
          Pa.rm_r file, :verbose => true
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saber-1.2.4 lib/saber/task/clean.rb
saber-1.2.3 lib/saber/task/clean.rb
saber-1.2.2 lib/saber/task/clean.rb
saber-1.2.1 lib/saber/task/clean.rb
saber-1.2.0 lib/saber/task/clean.rb