music-kraken-core/src/music_kraken/utils/shared.py

52 lines
1.6 KiB
Python
Raw Normal View History

2022-11-11 23:29:07 +00:00
import musicbrainzngs
import logging
import tempfile
import os
TEMP_FOLDER = "music-downloader"
LOG_FILE = "download_logs.log"
DATABASE_FILE = "metadata.db"
DATABASE_STRUCTURE_FILE = "database_structure.sql"
2022-11-14 14:44:32 +00:00
DATABASE_STRUCTURE_FALLBACK = "https://raw.githubusercontent.com/HeIIow2/music-downloader/master/assets/database_structure.sql"
2022-11-17 12:23:27 +00:00
temp_dir = os.path.join(tempfile.gettempdir(), TEMP_FOLDER)
if not os.path.exists(temp_dir):
os.mkdir(temp_dir)
# configure logger default
logging.basicConfig(
level=logging.INFO,
format=logging.BASIC_FORMAT,
handlers=[
logging.FileHandler(os.path.join(temp_dir, LOG_FILE)),
logging.StreamHandler()
]
)
2022-11-11 23:29:07 +00:00
SEARCH_LOGGER = logging.getLogger("mb-cli")
DATABASE_LOGGER = logging.getLogger("database")
2022-11-17 12:23:27 +00:00
METADATA_DOWNLOAD_LOGGER = logging.getLogger("metadata")
URL_DOWNLOAD_LOGGER = logging.getLogger("AudioSource")
YOUTUBE_LOGGER = logging.getLogger("Youtube")
2022-11-17 12:23:27 +00:00
MUSIFY_LOGGER = logging.getLogger("Musify")
2022-11-11 23:29:07 +00:00
PATH_LOGGER = logging.getLogger("create-paths")
DOWNLOAD_LOGGER = logging.getLogger("download")
2022-11-14 14:44:32 +00:00
LYRICS_LOGGER = logging.getLogger("lyrics")
2022-11-11 23:29:07 +00:00
GENIUS_LOGGER = logging.getLogger("genius")
2022-11-13 14:57:19 +00:00
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
2022-11-11 23:29:07 +00:00
musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader")
2022-11-17 12:23:27 +00:00
NOT_A_GENRE = ".", "..", "misc_scripts", "Music", "script", ".git", ".idea"
MUSIC_DIR = os.path.expanduser('~/Music')
2022-11-11 23:29:07 +00:00
TOR = False
proxies = {
'http': 'socks5h://127.0.0.1:9150',
'https': 'socks5h://127.0.0.1:9150'
} if TOR else {}
# only the sources here will get downloaded, in the order the list is ordered
2022-11-17 12:23:27 +00:00
AUDIO_SOURCES = ["Musify", "Youtube"]