Skip to main content

Sort screenshots based on rules or through individual review.

Project description

Clown Sort

Sometimes someone is being a clown on the internet. Somewhere on your hard drive is the perfect screenshot to prove to the world that the clown in question is a fool, a hypocrite, a criminal, or worse. But then - horrors - you can't find the screenshot! It has been lost in your vast archive of screenshots of clowns clowning themselves on the internet.

Clown Sort[^1] solves this.

What It Do

It sorts screenshots, PDFs, etc. based on their name and/or their textual contents into folders based on a list of rules. The contents of the tweet/reddit post/whatever are prepended to the filename and the ImageDescription EXIF tag is set to the OCR text. As you can configure your own arbitrary rules and run it against any set of images it works on many things other than screenshots of social media clowns, though the default configuration is for cryptocurrency clowns.

For example this screenshot of a tweet by a noteworthy cryptocurrency "reporter"[^2] on the eve of FTX's implosion:

Would be renamed from Screen Shot 2023-02-17 at 7.11.37 PM.png to

Tweet by @lawmaster: "I will say though before this thread gets taken over: 1. I do believe Alameda has the size to easily buy Binance\'s FIT OTC 2. I think the chance of FTX insolvency is near" Screen Shot 2023-02-17 at 7.11.37 PM.png

Other stuff that happens:

  • The ImageDescription EXIF tag will be written (for images)
  • All timestamps will be preserved.
  • Files that match multiple patterns will be copied to multiple destination folders.
  • The original file will be moved into a Processed/ directory after it has been handled.

Note also that:

  • This works on images that are more substantive than just self-clowning screenshots.
  • So far only Tweets and Reddit screenshots have special handling beyond OCR text extraction.
  • PDFs can be sorted by contents or filename, e.g. a PDF named Norton Anthology of Crypto Bro Poetry.pdf containing iambic verse like "Fuck u justin sun and fuck ur dick face... u all play with investing and money of the people !!!!" by the noted bard JOKER_OF_CRYPTO will be copied to the Justin Sun/ folder but not renamed.
  • Videos are not OCRed and can only be moved based on filename matches, e.g. a file called SBF is a big fat liar.mov will be moved to the FTX/ folder but otherwise left alone.

Quick Start

# Installation with pipx is preferred if you have it but you can also use pip which comes standard
# on almost all systems. pipx is only a noticeably better answer if you're a python programmer who
# is concerned about side effects of pip upgrading system python packages.
pip install clown_sort

# Get help
sort_screenshots -h

# Dry run with default cryptocurrency sort rules (dry runs don't actually move anything,
# they just show you what will happen if you run again with the --execute flag)
sort_screenshots

# Execute default cryptocurrency sort rules against ~/Pictures/Screenshots
sort_screenshots --execute

# Sort a different directory of screenshots
sort_screenshots --screenshots-dir /Users/hrollins/Pictures/get_in_the_van/tourphotos --execute

# Sort with custom rules
sort_screenshots --rules-csv /Users/hrollins/my_war.csv --execute

# Sort pdfs
sort_screenshots -f '.*pdf$' -e

Setup

pipx is recommended because it keeps your system python environment safe but you can also just use pip.

pipx install clown_sort

Optional Components

If you want to use the popup window to manually tag you may need to install:

  • Python TK: brew install python-tk@3.10 (if you don't have homebrew you need to install it to run brew install)

Not required for standard PNG, JPG, etc. images but you may optionally install exiftool for other file types.

Usage

YOU ARE ADVISED TO MAKE A BACKUP OF YOUR FILES BEFORE HITTING THE --execute flag. While an effort has been made to use Python's cross platform Pathlib module as much as possible sometimes shit gets wonky on other platforms. This is 100x as true on Windows - Clown Sort has never been tested on a Windows platform.

Help Screen

Custom Sorting Rules

The default is to sort cryptocurrency related content but you can define your own CSV of rules with two columns folder and regex. The value in folder specifies the subdirectory to sort into and regex is the pattern to match against. See the default crypto related configuration for an example. An explanation of regular expressions is beyond the scope of this README but many resources are available to help. if you're not good at regexes just remember that any alphanumeric string is a regex that will match that string. pythex is a great website for testing your regexes.

Manually Sorting (Experimental)

This is an experimental feature. It's only been tested on macOS.

If you run with the --manual-sort command line the behavior is quite different. Rather than automatically sort files for you, instead for every file you will be greated with a popup asking you for a desired filename and a radio button select of possible subdirectories off your Sorted/ directory.

Configuring With .clown_sort File

If there are command line options you find yourself specifying repeatedly you can place them in a .clown_sort file. When you invoke sort_screenshots the following locations will be checked for .clown_sort:

  1. The current directory
  2. Your home directory

See the example for more information on what can be configured this way.

Example Output

Contributing

Feel free to file issues or open pull requests. Only requirement is that tests should pass before you open it, which you can check with

pytest

[^1]: The name clown_sort was suggested by ParrotCapital and while the tool can work on any kind of screenshot it was too good not to use.

[^2]: Perhaps notable that the "reporter" in question for years maintained a private list of the blockchain addresses of Sam Bankman-Fried's various scams as part of his commitment to "unrivaled transparency".

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clown_sort-0.8.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

clown_sort-0.8.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file clown_sort-0.8.0.tar.gz.

File metadata

  • Download URL: clown_sort-0.8.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0

File hashes

Hashes for clown_sort-0.8.0.tar.gz
Algorithm Hash digest
SHA256 28542012a3eb379aa39129ba7784241dbb32392262fa91a69c7fab30d0a9ebd9
MD5 bbf7a18c51534e9c281aa1debd9fbc72
BLAKE2b-256 f39e9d3d4db3bb0175d595632eb2c901f345e4626c8f39b28ff3ef38a6b0ebf3

See more details on using hashes here.

Provenance

File details

Details for the file clown_sort-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: clown_sort-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0

File hashes

Hashes for clown_sort-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29fa107183b4ec1f21b43663fb1545f34c744407ccd40bc27c548bd8fd4dc22c
MD5 e47b3e472c4b61b189b17defd548bbe1
BLAKE2b-256 58ec040ad5fa000652a5b234be6fab91a21e098eb7cea7d89f5c318584dc032d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page