metapho package¶
Subpackages¶
Submodules¶
metapho.metapho module¶
These are the base class for metapho images and taggers. Programs with better UI can inherit from these classes.
-
class
metapho.metapho.
Image
(filename, displayed=True)[source]¶ Bases:
object
An image, with additional info such as rotation and tags.
-
classmethod
clean_up_nonexistent_files
(topdir)[source]¶ For any file that was referenced in a tag file but doesn’t exist on disk, see if perhaps it’s been moved to a different subdirectory under topdir. If so, adjust file path appropriately.
-
delete
()[source]¶ Delete the image file FROM DISK, and the image object from the imageList. DOES NOT ASK FOR CONFIRMATION – do that (if desired) from the calling program.
-
classmethod
find_nonexistent_files
()[source]¶ Returns a list of images in the imagelist that don’t exist on disk.
-
g_image_list
= []¶
-
classmethod
-
class
metapho.metapho.
Tagger
[source]¶ Bases:
object
Manages tags for images.
-
IGNORE_DIRNAMES
= ['html', 'web', 'bad', '.*_assets$']¶
-
SKIP_EXTENSIONS
= ['.cr2', '.arw', '.xcf', '.mvi', '.avi', '.mov', '.thm', '.mp4', '.mkv', '.pto', '.txt', '.wav', '.mp3', '.xml']¶
-
add_tag
(tag, img)[source]¶ Add a tag to the given image. img is a metapho.Image. tag may be a string, which can be a new string or an existing one, or an integer index into the tag list. Return the index (in the global tags list) of the tag just added, or None if error.
-
check_commondir
(d)[source]¶ Keep track of the dir common to all directories we use: XXX commondir code is still somewhat experimental.
-
find_untagged_files
(topdir)[source]¶ Return a list of untagged files and a list of directories in which nothing is tagged, under topdir.
-
classmethod
ignore_directory
(d, path=None)[source]¶ Detect directory names that don’t need to be indexed separately and aren’t likely to have a Tags file; for instance, those that likely contain copies of what’s in the parent, or small copies for a web page. Also, you can skip tagging by creating a file named NoTags.
-
static
print_files_by_directory
(filelist)[source]¶ Given a list of pathnames, group them by which directory they belong to and print them in an organized way.
-
process_tag
(tagname, filenames)[source]¶ After reading a tag from a tags file, add it to the global tags list if it isn’t there already, and add the given filenames to it.
Read tags in all directories used by known images, plus the common dir, plus .
Read in tags from files named in the given directory, and tag images in the imagelist appropriately. Tags will be appended to the tag_list. If recursive is True, we’ll also look for Tags files in subdirectories.
-
Module contents¶
metapho: an image tagger and viewer.
-
class
metapho.
Image
(filename, displayed=True)[source]¶ Bases:
object
An image, with additional info such as rotation and tags.
-
classmethod
clean_up_nonexistent_files
(topdir)[source]¶ For any file that was referenced in a tag file but doesn’t exist on disk, see if perhaps it’s been moved to a different subdirectory under topdir. If so, adjust file path appropriately.
-
delete
()[source]¶ Delete the image file FROM DISK, and the image object from the imageList. DOES NOT ASK FOR CONFIRMATION – do that (if desired) from the calling program.
-
classmethod
find_nonexistent_files
()[source]¶ Returns a list of images in the imagelist that don’t exist on disk.
-
g_image_list
= []¶
-
classmethod
-
class
metapho.
Tagger
[source]¶ Bases:
object
Manages tags for images.
-
IGNORE_DIRNAMES
= ['html', 'web', 'bad', '.*_assets$']¶
-
SKIP_EXTENSIONS
= ['.cr2', '.arw', '.xcf', '.mvi', '.avi', '.mov', '.thm', '.mp4', '.mkv', '.pto', '.txt', '.wav', '.mp3', '.xml']¶
-
add_tag
(tag, img)[source]¶ Add a tag to the given image. img is a metapho.Image. tag may be a string, which can be a new string or an existing one, or an integer index into the tag list. Return the index (in the global tags list) of the tag just added, or None if error.
-
check_commondir
(d)[source]¶ Keep track of the dir common to all directories we use: XXX commondir code is still somewhat experimental.
-
find_untagged_files
(topdir)[source]¶ Return a list of untagged files and a list of directories in which nothing is tagged, under topdir.
-
classmethod
ignore_directory
(d, path=None)[source]¶ Detect directory names that don’t need to be indexed separately and aren’t likely to have a Tags file; for instance, those that likely contain copies of what’s in the parent, or small copies for a web page. Also, you can skip tagging by creating a file named NoTags.
-
static
print_files_by_directory
(filelist)[source]¶ Given a list of pathnames, group them by which directory they belong to and print them in an organized way.
-
process_tag
(tagname, filenames)[source]¶ After reading a tag from a tags file, add it to the global tags list if it isn’t there already, and add the given filenames to it.
Read tags in all directories used by known images, plus the common dir, plus .
Read in tags from files named in the given directory, and tag images in the imagelist appropriately. Tags will be appended to the tag_list. If recursive is True, we’ll also look for Tags files in subdirectories.
-