class MultimediaParadise::Video::RenameVideoFile
Public Class Methods
Public Instance Methods
determine_extension_name()
click to toggle source
extension_name?()
click to toggle source
file?()
click to toggle source
#¶ ↑
file?¶ ↑
#¶ ↑
# File lib/multimedia_paradise/video/rename_video_file.rb, line 112 def file? @file end
Also aliased as: old_filename?
reset()
click to toggle source
run()
click to toggle source
sanitize_search_term(i = @search_term)
click to toggle source
#¶ ↑
sanitize_search_term
¶ ↑
This method is ultimately not needed, but I wanted to just chop down the input file to make it smaller.
#¶ ↑
# File lib/multimedia_paradise/video/rename_video_file.rb, line 78 def sanitize_search_term(i = @search_term) if i i.downcase! i.gsub!(/\.x264/,'') if i.include? '.x264' i.gsub!(/\.extended/,'') if i.include? '.extended' i.gsub!(/\.remastered/,'') if i.include? '.remastered' i.gsub!(/\.2000\.720p\.brrip\.bokutox\.yify/,'') # ===================================================================== # # Chop off file Extensions. # ===================================================================== # i.gsub!(/\.mp4$/,'') if i.end_with? '.mp4' @search_term = i end end
search_term?()
click to toggle source
set_file(i)
click to toggle source
set_search_term(i = @file)
click to toggle source
try_to_find_corresponding_video_file()
click to toggle source
#¶ ↑
try_to_find_corresponding_video_file
¶ ↑
#¶ ↑
# File lib/multimedia_paradise/video/rename_video_file.rb, line 119 def try_to_find_corresponding_video_file results = MultimediaParadise::FindVideo[search_term?] unless results.empty? new_file_name = results.first.first position = results.first.last opn; e 'We found a result, thus we will rename.' new_file_name = position+'_'+new_file_name+extension_name? opn; e 'The new file name will be:' rename_file(old_filename?, new_file_name) _ = realvids_directory? if File.directory?(_) and !File.exist?(_+File.basename(new_file_name)) target = _+File.basename(new_file_name) opn; e 'Also copying to '+sfile(target)+' next.' copy_file(new_file_name, target) end end end