-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy path__init__.py
38 lines (30 loc) · 1.32 KB
/
__init__.py
1
2
3
4
5
6
7
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
import sys
import codecs
import locale
from .__about__ import __version__ as version
_DEFAULT_ENCODING = "latin1"
# The local encoding, used when parsing command line options, console output,
# etc. The default is always ``latin1`` if it cannot be determined, it is NOT
# the value shown.
LOCAL_ENCODING = locale.getpreferredencoding(do_setlocale=True)
if not LOCAL_ENCODING or LOCAL_ENCODING == "ANSI_X3.4-1968": # pragma: no cover
LOCAL_ENCODING = _DEFAULT_ENCODING
# The local file system encoding, the default is ``latin1`` if it cannot be determined.
LOCAL_FS_ENCODING = sys.getfilesystemencoding()
if not LOCAL_FS_ENCODING: # pragma: no cover
LOCAL_FS_ENCODING = _DEFAULT_ENCODING
class Error(Exception):
"""Base exception type for all eyed3 errors."""
def __init__(self, *args):
super().__init__(*args)
if args:
# The base class will do exactly this if len(args) == 1,
# but not when > 1. Note, the 2.7 base class will, 3 will not.
# Make it so.
self.message = args[0]
from .utils.log import log # noqa: E402
from .core import load, AudioFile # noqa: E402
del sys
del codecs
del locale
__all__ = ["AudioFile", "load", "log", "version", "LOCAL_ENCODING", "LOCAL_FS_ENCODING", "Error"]