Class: MultimediaParadise::Audio::ModifyYearOfAudioFile

Inherits:
MultimediaParadise::AudioBase show all
Defined in:
lib/multimedia_paradise/audio/modify_year_of_audio_file.rb

Overview

MultimediaParadise::Audio::ModifyYearOfAudioFile

Constant Summary

Constants inherited from Base

Base::ERROR, Base::ERROR_LINE, Base::NAMESPACE, Base::USE_THIS_NAMESPACE_FOR_THE_COLOURS, Base::USE_THIS_NAMESPACE_FOR_THE_CORE_COLOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MultimediaParadise::AudioBase

#directory_to_the_local_songs?, #return_random_audio_file

Methods inherited from Base

#actions, #append_what_into, #be_silent, #be_verbose?, #beautiful_url, #cartoons_directory?, #clear_the_internal_hash, #cliner, #cliner_with_time_stamp, #colourized_comment, #copy_file, #crimson, #dataset_from_file_video_collection, #dd_mm_yyyy, #debug?, #default_readlines, #directory_to_realvids?, #do_not_use_opn, #dodgerblue, #does_the_video_player_support_this_commandline?, #e, #ecomment, #ecrimson, #efancy, #enable_debug, #ensure_main_encoding, #ensure_that_the_output_directory_exists, #eparse, #erev, #esystem, #ewarn, #file_video_collection?, #filter_for_audio_files, #filter_for_video_files, #forestgreen, #gold, #grey, #hh_mm_ss, #home_x_video?, #indianred, #infer_the_namespace, #internal_hash?, #is_audio_file?, #is_mkv?, #is_mp3?, #is_mp4?, #is_multimedia_file?, #is_on_roebe?, #is_video_file?, #konsole_colour_peru, #lightblue, #lightgreen, #load_yaml, #local_audio_directory?, #log_dir?, #map_symbol_to_locally_existing_file, #mediumorchid, #mediumpurple, #mediumslateblue, #mkdir, #move_file, #namespace?, #no_file_exists, #no_file_exists_at, #olive, #olivedrab, #opne, #opnecomment, #opnn, #orange, #palegoldenrod, #palegreen, #powderblue, #project_base_directory?, #rds, #register_sigint, #remove_file, #report_pwd, #reset_the_internal_hash, #return_all_video_files, #return_pwd, #return_random_video, #rev, #royalblue, #save_what_into, #sdir, #seagreen, #seconds_to_time_format, #select_only_video_files_from, #set_be_verbose, #set_use_colours, #sfancy, #sfile, #simp, #skyblue, #slateblue, #springgreen, #steelblue, #swarn, #teal, #time_right_now, #to_hh_mm_ss, #tomato, #true_rev, #try_to_rename_kde_konsole_tab, #ucliner, #use_colours?, #use_opn?, #use_which_video_player?, #verbose_truth, #video_collection?, #violet, #yaml_directory?, #yel

Methods included from CommandlineArgumentsModule

#all_input_starts_with_a_number?, #commandline_arguments?, #commandline_arguments_as_a_string, #first_argument?, #first_non_hyphened_commandline_argument?, #set_commandline_arguments

Constructor Details

#initialize(i = nil, run_already = true) ⇒ ModifyYearOfAudioFile

#

initialize

#


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 28

def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  case run_already
  # ======================================================================= #
  # === :dont_run_yet
  # ======================================================================= #
  when :dont_run_yet,
       :do_not_run_yet
    run_already = false
  end
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

MultimediaParadise::Audio::ModifyYearOfAudioFile[]

#


125
126
127
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 125

def self.[](i = '')
  new(i)
end

Instance Method Details

#check_the_commandline(i = commandline_arguments? ) ⇒ Object Also known as: check_commandline

#

check_the_commandline

#


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 56

def check_the_commandline(
    i = commandline_arguments?
  )
  if i.empty?
    opne "#{rev}Please provide the year that should be used for the file."
    e
    e 'Usage examples for this:'
    e
    e '  --year 2005'
    e '  modifyyear foobar.mp3 --year 2005'
    e '  modifyyear /home/x/songs/VincentDeMoor_EternityForever.mp3 2000'
    e
  else
    determine_the_year
    modify_the_year
  end
end

#determine_the_yearObject

#

determine_the_year

#


77
78
79
80
81
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 77

def determine_the_year
  set_year(
    commandline_arguments?[1]
  )
end

#modify_the_yearObject

#

modify_the_year

#


86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 86

def modify_the_year
  name_of_the_file = first?
  if File.exist? name_of_the_file
    # ===================================================================== #
    # mid3v2 is part of "mutagen".
    # ===================================================================== #
    _ = "mid3v2 --year=#{year?} #{name_of_the_file}"
    opne "#{rev}Now modifying the file `#{sfile(name_of_the_file)}#{rev}`."
    esystem _
  else
    opnn; no_file_exists_at(name_of_the_file)
  end
end

#resetObject

#

reset (reset tag)

#


48
49
50
51
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 48

def reset
  super()
  infer_the_namespace
end

#runObject

#

run (run tag)

#


118
119
120
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 118

def run
  check_the_commandline
end

#set_this_year(i = nil) ⇒ Object Also known as: set_year

#

set_this_year

#


103
104
105
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 103

def set_this_year(i = nil)
  @this_year = i
end

#this_year?Boolean Also known as: this_year, year?

#

this_year?

#

Returns:

  • (Boolean)


110
111
112
# File 'lib/multimedia_paradise/audio/modify_year_of_audio_file.rb', line 110

def this_year?
  @this_year
end