abstract_provider
AbstractProvider
Bases: ABC
Source code in client/ayon_sitesync/providers/abstract_provider.py
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 |
|
create_folder(folder_path)
abstractmethod
Create all nonexistent folders and subfolders in 'path'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | string | absolute path | required |
Returns:
Type | Description |
---|---|
(string) folder id of lowest subfolder from 'path' |
Source code in client/ayon_sitesync/providers/abstract_provider.py
125 126 127 128 129 130 131 132 133 134 135 136 |
|
delete_file(path)
abstractmethod
Deletes file from 'path'. Expects path to specific file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path | string | absolute path to particular file | required |
Returns:
Type | Description |
---|---|
None |
Source code in client/ayon_sitesync/providers/abstract_provider.py
100 101 102 103 104 105 106 107 108 109 110 111 |
|
download_file(source_path, local_path, addon, project_name, file, repre_status, site, overwrite=False)
abstractmethod
Download file from provider into local system
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_path | string | absolute path on provider | required |
local_path | string | absolute path with or without name of the file | required |
addon | SiteSyncAddon | addon instance to call update_db on | required |
project_name | str | | required |
file | dict | info about uploaded file (matches structure from db) | required |
repre_status | dict | complete representation containing sync progress | required |
site | str | site name | required |
overwrite | boolean | replace existing file | False |
Returns: (string) file_id of created/modified file , throws FileExistsError, FileNotFoundError exceptions
Source code in client/ayon_sitesync/providers/abstract_provider.py
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 |
|
get_roots_config(anatomy=None)
abstractmethod
Returns root values for path resolving
Takes value from Anatomy which takes values from Settings
overridden by Local Settings
Returns:
Type | Description |
---|---|
(dict) - {"root": {"root": "/My Drive"}} OR {"root": {"root_ONE": "value", "root_TWO":"value}} | |
Format is importing for usage of python's format ** approach |
Source code in client/ayon_sitesync/providers/abstract_provider.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
get_tree()
abstractmethod
Creates folder structure for providers which do not provide tree folder structure (GDrive has no accessible tree structure, only parents and their parents)
Source code in client/ayon_sitesync/providers/abstract_provider.py
138 139 140 141 142 143 144 145 |
|
is_active()
abstractmethod
Returns True if provider is activated, eg. has working credentials.
Returns: (boolean)
Source code in client/ayon_sitesync/providers/abstract_provider.py
29 30 31 32 33 34 35 |
|
list_folder(folder_path)
abstractmethod
List all files and subfolders of particular path non-recursively.
Args: folder_path (string): absolut path on provider
Returns:
Type | Description |
---|---|
(list) |
Source code in client/ayon_sitesync/providers/abstract_provider.py
113 114 115 116 117 118 119 120 121 122 123 |
|
resolve_path(path, root_config=None, anatomy=None)
Replaces all root placeholders with proper values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path(string) | root[work]/folder... | required | |
root_config | dict | {'work': "c:/..."...} | None |
anatomy | Anatomy | object of Anatomy | None |
Returns: (string): proper url
Source code in client/ayon_sitesync/providers/abstract_provider.py
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 |
|
upload_file(source_path, target_path, addon, project_name, file, repre_status, site, overwrite=False)
abstractmethod
Copy file from 'source_path' to 'target_path' on provider.
Use 'overwrite' boolean to rewrite existing file on provider
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_path | string | absolute path on provider | required |
target_path | string | absolute path with or without name of the file | required |
addon | SiteSyncAddon | addon instance to call update_db on | required |
project_name | str | | required |
file | dict | info about uploaded file (matches structure from db) | required |
repre_status | dict | complete representation containing sync progress | required |
site | str | site name | required |
overwrite | boolean | replace existing file | False |
Returns: (string) file_id of created/modified file , throws FileExistsError, FileNotFoundError exceptions
Source code in client/ayon_sitesync/providers/abstract_provider.py
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 |
|