Skip to content

Swift program which can crawl into folders and look if images contain legal mentions in their metadata

License

Notifications You must be signed in to change notification settings

isabella232/Swift-AssetsLegalMentionsChecker

 
 

Repository files navigation

Swift-AssetsLegalMentionsChecker

Swift-written tool to use in command line to check if images contain copyright / legal mentions / credits in metadata. This project is built with Xcode.

Managed files

This current version deals only with PNG file (with .png or .PNG extensions), and looks for some fields in the metadata : TIFF, IPTC and PNG. If will check in these fields if the mention to look for is exactly the defined value.

Executables

If you are looking for the executables you can have a look on folder ~/Library/Developer/Xcode/DerivedData/Swift-AssetsLegalMentionsChecker-XXX/Build/Products/Debug/ where XXX is a kind of random string generated by Xcode. You have to build the project with Xcode before.

Run the program

Assuming EXECUTABLE is the executable file (you can pick for example in the mentioned folder above):

To get the usage of the program:

EXECUTABLE --help

To get the version of the program:

EXECUTABLE --version

To run the program where it have to find recursively a CREDIT line in metadata of images in the FOLDER:

EXECUTABLE --folder FOLDER --mention CREDIT

You can also make the program displays more messages with the verbose option:

EXECUTABLE --folder FOLDER --mention CREDIT --verbose

Exit codes

The program returns a value indicating if a problem occured or not:

  • (-1): something wrong occured (command line options for example)
  • (0): no error appeared, normal exit without image processing (e.g. display help)
  • (+1): normal exit but failure occured during check of images (i.e. at least 1 file does not have legal mention in credits)
  • (+2): normal exit, all files contain the legal mention

Xcode integration

You can use this tool with an Xcode build script. The following sample can be placed in a script to add to your Xcode configuration. Thus the tool (with binary in the project) can be used easily.

#!/bin/sh
LEGAL_NOTICE="My Project, (c) Copyright Me-MySelf-And-I- SA 2020, CC-BY-SA-NC 4.0"
TOOL_PATH="path/to/binary/of/this/tool"
TARGET="."

$TOOL_PATH --folder "$TARGET" --mention "$LEGAL_NOTICE"
result=$?

if [ $result -eq 2 ]
then
	echo "✅ All assets contain legal notice in metadata."
	exit 0
else
	echo "🔴 Something wrong occured, see logs for further details."
	exit 1
fi

About

Swift program which can crawl into folders and look if images contain legal mentions in their metadata

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%