Skip to content
Permalink
Browse files

utils: Use toml instead of pytoml for config

  • Loading branch information...
iamkroot committed Jun 13, 2019
1 parent 9166da7 commit ebfe3dbf30a7df9db933b90d8324b70b7e3f0c43
Showing with 21 additions and 13 deletions.
  1. +1 −1 Pipfile
  2. +9 −8 Pipfile.lock
  3. +11 −4 trakt_scrobbler/utils.py
@@ -5,11 +5,11 @@ name = "pypi"

[packages]
requests = "*"
pytoml = "*"
guessit = "*"
pywin32 = {version = "*", sys_platform = "== 'win32'"}
win10toast = {version = "*", sys_platform = "== 'win32'"}
notify2 = {version = "*", sys_platform = "!= 'win32'"}
dbus-python = {version = "*", sys_platform = "!= 'win32'"}
toml = "*"

[dev-packages]

Some generated files are not rendered by default. Learn more.

@@ -1,17 +1,24 @@
import json
import logging
import pytoml
import toml
import requests
from pathlib import Path

DATA_DIR = Path('data')
DATA_DIR.mkdir(exist_ok=True)
logger = logging.getLogger('trakt_scrobbler')


def read_config(config_path=DATA_DIR / 'config.toml'):
with open(config_path) as f:
return pytoml.load(f)
try:
with open(config_path) as f:
try:
return toml.load(f)
except toml.TomlDecodeError:
logger.error('Unable to load config.toml!')
exit(1)
except FileNotFoundError:
logger.error('config.toml not found!')
exit(1)


config = read_config()

0 comments on commit ebfe3db

Please sign in to comment.
You can’t perform that action at this time.