|
1 | 1 | import ctypes, ctypes.util
|
2 | 2 | import platform
|
3 | 3 | import os
|
| 4 | + |
| 5 | +def _libdvdcss_installation(): |
| 6 | + err = "PyDvdCss: Unable to locate libdvdcss library, please install it.\n" |
| 7 | + if platform.system() == "Windows": |
| 8 | + dll = f"https://github.com/allienx/libdvdcss-dll/raw/master/1.4.2/{platform.architecture()[0].replace('b', '-b')}/libdvdcss-2.dll" |
| 9 | + err += "\n".join([ |
| 10 | + "On Windows, the installation process is a bit annoying, so I calculated it all for you:", |
| 11 | + f"Download the following file: `{dll}``", |
| 12 | + f"Place the file in: `C:/Windows/{'SysWOW64' if platform.machine().endswith('64') else 'System32'}``", |
| 13 | + f"Done!" |
| 14 | + ]) |
| 15 | + elif platform.system() == "Darwin": |
| 16 | + err += "\n".join([ |
| 17 | + "On Mac, the installation process is easiest when using `brew`.", |
| 18 | + "If you don't have brew installed, follow the instructions at `https://brew.sh`", |
| 19 | + "Once installed, open terminal and type: `brew install libdvdcss`", |
| 20 | + "Done!" |
| 21 | + ]) |
| 22 | + elif platform.system() == "Linux": |
| 23 | + err += "\n".join([ |
| 24 | + "On Linux, the installation process is very simple.", |
| 25 | + "Just check your Package Distro for `libdvdcss` or possibly `libdvdcss-2` or the alike.", |
| 26 | + "If it's not found, check it's User Repository or compile it yourself.", |
| 27 | + "If you compile it yourself, make sure it's somewhere in PATH for pydvdcss to find it.", |
| 28 | + "pydvdcss uses ctypes.util.find_library to search for the library.", |
| 29 | + "It uses `/sbin/ldconfig`, `gcc`, `objdump` and `ld` to try find the library.", |
| 30 | + "Good luck!" |
| 31 | + ]) |
| 32 | + raise EnvironmentError(err) |
4 | 33 |
|
5 | 34 |
|
6 | 35 | class PyDvdCss:
|
@@ -110,35 +139,6 @@ def dispose(self):
|
110 | 139 | # reset verbosity and cracking mode environment variables
|
111 | 140 | self.set_verbosity(None)
|
112 | 141 | self.set_cracking_mode(None)
|
113 |
| - |
114 |
| - def _libdvdcss_installation(self): |
115 |
| - err = "PyDvdCss: Unable to locate libdvdcss library, please install it.\n" |
116 |
| - if platform.system() == "Windows": |
117 |
| - dll = f"https://github.com/allienx/libdvdcss-dll/raw/master/1.4.2/{platform.architecture()[0].replace('b', '-b')}/libdvdcss-2.dll" |
118 |
| - err += "\n".join([ |
119 |
| - "On Windows, the installation process is a bit annoying, so I calculated it all for you:", |
120 |
| - f"Download the following file: `{dll}``", |
121 |
| - f"Place the file in: `C:/Windows/{'SysWOW64' if platform.machine().endswith('64') else 'System32'}``", |
122 |
| - f"Done!" |
123 |
| - ]) |
124 |
| - elif platform.system() == "Darwin": |
125 |
| - err += "\n".join([ |
126 |
| - "On Mac, the installation process is easiest when using `brew`.", |
127 |
| - "If you don't have brew installed, follow the instructions at `https://brew.sh`", |
128 |
| - "Once installed, open terminal and type: `brew install libdvdcss`", |
129 |
| - "Done!" |
130 |
| - ]) |
131 |
| - elif platform.system() == "Linux": |
132 |
| - err += "\n".join([ |
133 |
| - "On Linux, the installation process is very simple.", |
134 |
| - "Just check your Package Distro for `libdvdcss` or possibly `libdvdcss-2` or the alike.", |
135 |
| - "If it's not found, check it's User Repository or compile it yourself.", |
136 |
| - "If you compile it yourself, make sure it's somewhere in PATH for pydvdcss to find it.", |
137 |
| - "pydvdcss uses ctypes.util.find_library to search for the library.", |
138 |
| - "It uses `/sbin/ldconfig`, `gcc`, `objdump` and `ld` to try find the library.", |
139 |
| - "Good luck!" |
140 |
| - ]) |
141 |
| - raise EnvironmentError(err) |
142 | 142 |
|
143 | 143 | def open(self, psz_target):
|
144 | 144 | """
|
|
0 commit comments