make discid a non required dependency
This commit is contained in:
parent
402e837551
commit
a9b16a8a72
2
CDDB.py
2
CDDB.py
@ -18,7 +18,7 @@ version = 2.0
|
|||||||
if 'EMAIL' in os.environ:
|
if 'EMAIL' in os.environ:
|
||||||
(default_user, hostname) = os.environ['EMAIL'].split('@')
|
(default_user, hostname) = os.environ['EMAIL'].split('@')
|
||||||
else:
|
else:
|
||||||
default_user = os.environ['USER'] or os.geteuid() or 'user'
|
default_user = os.environ.get('USER') or os.geteuid() or 'user'
|
||||||
hostname = socket.gethostname() or 'host'
|
hostname = socket.gethostname() or 'host'
|
||||||
|
|
||||||
proto = 6
|
proto = 6
|
||||||
|
16
common.py
16
common.py
@ -1,5 +1,19 @@
|
|||||||
import os
|
import os
|
||||||
import discid
|
import logging
|
||||||
|
|
||||||
|
try:
|
||||||
|
from config import APP_NAME as ROOT_LOGGER_NAME
|
||||||
|
except ImportError:
|
||||||
|
ROOT_LOGGER_NAME = 'root'
|
||||||
|
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||||
|
|
||||||
|
# make module usable without discid dependency
|
||||||
|
try:
|
||||||
|
import discid
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
logger.warning("Python module discid not installed")
|
||||||
|
except OSError:
|
||||||
|
logger.exception("You might install python3-libdiscid")
|
||||||
|
|
||||||
KEY_ALBUM = 'album'
|
KEY_ALBUM = 'album'
|
||||||
KEY_APERTURE = 'aperture'
|
KEY_APERTURE = 'aperture'
|
||||||
|
@ -14,8 +14,12 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
ROOT_LOGGER_NAME = 'root'
|
ROOT_LOGGER_NAME = 'root'
|
||||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||||
|
|
||||||
|
# make module usable without discid dependency
|
||||||
try:
|
try:
|
||||||
import discid
|
import discid
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
logger.warning("Python module discid not installed")
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.exception("You might install python3-libdiscid")
|
logger.exception("You might install python3-libdiscid")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user