graphai.core.common.caching module

graphai.core.common.caching.delete_file(file_path)

Deletes a file :param file_path: Full path of the file

Returns:

None

Creates a symlink from new_path to old_path :param old_path: Path to the old (real) file :param new_path: Path to the new (symlink) file

Returns:

None

class graphai.core.common.caching.VideoDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
class graphai.core.common.caching.AudioDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
class graphai.core.common.caching.SlideDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
class graphai.core.common.caching.TextDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
class graphai.core.common.caching.ScrapingDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
get_details_using_origin(origin_token, cols)

Gets details of cache row(s) using origin token instead of id token :param origin_token: Origin token :param cols: List of columns to retrieve

Returns:

Cache row detail dict

class graphai.core.common.caching.EmbeddingDBCachingManager(initialize_database=False)

Bases: DBCachingManagerBase

init_db()
class graphai.core.common.caching.VideoConfig

Bases: object

get_root_dir()
get_image_dir()
get_audio_dir()
get_video_dir()
get_transcript_dir()
concat_file_path(filename, subfolder)

Concatenates the root dir with the given subfolder and file name. :param filename: Name of the file :param subfolder: Subfolder it is/should be in

Returns:

Full path of the file

generate_filepath(filename, force_dir=None)

Generates the full path of a given file based on its name :param filename: Name of the file :param force_dir: Whether to force a particular subfolder

Returns:

The full file path

Creates a symlink between a new filename (for which the path is generated automatically) and an old full path :param old_path: Old full path :param new_filename: New filename

Returns:

None

class graphai.core.common.caching.FingerprintParameters

Bases: object

load_values()

Loads the default values of fingerprinting thresholds :returns: None

get_min_sim_image()
get_min_sim_audio()
get_min_sim_video()
graphai.core.common.caching.get_token_file_status(token, file_manager)
graphai.core.common.caching.write_binary_file_to_token(b64_str, token, file_manager)

Writes file contents received as a base64 encoded string into the file named token :param b64_str: Contents of the file.

Given a file handle f for a binary file (‘rb’), this content could be created using the following line:

base64.b64encode(f.read()).decode(‘utf-8’)

Parameters:
  • token – Name of the file

  • file_manager – The file manager, which will generate the appropriate directory name based on the token

Returns:

Full path of the written file if successful. Throws an exception if not.