|
| 1 | +class ResolveUnsupportedPlatform(Exception): |
| 2 | + """ |
| 3 | + Exception raised when Resolve's API does not support the current system. |
| 4 | +
|
| 5 | + This will occur when using any OS other than Windows, MacOS or Linux. |
| 6 | + """ |
| 7 | + |
| 8 | + def __init__(self, message: str = "Platform is not 'Windows', 'MacOS' or 'Linux'"): |
| 9 | + self.message = message |
| 10 | + super().__init__(self.message) |
| 11 | + |
| 12 | + |
| 13 | +class ResolveAPIConnectionError(Exception): |
| 14 | + """ |
| 15 | + Exception raised when Resolve API is unreachable. |
| 16 | +
|
| 17 | + This can occur when Resolve is not open or the API server has crashed. |
| 18 | + """ |
| 19 | + |
| 20 | + def __init__( |
| 21 | + self, |
| 22 | + message: str = "Resolve Python API is not accessible. Is DaVinci Resolve running?", |
| 23 | + ): |
| 24 | + self.message = message |
| 25 | + super().__init__(self.message) |
| 26 | + |
| 27 | + |
| 28 | +class ResolveNoCurrentProjectError(Exception): |
| 29 | + """ |
| 30 | + Exception raised when the current project is unknown. |
| 31 | +
|
| 32 | + This can occur when Resolve is running but no project has been opened. |
| 33 | + """ |
| 34 | + |
| 35 | + def __init__( |
| 36 | + self, |
| 37 | + message: str = "Couldn't get the current project. Is a project open in Resolve?", |
| 38 | + ): |
| 39 | + self.message = message |
| 40 | + super().__init__(self.message) |
| 41 | + |
| 42 | + |
| 43 | +class ResolveNoCurrentTimelineError(Exception): |
| 44 | + """ |
| 45 | + Exception raised when the current timeline is unknown. |
| 46 | +
|
| 47 | + This can occur when Resolve is running and a project is open |
| 48 | + but no timeline has been opened. |
| 49 | + """ |
| 50 | + |
| 51 | + def __init__( |
| 52 | + self, |
| 53 | + message: str = "Couldn't get the current timeline. Is a timeline open in Resolve?", |
| 54 | + ): |
| 55 | + self.message = message |
| 56 | + super().__init__(self.message) |
| 57 | + |
| 58 | + |
| 59 | +class ResolveNoMediaPoolError(Exception): |
| 60 | + """ |
| 61 | + Exception raised when the Media Pool object is not accessible. |
| 62 | +
|
| 63 | + This shouldn't occur under normal circumstances. |
| 64 | + """ |
| 65 | + |
| 66 | + def __init__(self, message: str = "Resolve's Media Pool is inacessible."): |
| 67 | + self.message = message |
| 68 | + super().__init__(self.message) |
| 69 | + |
| 70 | + |
| 71 | +class ResolveLinkMismatchError(Exception): |
| 72 | + """ |
| 73 | + Exception raised when Resolve's `LinkProxyMedia` API method rejects a provided proxy. |
| 74 | +
|
| 75 | + The API method returns a bool with no additional error context. |
| 76 | + Common reasons for a mismatch include incorrect proxy settings (framerate, timecode) |
| 77 | + or a corrupt/unfinished proxy file. |
| 78 | + """ |
| 79 | + |
| 80 | + def __init__(self, proxy_file: str, message: str = ""): |
| 81 | + |
| 82 | + self.proxy_file = proxy_file |
| 83 | + |
| 84 | + if message != "": |
| 85 | + self.message = message |
| 86 | + else: |
| 87 | + self.message = f"Couldn't link source media to proxy '{self.proxy_file}'\n" |
| 88 | + f"The proxy file may be corrupt, incomplete or encoding settings may be incorrect (framerate, timecode, etc)" |
| 89 | + |
| 90 | + super().__init__(self.message) |
| 91 | + |
| 92 | + |
| 93 | +class ResolveLostMPIReferenceError(Exception): |
| 94 | + """ |
| 95 | + Exception raised when media pool items passed to Resolve's `LinkProxyMedia` no longer reference in memory objects. |
| 96 | +
|
| 97 | + This occurs when any amount of project switching occurs between queuing and linking. |
| 98 | + MPI references exist per session and will be lost on project changes. |
| 99 | + """ |
| 100 | + |
| 101 | + def __init__(self, media_pool_item, message: str = ""): |
| 102 | + |
| 103 | + self.media_pool_item = media_pool_item |
| 104 | + |
| 105 | + if message != "": |
| 106 | + self.message = message |
| 107 | + else: |
| 108 | + self.message = f"Lost reference to original media pool items, has the project been changed?\n" |
| 109 | + f"Post-encode linking after a project change is not possible without re-iterating media pool items." |
| 110 | + |
| 111 | + super().__init__(self.message) |
| 112 | + |
| 113 | + |
| 114 | +class NoneLinkableError(Exception): |
| 115 | + """ |
| 116 | + Exception raised when no jobs passed to `ProxyLinker` are in the `linkable_types` list |
| 117 | +
|
| 118 | + This shouldn't occur under normal circumstances, but may occur if the `linkable_types` |
| 119 | + list is changed in a way that no queued proxies will match the list. |
| 120 | + """ |
| 121 | + |
| 122 | + def __init__(self, message: str = ""): |
| 123 | + |
| 124 | + if message != "": |
| 125 | + self.message = message |
| 126 | + else: |
| 127 | + self.message = ( |
| 128 | + f"No jobs passed to ProxyLinker are in the 'linkable_types' list.\n" |
| 129 | + ) |
| 130 | + "This shouldn't happen under normal circumstances. Probably the list has been misconfigured." |
| 131 | + |
| 132 | + super().__init__(self.message) |
0 commit comments