Class: MultimediaParadise::VideoMetadata
- Inherits:
-
Base
- Object
- Base
- MultimediaParadise::VideoMetadata
show all
- Defined in:
- lib/multimedia_paradise/video/video_metadata.rb
Overview
Constant Summary
collapse
- NAMESPACE =
inspect
- STORE_INTO_THIS_FILE =
#
STORE_INTO_THIS_FILE
Where to store the information about a video file.
#
'metadata.txt'
Constants inherited
from Base
Base::ERROR, Base::ERROR_LINE, Base::USE_THIS_NAMESPACE_FOR_THE_COLOURS, Base::USE_THIS_NAMESPACE_FOR_THE_CORE_COLOURS
Instance Method Summary
collapse
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
#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(this_file = ARGV, run_already = true) ⇒ VideoMetadata
34
35
36
37
38
39
40
41
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 34
def initialize(
this_file = ARGV,
run_already = true
)
reset
set_main_file(this_file)
run if run_already
end
|
Instance Method Details
#delete_old_file_if_it_exists(i = store_where?)
) ⇒ Object
#
delete_old_file_if_it_exists
#
57
58
59
60
61
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 57
def delete_old_file_if_it_exists(i = store_where?)
if File.exist? i File.delete(i)
end
end
|
#main_file? ⇒ Boolean
Also known as:
input_file?
112
113
114
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 112
def main_file?
@main_file
end
|
#prepend_filename ⇒ Object
#
prepend_filename
This method will prepend the filename into the file.
It will use SaveFile for storing said content.
#
70
71
72
73
74
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 70
def prepend_filename
dataset = read_from_main_file
dataset.prepend 'Filename: '+@main_file+N
write_what_into(dataset, store_where?)
end
|
#read_from_main_file ⇒ Object
79
80
81
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 79
def read_from_main_file
File.read(store_where?)
end
|
#reset ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 46
def reset
super()
@namespace = NAMESPACE
end
|
#run ⇒ Object
119
120
121
122
123
124
125
126
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 119
def run
delete_old_file_if_it_exists
_ = 'ffmpeg -i '+@main_file+' -f ffmetadata '+store_where?
esystem _
prepend_filename
show_content
opnn; e 'Stored into file `'+sfile(store_where?)+'`.'
end
|
#set_main_file(i) ⇒ Object
104
105
106
107
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 104
def set_main_file(i)
i = i.join(' ').strip if i.is_a? Array
@main_file = i
end
|
#show_content ⇒ Object
#
show_content
Display the content to the user.
#
88
89
90
91
92
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 88
def show_content
opnn; e 'We have gathered this information about the file '+
sfile(input_file?)+':'
e simp(read_from_main_file.chomp)
end
|
#store_where? ⇒ Boolean
97
98
99
|
# File 'lib/multimedia_paradise/video/video_metadata.rb', line 97
def store_where?
STORE_INTO_THIS_FILE
end
|