Skip to content

Commit bfe46dc

Browse files
committed
1.0.7.post0: Add handler for failed ctypes find_library call [small def fix]
1 parent 05f7332 commit bfe46dc

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

pydvdcss/__init__.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
11
import ctypes, ctypes.util
22
import platform
33
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)
433

534

635
class PyDvdCss:
@@ -110,35 +139,6 @@ def dispose(self):
110139
# reset verbosity and cracking mode environment variables
111140
self.set_verbosity(None)
112141
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)
142142

143143
def open(self, psz_target):
144144
"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="pydvdcss",
8-
version="1.0.7",
8+
version="1.0.7.post0",
99
author="PHOENiX",
1010
author_email="rlaphoenix@pm.me",
1111
description="Python wrapper for VideoLAN's libdvdcss.",

0 commit comments

Comments
 (0)