Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenameCommand ¶
RenameCommand returns a cobra command that renames all files in the given directory to "image_<number>.<ext>" where <number> is the 1-indexed sequence number of the file and <ext> is the file extension specified by the --ext flag (defaulting to ".jpg"). The command also generates a CSV file in the same directory containing the original file name and the new file name.
func RenameImages ¶
RenameImages renames all files in the given directory to "image_<number>.<ext>" where <number> is the 1-indexed sequence number of the file and <ext> is the file extension specified by the ext parameter. The function also generates a CSV file in the same directory containing the original file name and the new file name.
The CSV file has the following columns:
* SourceFile: the original file name * ObjectName: the new file name * Keywords: always empty * CopyrightStatus: always "protected" * Marked: always "TRUE" * CopyrightNotice: always "All Rights Reserved"
func UpdateMetadataCommand ¶
UpdateMetadataCommand returns a cobra.Command that updates the metadata of files based on a CSV file. The command takes a single argument, the path to the CSV file. The CSV file should contain the following columns:
1. SourceFile - the path to the file 2. ObjectName - the title of the file 3. Keywords - the keywords of the file 4. CopyrightStatus - the copyright status of the file 5. Marked - whether the file is marked or not 6. CopyrightNotice - the copyright notice of the file
Each row of the CSV file after the first row is processed as a separate file. The metadata of each file is updated in-place.
The function returns an error if it fails to open the CSV file, read the CSV file, initialize ExifTool, or update the metadata of any of the files.
func UpdateMetadataFromCSV ¶
UpdateMetadataFromCSV reads a CSV file and updates the metadata of the files listed in the CSV file. The CSV file should contain the following columns:
1. SourceFile - the path to the file 2. ObjectName - the title of the file 3. Keywords - the keywords of the file 4. CopyrightStatus - the copyright status of the file 5. Marked - whether the file is marked or not 6. CopyrightNotice - the copyright notice of the file
If a record in the CSV file is missing one of the required columns, the function will log a message and skip the record. If the record has more than 6 columns, the extra columns will be ignored.
The function returns an error if it fails to open the CSV file, read the CSV file, initialize ExifTool, or update the metadata of any of the files.
Types ¶
This section is empty.