1# -*- coding: utf-8 -*- 2# 3# Picard, the next-generation MusicBrainz tagger 4# 5# Copyright (C) 2007, 2014, 2016 Lukáš Lalinský 6# Copyright (C) 2014, 2019-2020 Philipp Wolfer 7# Copyright (C) 2014-2016, 2018-2020 Laurent Monin 8# Copyright (C) 2015 Ohm Patel 9# Copyright (C) 2016 Rahul Raturi 10# Copyright (C) 2016 Wieland Hoffmann 11# Copyright (C) 2016-2017 Frederik “Freso” S. Olesen 12# Copyright (C) 2017 Antonio Larrosa 13# Copyright (C) 2017 Sambhav Kothari 14# Copyright (C) 2018 Bob Swift 15# Copyright (C) 2018 Vishal Choudhary 16# 17# This program is free software; you can redistribute it and/or 18# modify it under the terms of the GNU General Public License 19# as published by the Free Software Foundation; either version 2 20# of the License, or (at your option) any later version. 21# 22# This program is distributed in the hope that it will be useful, 23# but WITHOUT ANY WARRANTY; without even the implied warranty of 24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25# GNU General Public License for more details. 26# 27# You should have received a copy of the GNU General Public License 28# along with this program; if not, write to the Free Software 29# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30 31 32import builtins 33from collections import OrderedDict 34import os 35 36from PyQt5.QtCore import QStandardPaths 37 38from picard import ( 39 PICARD_APP_NAME, 40 PICARD_ORG_NAME, 41 PICARD_VERSION, 42) 43from picard.const.attributes import MB_ATTRIBUTES 44 45# Install gettext "noop" function in case const.py gets imported directly. 46builtins.__dict__['N_'] = lambda a: a 47 48 49# Config directory 50_appconfiglocation = QStandardPaths.writableLocation(QStandardPaths.AppConfigLocation) 51USER_DIR = os.path.normpath(os.path.join(_appconfiglocation, PICARD_ORG_NAME, PICARD_APP_NAME)) 52USER_PLUGIN_DIR = os.path.normpath(os.path.join(USER_DIR, "plugins")) 53 54# Network Cache default settings 55CACHE_DIR = os.path.normpath(QStandardPaths.writableLocation(QStandardPaths.CacheLocation)) 56CACHE_SIZE_IN_BYTES = 100*1000*1000 57 58# AcoustID client API key 59ACOUSTID_KEY = 'v8pQ6oyB' 60ACOUSTID_HOST = 'api.acoustid.org' 61ACOUSTID_PORT = 443 62FPCALC_NAMES = ['fpcalc', 'pyfpcalc'] 63 64# MB OAuth client credentials 65MUSICBRAINZ_OAUTH_CLIENT_ID = 'ACa9wsDX19cLp-AeEP-vVw' 66MUSICBRAINZ_OAUTH_CLIENT_SECRET = 'xIsvXbIuntaLuRRhzuazOA' 67 68# Cover art archive URL and port 69CAA_HOST = "coverartarchive.org" 70CAA_PORT = 443 71 72# Prepare documentation URLs 73if PICARD_VERSION.identifier == 'final': 74 DOCS_VERSION = "v{}.{}/".format(PICARD_VERSION.major, PICARD_VERSION.minor) 75else: 76 DOCS_VERSION = "" # points to latest version 77DOCS_LANGUAGE = 'en' 78DOCS_BASE_URL = "https://picard-docs.musicbrainz.org/" + DOCS_VERSION + DOCS_LANGUAGE 79 80# URLs 81PICARD_URLS = { 82 'home': "https://picard.musicbrainz.org/", 83 'documentation': DOCS_BASE_URL + '/', 84 'troubleshooting': DOCS_BASE_URL + '/troubleshooting/troubleshooting.html', 85 'doc_options': DOCS_BASE_URL + '/config/configuration.html', 86 'doc_scripting': DOCS_BASE_URL + '/extending/scripting.html', 87 'doc_cover_art_types': "https://musicbrainz.org/doc/Cover_Art/Types", 88 'plugins': "https://picard.musicbrainz.org/plugins/", 89 'forum': "https://community.metabrainz.org/c/picard", 90 'donate': "https://metabrainz.org/donate", 91 'chromaprint': "https://acoustid.org/chromaprint#download", 92 'acoustid_apikey': "https://acoustid.org/api-key", 93 'acoustid_track': "https://acoustid.org/track/", 94} 95 96# Various Artists MBID 97VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377' 98 99# Special purpose track titles 100SILENCE_TRACK_TITLE = '[silence]' 101DATA_TRACK_TITLE = '[data track]' 102 103# Release formats 104RELEASE_FORMATS = {} 105RELEASE_PRIMARY_GROUPS = {} 106RELEASE_SECONDARY_GROUPS = {} 107RELEASE_STATUS = {} 108for k, v in MB_ATTRIBUTES.items(): 109 if k.startswith('DB:medium_format/name:'): 110 RELEASE_FORMATS[v] = v 111 elif k.startswith('DB:release_group_primary_type/name:'): 112 RELEASE_PRIMARY_GROUPS[v] = v 113 elif k.startswith('DB:release_group_secondary_type/name:'): 114 RELEASE_SECONDARY_GROUPS[v] = v 115 elif k.startswith('DB:release_status/name:'): 116 RELEASE_STATUS[v] = v 117 118# Release countries 119from picard.const.countries import RELEASE_COUNTRIES # noqa: F401,E402 # pylint: disable=unused-import 120 121# List of available user interface languages 122from picard.const.languages import UI_LANGUAGES # noqa: F401,E402 # pylint: disable=unused-import 123 124# List of alias locales 125from picard.const.locales import ALIAS_LOCALES # noqa: F401,E402 # pylint: disable=unused-import 126 127# List of official musicbrainz servers - must support SSL for mblogin requests (such as collections). 128MUSICBRAINZ_SERVERS = [ 129 'musicbrainz.org', 130 'beta.musicbrainz.org', 131] 132 133# Plugins and Release Versions API 134PLUGINS_API = { 135 'host': 'picard.musicbrainz.org', 136 'port': 443, 137 'endpoint': { 138 'plugins': '/api/v2/plugins/', 139 'download': '/api/v2/download/', 140 'releases': '/api/v2/releases', 141 } 142} 143 144# Default query limit 145QUERY_LIMIT = 25 146 147# Maximum number of covers to draw in a stack in CoverArtThumbnail 148MAX_COVERS_TO_STACK = 4 149 150# Update levels available for automatic checking 151PROGRAM_UPDATE_LEVELS = OrderedDict( 152 [ 153 ( 154 0, { 155 'name': 'stable', 156 'title': N_('Stable releases only'), 157 } 158 ), 159 ( 160 1, { 161 'name': 'beta', 162 'title': N_('Stable and Beta releases'), 163 } 164 ), 165 ( 166 2, { 167 'name': 'dev', 168 'title': N_('Stable, Beta and Dev releases'), 169 } 170 ), 171 ] 172) 173 174 175DEFAULT_FILE_NAMING_FORMAT = "$if2(%albumartist%,%artist%)/\n" \ 176 "$if(%albumartist%,%album%/,)\n" \ 177 "$if($gt(%totaldiscs%,1),%discnumber%-,)" \ 178 "$if($and(%albumartist%,%tracknumber%),$num(%tracknumber%,2) ,)" \ 179 "$if(%_multiartist%,%artist% - ,)" \ 180 "%title%" 181 182 183DEFAULT_NUMBERED_SCRIPT_NAME = N_("My script %d") 184DEFAULT_SCRIPT_NAME = N_("My script") 185DEFAULT_COVER_IMAGE_FILENAME = "cover" 186