Spaces:
Build error
Build error
File size: 4,719 Bytes
b293d47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# Module: config
The `config` module contains various files and functions related to configuration settings and utilities.
## File: config.py
This file contains functions for reading and writing YAML files, as well as loading local assets specified in a YAML configuration file.
### Functions:
#### `read_yaml_config(file_path: str) -> dict`
This function reads and returns the contents of a YAML file as a dictionary.
Parameters:
- `file_path` - The path to the YAML file to be read.
Returns:
- A dictionary containing the contents of the YAML file.
#### `write_yaml_config(file_path: str, data: dict)`
This function writes a dictionary to a YAML file.
Parameters:
- `file_path` - The path to the YAML file to be written.
- `data` - The dictionary to be written to the YAML file.
#### `load_editing_assets() -> dict`
This function loads all local assets from the static-assets folder specified in the yaml_config.
Returns:
- A dictionary containing the YAML configuration with updated local assets.
## File: asset_db.py
This file contains a class `AssetDatabase` that provides methods for managing a database of assets.
### Class: AssetDatabase
This class represents a database of assets and provides methods for adding, removing, and retrieving assets.
Methods:
#### `__init__()`
This method initializes the `AssetDatabase` object. It creates the local and remote asset collections if they don't already exist.
#### `asset_exists(name)`
This method checks if an asset with the given name exists in the database.
Parameters:
- `name` - The name of the asset.
Returns:
- `True` if the asset exists, `False` otherwise.
#### `add_local_asset(name, type, path)`
This method adds a local asset to the database.
Parameters:
- `name` - The name of the asset.
- `type` - The type of the asset.
- `path` - The path to the asset file.
#### `add_remote_asset(name, type, url)`
This method adds a remote asset to the database.
Parameters:
- `name` - The name of the asset.
- `type` - The type of the asset.
- `url` - The URL of the remote asset.
#### `remove_asset(name)`
This method removes an asset from the database.
Parameters:
- `name` - The name of the asset.
#### `get_df()`
This method returns a pandas DataFrame with specific asset details.
Returns:
- A pandas DataFrame containing the asset details.
#### `sync_local_assets()`
This method loads all local assets from the static-assets folder into the database.
#### `getAssetLink(key)`
This method returns the link or path of an asset with the given key.
Parameters:
- `key` - The key of the asset.
Returns:
- The link or path of the asset.
#### `getAssetDuration(key)`
This method returns the duration of an asset with the given key.
Parameters:
- `key` - The key of the asset.
Returns:
- The duration of the asset.
#### `updateLocalAsset(key: str)`
This method updates the local asset with the given key.
Parameters:
- `key` - The key of the asset.
Returns:
- The file path and duration of the updated asset.
#### `updateYoutubeAsset(key: str)`
This method updates the YouTube asset with the given key.
Parameters:
- `key` - The key of the asset.
Returns:
- The remote URL and duration of the updated asset.
## File: api_db.py
This file contains functions for managing API keys.
### Functions:
#### `get_api_key(name)`
This function retrieves the API key with the given name.
Parameters:
- `name` - The name of the API key.
Returns:
- The API key.
#### `set_api_key(name, value)`
This function sets the API key with the given name to the specified value.
Parameters:
- `name` - The name of the API key.
- `value` - The value of the API key.
## File: languages.py
This file contains an enumeration class `Language` that represents different languages.
### Enum: Language
This enumeration class represents different languages and provides a list of supported languages.
Supported Languages:
- ENGLISH
- SPANISH
- FRENCH
- ARABIC
- GERMAN
- POLISH
- ITALIAN
- PORTUGUESE
## File: path_utils.py
This file contains utility functions for searching for program paths.
### Functions:
#### `search_program(program_name)`
This function searches for the specified program and returns its path.
Parameters:
- `program_name` - The name of the program to search for.
Returns:
- The path of the program, or None if the program is not found.
#### `get_program_path(program_name)`
This function retrieves the path of the specified program.
Parameters:
- `program_name` - The name of the program.
Returns:
- The path of the program, or None if the program is not found.
Note: The `magick_path` variable sets the `IMAGEMAGICK_BINARY` environment variable to the path of the `magick` program if it exists. |