Source code¶
Important
The Python API is not guaranteed to be stable. Egaia is distributed with the intention that it will be used primarily as a command-line application; as such, all functions should be considered internal.
egaia.egaia module¶
Main dispatching module for the command-line interface.
egaia.egaia_archivedotorg module¶
-
egaia.egaia_archivedotorg.
listVideos
(uuid=None, new=True)[source]¶ Get a list of videos from the current collection that have not been uploaded, and matching the uuid if specified. If new is False, we will not filter out the previously uploaded items.
-
egaia.egaia_archivedotorg.
post
(items, upload=True, faststart=False, collection='opensource_movies', dry_run=False)[source]¶ Upload items to the Internet Archive. Takes a list of metadata dictionaries, corresponding to csv rows, as provided by listVideos(). If upload is not True, the remote metadata will be updated but items will not be re-uploaded.
egaia.egaia_bag module¶
-
egaia.egaia_bag.
init
(description=None, title=None, new=True)[source]¶ Wrap the newBag function in the bagit utility, and create an empty csv file for user metadata entry.
egaia.egaia_collage module¶
-
egaia.egaia_collage.
getFilenames
(uuids=None)[source]¶ Create a list of filepaths for items in the current collection that have thumbnail images available.
-
egaia.egaia_collage.
getFilenamesFromUuids
(uuids)[source]¶ Retrieve a list of filenames from a list of UUIDs.
egaia.egaia_config module¶
-
egaia.egaia_config.
dumpConfig
(cfg_path)[source]¶ Write the currently set configuration values to the file located at cfg_path.
-
egaia.egaia_config.
getConfig
(section, key, boolean=False)[source]¶ Get the value of a particular configuration setting
-
egaia.egaia_config.
loadConfig
()[source]¶ Load configuration values, and return a ConfigParser object.
egaia.egaia_derive module¶
-
egaia.egaia_derive.
findRules
(fn, frame, force, update)[source]¶ Find the matching processing rule(s) for a given filename
-
egaia.egaia_derive.
makeDeriv
(rule, mtype, fn, UUID, tmpFile, outDir, outFile, basename, N)[source]¶ Create a derivative. This function contains the processing rules and commands.
egaia.egaia_docx module¶
-
egaia.egaia_docx.
filter_files
(pattern)[source]¶ Return a list of metadata files from a globbing pattern.
-
egaia.egaia_docx.
getCoreFields
(filtered=True)[source]¶ Return an ordered list of core metadata field labels.
-
egaia.egaia_docx.
loadCsv
(csv_path)[source]¶ Load metadata csv using the DictReader. Return a list of dicts.
egaia.egaia_figs module¶
egaia.egaia_list module¶
-
egaia.egaia_list.
applyExclude
(name, exclude)[source]¶ Return True or False to indicate whether a given filename matches a list of exclusion patterns.
-
egaia.egaia_list.
listDirs
(filepath=None, filter_type=None, uuid=None, exclude=None)[source]¶ List directories that can be tagged
-
egaia.egaia_list.
listFiles
(filepath=None, filter_type=None, uuid=None, exclude=None, include_dirs=False)[source]¶ List the files in a collection.
-
egaia.egaia_list.
listItems
(filepath=top)[source]¶ List the UUIDs corresponding to the items in a collection.
egaia.egaia_log module¶
egaia.egaia_make module¶
-
egaia.egaia_make.
copyDerivatives
(derivs, destdir, force=False)[source]¶ Copy derivatives to the “pub” directory for distribution.
-
egaia.egaia_make.
getPreview
(uuid, preview_type='item')[source]¶ Retrieve an html preview for an item or collection.
-
egaia.egaia_make.
getThumb
(uuid, size='thumb')[source]¶ Identify and return the base filename of a thumb image from a list of derivatives.
-
egaia.egaia_make.
makeAlias
(alias, target)[source]¶ Generate an alias (redirect page) for an item. Target should be a UUID; alias should be a filename.
-
egaia.egaia_make.
makeCollectionJson
(delete=False, outdir=None)[source]¶ Create json representations for all items in the current collection.
-
egaia.egaia_make.
makeCollectionPage
(uuid, delete=False)[source]¶ Generate an html description page for the current collection.
-
egaia.egaia_make.
makeCollectionPreview
(uuid)[source]¶ Generate the preview image and brief description for the collection that will be included in the list or indexes of collections.
-
egaia.egaia_make.
makeDownloadsList
(derivs)[source]¶ Prepare an html list of download links for derivatives
-
egaia.egaia_make.
makeEmbedTag
(derivs, page)[source]¶ Prepare an embeddable media tag from a list of derivatives. Return a full embed object tag, with url reference to the media file(s). This is usable in an item description page. The “page” parameter should be the uuid of the item.
-
egaia.egaia_make.
makeItemPage
(uuid, force=False, delete=False, nolinks=False)[source]¶ Generate an html page for an item.
-
egaia.egaia_make.
makeItemPreview
(uuid)[source]¶ Generate an html preview for an item, to be included in indexes or lists.
-
egaia.egaia_make.
makeLocalEmbed
(embed_type=None, src=None, mtype=None)[source]¶ Assemble an html5 audio or video embed tag.
-
egaia.egaia_make.
makeMetadataTable
(data, nolinks=False)[source]¶ Create an HTML definition list from a dict containing item metadata (normally via json), or the values in bag-info.txt.
-
egaia.egaia_make.
makePaginationLinks
(item_count, page, url_path, items_per_page)[source]¶ Return pagination links
-
egaia.egaia_make.
makePreview
(uuid, preview_type='item', delete=False)[source]¶ Create an html preview for an item or collection, to be included in indexes or lists.
-
egaia.egaia_make.
makeRemoteEmbed
(url)[source]¶ Prepare an embeddable video tag from a URL. Return an iframe. This is usable in an item description page.
-
egaia.egaia_make.
makeTags
(tags, tagtype='tags')[source]¶ Generate an HTML list of keyword tags, from an input list.
-
egaia.egaia_make.
updateItemIndex
(uuid, delete=False)[source]¶ Update the keyword indexes based on json metadata for a given item.
egaia.egaia_meta module¶
-
egaia.egaia_meta.
getDate
(filename)[source]¶ Retrieve the file modification date, for dc_date. This is not necessarily reliable but is sometimes useful.
-
egaia.egaia_meta.
getDuration
(filename)[source]¶ Retrieve the duration of audiovisual media, for dc_extent
-
egaia.egaia_meta.
getMetadata
(filename, existing=None, restrict=False)[source]¶ Extract all the metadata for a given file. Pass the “existing” parameter in order to merge new metadata with an existing record. The existing data will not be overwritten. The “restrict” parameter limits updating to DCTERMS.modified and DCTERMS.extent, which are always derived from the file on disk, and can therefore safely be updated without losing user input.
egaia.egaia_parsefn module¶
-
egaia.egaia_parsefn.
getUuid
(filepath)[source]¶ Return the uuid for a tagged filename, if available, or None.
egaia.egaia_root module¶
egaia.egaia_roughcut module¶
-
egaia.egaia_roughcut.
cat
(clip_list)[source]¶ Concatenate clips from the file clip_list. The format is: #, reel, clip, inpoint, outpoint, title, caption, notes
-
egaia.egaia_roughcut.
intertitle
(text, clipdir)[source]¶ Create an intertitle clip and return the clip name.
egaia.egaia_sanitize module¶
egaia.egaia_serve module¶
egaia.egaia_setup module¶
egaia.egaia_tag module¶
egaia.strings module¶
These are css, javascript, and similar strings for use in html page generation. They are placed here in order to maintain the legibility of the Python code in the modules that use them.
egaia.utils module¶
Multipurpose utilities for egaia.
egaia.version module¶
Get version identification from git
See the documentation of get_version for more information
-
egaia.version.
get_version
(pep440=False)[source]¶ Tracks the version number.
- pep440: bool
- When True, this function returns a version string suitable for a release as defined by PEP 440. When False, the githash (if available) will be appended to the version string.
The file VERSION holds the version information. If this is not a git repository, then it is reasonable to assume that the version is not being incremented and the version returned will be the release version as read from the file.
However, if the script is located within an active git repository, git-describe is used to get the version information.
The file VERSION will need to be changed by manually. This should be done before running git tag (set to the same as the version in the tag).