Sha256: 1dae4a98d2fc6c9f042d6b960f70e70ea817cc4a6e8ed9edfcf1e21039830fb9

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

=begin
Copyright 2010, Roger Pack 
This file is part of Sensible Cinema.

    Sensible Cinema is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Sensible Cinema is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Sensible Cinema.  If not, see <http://www.gnu.org/licenses/>.
=end
require 'digest/md5'
require 'ruby-wmi'
require 'ostruct'

class DriveInfo

 def self.md5sum_disk(dir)
  digest = Digest::MD5.new()
  files  = Dir[dir + "VIDEO_TS/*.IFO"]
  files.sort.each{|f|
    digest << File.binread(f) 
  }
  raise 'drive might not yet have disc in it? ' + dir unless files.length > 0
  digest.hexdigest
 end

 def self.get_dvd_drives_as_openstruct
   disks = WMI::Win32_LogicalDisk.find(:all)
   disks.select{|d| d.Description =~ /CD-ROM/}.map{|d| d2 = OpenStruct.new; d2.VolumeName = d.VolumeName; d2.Name = d.Name; d2}
 end
  
def self.get_drive_with_most_space_with_slash
  disks = WMI::Win32_LogicalDisk.find(:all)
  most_space = disks.sort_by{|d| d.FreeSpace.to_i}[-1]
  most_space.Name + "\\"
end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sensible-cinema-0.21.9 lib/drive_info.rb
sensible-cinema-0.21.5 lib/drive_info.rb
sensible-cinema-0.21.4 lib/drive_info.rb
sensible-cinema-0.21.3 lib/drive_info.rb
sensible-cinema-0.20.5 lib/drive_info.rb
sensible-cinema-0.20.1 lib/drive_info.rb
sensible-cinema-0.20.0 lib/drive_info.rb
sensible-cinema-0.19.7 lib/drive_info.rb
sensible-cinema-0.19.6 lib/drive_info.rb
sensible-cinema-0.19.5 lib/drive_info.rb
sensible-cinema-0.19.4 lib/drive_info.rb