mik
mik copied to clipboard
Provide an option in CSV toolchains to use assigned numbers as output filenames
CSV Single File toolchain allows either the use of the value defined in the record_key
.ini option or the original filename as well as the preserve_content_filenames
option. However, we are getting CSV files from content owners that have identifiers and filenames that contain spaces. Consequently, MIK produces output packages that have spaces in the filenames, something which we don't want.
We should provide an option to have MIK name the output files using simple incremented numbers, maybe the row number of the record in the CSV. This could be an option that is registered in the [WRITER]
section using assign_output_filenames = true
or similar.
@mjordan Would this task be better addressed using a postwritehook or via the new shutdown hook mechanisms?
Could be addressed using either, but I'm not sure about "better" since if we use the row number in the CSV, the filename will have some traceable relation to the row. I guess the same thing could be done via a post-write hook though. I'll check that out.
Spaces in identifiers cause all sorts of problems. I can't seem to get a post-write hook to work because we pass in record key in like this:
$cmd = "$hook $record_key $children_record_ids $config_path";
So a record key with a space in it (like some of the ones I'm dealing with) pass in only the part of the key before the first space, then the part after the first space as the $children_record_ids, then if there's a second space, whatever follows it is passed in as the $config_path.... and nothing works the way it's intended. It looks like we assumed that record keys would not include spaces. A fair assumption on our part, I contend.
I think we need to require that IDs used as record key contain no spaces.
Although $cmd = "$hook '$record_key' $children_record_ids $config_path";
appears to work (i.e., adding quotes around $record_key
).