Download
Borrows from Gdown Project Source: https://github.com/wkentaro/gdown License: https://github.com/wkentaro/gdown/blob/main/LICENSE
check_for_updates(templates=None)
Check our app and plugin manifests for template updates. @param templates: Dict of listed template details, will pull them if not provided. @return: Dict containing templates that need an update.
Source code in src/utils/download.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
download_file(file, res, sess, path=None, callback=None, chunk_size=1024 * 1024)
Download file as a temporary file, then rename to its correct filename. @param file: File path to download to. @param res: Download request. @param sess: Download session. @param path: Final path to save the completed temporary file. @param callback: Callback to update download progress. @param chunk_size: Amount of bytes to download before processing the callback. @return: True if download completed without error, otherwise False.
Source code in src/utils/download.py
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 |
|
download_google(file_id, path, callback, use_cookies=True)
Download a file from Google Drive using its file ID. @param file_id: Google Drive file ID. @param path: Path to save downloaded file. @param callback: Function to call on each chunk downloaded. @param use_cookies: Use cookies with request if True. @return: True if successful, otherwise False.
Source code in src/utils/download.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
download_s3(save_path, s3_path, callback=None)
Download template from Amazon S3 bucket. @param save_path: Path to save the file to. @param s3_path: Filepath key on S3 bucket. @param callback: Callback function to update progress. @return: True if success, False if failed.
Source code in src/utils/download.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
gdrive_metadata(file_id)
Get the metadata of a given template file. @param file_id: ID of the Google Drive file @return: Dict of metadata
Source code in src/utils/download.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
get_current_version(file_id, file_path)
Checks the current on-file version of this template. If the file is present, but no version tracked, fill in default. @param file_id: Google Drive file ID. @param file_path: Path to the template PSD. @return: The current version, or None if not on-file.
Source code in src/utils/download.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
|
get_temp_file(res, sess, path, url)
Check for an existing temporary file or create a new one. @param res: Planned download request. @param sess: Current download session. @param path: Planned path name to the completed download. @param url: If resumable, url to generate a new download request. @return: Tuple containing temp file path, total bytes downloaded, new download request.
Source code in src/utils/download.py
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 |
|
get_url_from_gdrive_confirmation(contents)
Get the correct URL for downloading Google Drive file. @param contents: Google Drive page data. @return: Correct url for downloading.
Source code in src/utils/download.py
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 |
|
print_download(url, path, resume=None)
Print the details of an initiated download. @param url: Url file is being received from. @param path: Path the file is being saved to. @param resume: Temporary file we're resuming download on, if provided.
Source code in src/utils/download.py
76 77 78 79 80 81 82 83 84 85 86 87 |
|
update_template(temp, callback)
Update a given template to the latest version. @param temp: Dict containing template information. @param callback: Callback method to update progress bar. @return: True if succeeded, False if failed.
Source code in src/utils/download.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
version_check(template)
Check if a template is up-to-date based on the live file metadata. @param template: Dict containing template details. @return: TemplateUpdate if update needed, else None.
Source code in src/utils/download.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|