wiki_music.constants module

Warning

Documentation is stil under construction some things might not be up to date.

constants

Module which holds all the important constants used throughout the package.

constants.colors

Defines aliases for colorama color constrants to be used in whole package.

wiki_music.constants.colors.GREEN = '\x1b[32m'

used to higlight important messages in CLI mode

wiki_music.constants.colors.LGREEN = '\x1b[92m'

highlight less important messages in CLI mode

wiki_music.constants.colors.RESET = '\x1b[39m'

resets the foreground color to default

wiki_music.constants.colors.YELLOW = '\x1b[33m'

used to highlight warnings in CLI mode

wiki_music.constants.colors.LBLUE = '\x1b[94m'

used to highlight found files in CLI mode

wiki_music.constants.colors.CYAN = '\x1b[36m'

used to designate user input is needed in CLI mode

constants.parser_const

Holds constants that are used in parser.

wiki_music.constants.parser_const.CONTENTS_IDS = ('Track_listing', 'Personnel', 'Credits', 'References')

strings used to identify section headers in text and page contents

wiki_music.constants.parser_const.DEF_TYPES = ('Instrumental', 'Acoustic', 'Orchestral', 'Live', 'Piano', 'Acoustic Folk Medley')

defines possible types of tracks that parser is able to extract

wiki_music.constants.parser_const.DELIMITERS = ('written by', 'composed by', 'lyrics by', 'music by', 'arrangements by', 'vocal lines by', 'arranged by')

strings that are are used to extract composer name

wiki_music.constants.parser_const.COMPOSER_HEADER = ('lyrics', 'text', 'music', 'compose')

table headers that are used to assign personnel to composers or to artists list

wiki_music.constants.parser_const.TO_DELETE = {'bonus_track': re.compile('\\( ?bonus ?(track)? ?\\)', re.IGNORECASE), 'from_album': re.compile('\\( ?from (.*?)(;|,|\\||\\)) ?', re.IGNORECASE)}

regex expressions that are deleted from track title

wiki_music.constants.parser_const.UNWANTED = {'artist': re.compile(' ?feat\\.?(uring)? ?|narration( by)?:? ?', re.IGNORECASE), 'composer': re.compile('lyrics( and)?,? music:? ?|music( and)?,? lyrics:? ?|music:? ?|lyrics:? ?', re.IGNORECASE)}

defines unwanted strings that will be deleted from track title, also helps in extracting artists in brackets from track title

wiki_music.constants.parser_const.NO_LYRIS = ('Instrumental', 'Orchestral')

these tracks usually have no lyrics so no attempt to download them is made

wiki_music.constants.parser_const.ORDER_NUMBER = re.compile('^ *\\d+\\.? *')

regex expresion that matches number with/out dot and any muber of spaces

wiki_music.constants.parser_const.WIKI_GENRES = re.compile('/wiki/(?!Music_genre)', re.IGNORECASE)

regex expression that matches wikipedia genres

wiki_music.constants.parser_const.TIME = re.compile('\\( *\\d+\\:\\d+ *\\)')
Type:regex expression that matches time format e.g. (12
wiki_music.constants.parser_const.PERSONNEL_SECTIONS = ('personnel', 'credits', 'guests')

tuple with section headers from which personnel are extracted

constants.paths

Module defininng all path constants that are used in package.

wiki_music.constants.paths.ROOT_DIR = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music')

toplevel directory for file saving

wiki_music.constants.paths.LOG_DIR = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music/logs')

directory containing logs, profiling log and dir with parser output

wiki_music.constants.paths.OUTPUT_FOLDER = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music/logs/output')

folder containing human readable text output, of processed wiki page and also pickled version of wikipedia.WikipediaPage

wiki_music.constants.paths.OFFLINE_DEBUG_IMAGES = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/tests/offline_debug')

directory containing images used for offline debugging of image search

wiki_music.constants.paths.FILES_DIR = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music/files')

directory containing package files like icons etc.

wiki_music.constants.paths.GOOGLE_API_URL = 'https://console.developers.google.com/projectselector/apis/library/customsearch.googleapis.com'

Google API url

wiki_music.constants.paths.API_KEY_FILE = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music/files/google_api_key.txt')

Google API key file

wiki_music.constants.paths.module_path() → pathlib.Path

Outputs root path of the module.

Acounts for changes in path when app is frozen.

Returns:string with root module path
Return type:str

See also

we_are_frozen()

wiki_music.constants.paths.SETTINGS_INI = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/wikipedia-music-tags/checkouts/latest/wiki_music/files/settings.ini')

dictionary with package settings

constants.tags

Constants used by whole wiki_music module.

wiki_music.constants.tags.TAGS = ('ALBUM', 'ALBUMARTIST', 'ARTIST', 'COMPOSER', 'COVERART', 'DATE', 'DISCNUMBER', 'GENRE', 'LYRICS', 'TITLE', 'TRACKNUMBER')

enumeration of tags that we are able to read and write to music files

wiki_music.constants.tags.EXTENDED_TAGS = ('ALBUM', 'ALBUMARTIST', 'ARTIST', 'COMPOSER', 'COVERART', 'DATE', 'DISCNUMBER', 'GENRE', 'LYRICS', 'TITLE', 'TRACKNUMBER', 'FILE', 'TYPE')

tags extended with file path and track type which is not directly writen into file tags

wiki_music.constants.tags.STR_TAGS = ('GENRE', 'ALBUM', 'ALBUMARTIST', 'DATE')

marks tags which have separate entry fields in gui and are not displayed in tracklist table

wiki_music.constants.tags.LIST_TAGS = ('ARTIST', 'COMPOSER')

marks tags that consist of list of values for each entry