Skip to content

Pseudocode

jdrch edited this page Apr 21, 2020 · 8 revisions
  • Open .conf file
    • Read working directory
    • Read MinimumResolution
    • Read MinimumOrthoganalResolution (this is the other half of the the resolution tuple, e.g. 2160 or 3840 for 16:9 4K)
  • Switch to working directory
  • For each file in working directory
    • If file extension is .zip or .rar
      • Move to the next file in working directory
    • If file extension is .cbz
      • Replace .cbz in filename with .zip
      • Move to the next file in working directory
    • If file extension is .cbr
      • Replace .cbr in filename with .rar
      • Move to the next file in working directory
  • For each file in the working directory
    • If file extension is not .zip or .rar
      • Move to the next file in working directory
    • If file extension is .zip
      • Extract the file to current path with automatic rename of extracted contents
      • Move to the next file in working directory
    • If file extension is .rar
      • Extract the file to current path with automatic rename of extracted contents
      • Move to the next file in working directory
  • Flatten any resulting child directories with automatic rename so that all files are at the top level of the working directory
  • For each image file in the working directory
    • If file has no resolution
      • Move to the next file in working directory
    • If file has resolution
      • Set MinimumDimension = Min(HorizontalFileSize, VerticalFileSize)
      • Set MaximumDimension = Max(HorizontalFileSize, VerticalFileSize)
      • If MinimumResolution > MinimumDimension OR MaximumResolution > MaximumDimension
        • Delete file
        • Move to next file in working directory
  • Exit

It appears the resolution determination can be done via ImageMagick and/or exiv2.

Clone this wiki locally