diff --git a/picard/profile.py b/picard/profile.py index 5056306d5c9..bb3065ce771 100644 --- a/picard/profile.py +++ b/picard/profile.py @@ -42,216 +42,216 @@ class UserProfileGroups(): SETTINGS_GROUPS = OrderedDict() # Add groups in the order they should be displayed # Each item in "settings" is a tuple of the setting key, the display title, and a list of the names of the widgets to highlight - SETTINGS_GROUPS["general"] = { - "title": N_("General"), - "settings": [ - SettingDesc("server_host", N_("Server address"), ["server_host"]), - SettingDesc("server_port", N_("Port"), ["server_port"]), - SettingDesc("analyze_new_files", N_("Automatically scan all new files"), ["analyze_new_files"]), - SettingDesc("cluster_new_files", N_("Automatically cluster all new files"), ["cluster_new_files"]), - SettingDesc("ignore_file_mbids", N_("Ignore MBIDs when loading new files"), ["ignore_file_mbids"]), - SettingDesc("check_for_plugin_updates", N_("Check for plugin updates during startup"), ["check_for_plugin_updates"]), - SettingDesc("check_for_updates", N_("Check for program updates during startup"), ["check_for_updates"]), - SettingDesc("update_check_days", N_("Days between update checks"), ["update_check_days"]), - SettingDesc("update_level", N_("Updates to check"), ["update_level"]), + SETTINGS_GROUPS['general'] = { + 'title': N_("General"), + 'settings': [ + SettingDesc('server_host', N_("Server address"), ['server_host']), + SettingDesc('server_port', N_("Port"), ['server_port']), + SettingDesc('analyze_new_files', N_("Automatically scan all new files"), ['analyze_new_files']), + SettingDesc('cluster_new_files', N_("Automatically cluster all new files"), ['cluster_new_files']), + SettingDesc('ignore_file_mbids', N_("Ignore MBIDs when loading new files"), ['ignore_file_mbids']), + SettingDesc('check_for_plugin_updates', N_("Check for plugin updates during startup"), ['check_for_plugin_updates']), + SettingDesc('check_for_updates', N_("Check for program updates during startup"), ['check_for_updates']), + SettingDesc('update_check_days', N_("Days between update checks"), ['update_check_days']), + SettingDesc('update_level', N_("Updates to check"), ['update_level']), ], } - SETTINGS_GROUPS["metadata"] = { - "title": N_("Metadata"), - "settings": [ + SETTINGS_GROUPS['metadata'] = { + 'title': N_("Metadata"), + 'settings': [ # Main Metadata Page - SettingDesc("translate_artist_names", N_("Translate artist names"), ["translate_artist_names"]), - SettingDesc("artist_locales", N_("Translation locales"), ["selected_locales"]), - SettingDesc("translate_artist_names_script_exception", N_("Translate artist names exception"), ["translate_artist_names_script_exception"]), - SettingDesc("script_exceptions", N_("Translation script exceptions"), ["selected_scripts"]), - SettingDesc("standardize_artists", N_("Use standardized artist names"), ["standardize_artists"]), - SettingDesc("standardize_instruments", N_("Use standardized instrument and vocal credits"), ["standardize_instruments"]), - SettingDesc("convert_punctuation", N_("Convert Unicode punctuation characters to ASCII"), ["convert_punctuation"]), - SettingDesc("release_ars", N_("Use release relationships"), ["release_ars"]), - SettingDesc("track_ars", N_("Use track relationships"), ["track_ars"]), - SettingDesc("guess_tracknumber_and_title", N_("Guess track number and title from filename if empty"), ["guess_tracknumber_and_title"]), - SettingDesc("va_name", N_("Various Artists name"), ["va_name"]), - SettingDesc("nat_name", N_("Standalone recordings name"), ["nat_name"]), + SettingDesc('translate_artist_names', N_("Translate artist names"), ['translate_artist_names']), + SettingDesc('artist_locales', N_("Translation locales"), ['selected_locales']), + SettingDesc('translate_artist_names_script_exception', N_("Translate artist names exception"), ['translate_artist_names_script_exception']), + SettingDesc('script_exceptions', N_("Translation script exceptions"), ['selected_scripts']), + SettingDesc('standardize_artists', N_("Use standardized artist names"), ['standardize_artists']), + SettingDesc('standardize_instruments', N_("Use standardized instrument and vocal credits"), ['standardize_instruments']), + SettingDesc('convert_punctuation', N_("Convert Unicode punctuation characters to ASCII"), ['convert_punctuation']), + SettingDesc('release_ars', N_("Use release relationships"), ['release_ars']), + SettingDesc('track_ars', N_("Use track relationships"), ['track_ars']), + SettingDesc('guess_tracknumber_and_title', N_("Guess track number and title from filename if empty"), ['guess_tracknumber_and_title']), + SettingDesc('va_name', N_("Various Artists name"), ['va_name']), + SettingDesc('nat_name', N_("Standalone recordings name"), ['nat_name']), # Preferred Releases Page - SettingDesc("release_type_scores", N_("Preferred release types"), ["type_group"]), - SettingDesc("preferred_release_countries", N_("Preferred release countries"), ["country_group"]), - SettingDesc("preferred_release_formats", N_("Preferred medium formats"), ["format_group"]), + SettingDesc('release_type_scores', N_("Preferred release types"), ['type_group']), + SettingDesc('preferred_release_countries', N_("Preferred release countries"), ['country_group']), + SettingDesc('preferred_release_formats', N_("Preferred medium formats"), ['format_group']), # Genres Page - SettingDesc("use_genres", N_("Use genres from MusicBrainz"), []), # No highlight specified because the "use_genres" + SettingDesc('use_genres', N_("Use genres from MusicBrainz"), []), # No highlight specified because the 'use_genres' # object is a QGroupBox and it highlights all sub # options, even if the sub options are not selected. - SettingDesc("only_my_genres", N_("Use only my genres"), ["only_my_genres"]), - SettingDesc("artists_genres", N_("Use album artist genres"), ["artists_genres"]), - SettingDesc("folksonomy_tags", N_("Use folksonomy tags as genre"), ["folksonomy_tags"]), - SettingDesc("min_genre_usage", N_("Minimal genre usage"), ["min_genre_usage"]), - SettingDesc("max_genres", N_("Maximum number of genres"), ["max_genres"]), - SettingDesc("join_genres", N_("Join multiple genres with"), ["join_genres"]), - SettingDesc("genres_filter", N_("Genres to include or exclude"), ["genres_filter"]), + SettingDesc('only_my_genres', N_("Use only my genres"), ['only_my_genres']), + SettingDesc('artists_genres', N_("Use album artist genres"), ['artists_genres']), + SettingDesc('folksonomy_tags', N_("Use folksonomy tags as genre"), ['folksonomy_tags']), + SettingDesc('min_genre_usage', N_("Minimal genre usage"), ['min_genre_usage']), + SettingDesc('max_genres', N_("Maximum number of genres"), ['max_genres']), + SettingDesc('join_genres', N_("Join multiple genres with"), ['join_genres']), + SettingDesc('genres_filter', N_("Genres to include or exclude"), ['genres_filter']), # Ratings Page - SettingDesc("enable_ratings", N_("Enable track ratings"), []), # No highlight specified because the "enable_ratings" + SettingDesc('enable_ratings', N_("Enable track ratings"), []), # No highlight specified because the 'enable_ratings' # object is a QGroupBox and it highlights all sub options, # even if the sub options are not selected. - SettingDesc("rating_user_email", N_("Email to use when saving ratings"), ["rating_user_email"]), - SettingDesc("submit_ratings", N_("Submit ratings to MusicBrainz"), ["submit_ratings"]), + SettingDesc('rating_user_email', N_("Email to use when saving ratings"), ['rating_user_email']), + SettingDesc('submit_ratings', N_("Submit ratings to MusicBrainz"), ['submit_ratings']), ], } - SETTINGS_GROUPS["tags"] = { - "title": N_("Tags"), - "settings": [ + SETTINGS_GROUPS['tags'] = { + 'title': N_("Tags"), + 'settings': [ # Main Tags Page - SettingDesc("dont_write_tags", N_("Don't write tags"), ["write_tags"]), - SettingDesc("preserve_timestamps", N_("Preserve timestamps of tagged files"), ["preserve_timestamps"]), - SettingDesc("clear_existing_tags", N_("Clear existing tags"), ["clear_existing_tags"]), - SettingDesc("preserve_images", N_("Keep embedded images when clearing tags"), ["preserve_images"]), - SettingDesc("remove_id3_from_flac", N_("Remove ID3 tags from FLAC files"), ["remove_id3_from_flac"]), - SettingDesc("remove_ape_from_mp3", N_("Remove APEv2 tags from MP3 files"), ["remove_ape_from_mp3"]), - SettingDesc("fix_missing_seekpoints_flac", N_("Fix missing seekpoints for FLAC files"), ["fix_missing_seekpoints_flac"]), - SettingDesc("preserved_tags", N_("Preserved tags list"), ["preserved_tags"]), + SettingDesc('dont_write_tags', N_("Don't write tags"), ['write_tags']), + SettingDesc('preserve_timestamps', N_("Preserve timestamps of tagged files"), ['preserve_timestamps']), + SettingDesc('clear_existing_tags', N_("Clear existing tags"), ['clear_existing_tags']), + SettingDesc('preserve_images', N_("Keep embedded images when clearing tags"), ['preserve_images']), + SettingDesc('remove_id3_from_flac', N_("Remove ID3 tags from FLAC files"), ['remove_id3_from_flac']), + SettingDesc('remove_ape_from_mp3', N_("Remove APEv2 tags from MP3 files"), ['remove_ape_from_mp3']), + SettingDesc('fix_missing_seekpoints_flac', N_("Fix missing seekpoints for FLAC files"), ['fix_missing_seekpoints_flac']), + SettingDesc('preserved_tags', N_("Preserved tags list"), ['preserved_tags']), # ID3 Tags Page - SettingDesc("write_id3v23", N_("ID3v2 version to write"), ["write_id3v23", "write_id3v24"]), - SettingDesc("id3v2_encoding", N_("ID3v2 text encoding"), ["enc_utf8", "enc_utf16", "enc_iso88591"]), - SettingDesc("id3v23_join_with", N_("ID3v2.3 join character"), ["id3v23_join_with"]), - SettingDesc("itunes_compatible_grouping", N_("Save iTunes compatible grouping and work"), ["itunes_compatible_grouping"]), - SettingDesc("write_id3v1", N_("Write ID3v1 tags"), ["write_id3v1"]), + SettingDesc('write_id3v23', N_("ID3v2 version to write"), ['write_id3v23', 'write_id3v24']), + SettingDesc('id3v2_encoding', N_("ID3v2 text encoding"), ['enc_utf8', 'enc_utf16', 'enc_iso88591']), + SettingDesc('id3v23_join_with', N_("ID3v2.3 join character"), ['id3v23_join_with']), + SettingDesc('itunes_compatible_grouping', N_("Save iTunes compatible grouping and work"), ['itunes_compatible_grouping']), + SettingDesc('write_id3v1', N_("Write ID3v1 tags"), ['write_id3v1']), # AAC Tags Page - SettingDesc("aac_save_ape", N_("Save APEv2 tags to AAC"), ["aac_save_ape", "aac_no_tags"]), - SettingDesc("remove_ape_from_aac", N_("Remove APEv2 tags from AAC files"), ["remove_ape_from_aac"]), + SettingDesc('aac_save_ape', N_("Save APEv2 tags to AAC"), ['aac_save_ape', 'aac_no_tags']), + SettingDesc('remove_ape_from_aac', N_("Remove APEv2 tags from AAC files"), ['remove_ape_from_aac']), # AC3 Tags Page - SettingDesc("ac3_save_ape", N_("Save APEv2 tags to AC3"), ["ac3_save_ape", "ac3_no_tags"]), - SettingDesc("remove_ape_from_ac3", N_("Remove APEv2 tags from AC3 files"), ["remove_ape_from_ac3"]), + SettingDesc('ac3_save_ape', N_("Save APEv2 tags to AC3"), ['ac3_save_ape', 'ac3_no_tags']), + SettingDesc('remove_ape_from_ac3', N_("Remove APEv2 tags from AC3 files"), ['remove_ape_from_ac3']), # WAVE Tags Page - SettingDesc("write_wave_riff_info", N_("Write RIFF INFO tags to WAVE files"), ["write_wave_riff_info"]), - SettingDesc("remove_wave_riff_info", N_("Remove existing RIFF INFO tags from WAVE files"), ["remove_wave_riff_info"]), - SettingDesc("wave_riff_info_encoding", N_("RIFF INFO text encoding"), ["wave_riff_info_enc_cp1252", "wave_riff_info_enc_utf8"]), + SettingDesc('write_wave_riff_info', N_("Write RIFF INFO tags to WAVE files"), ['write_wave_riff_info']), + SettingDesc('remove_wave_riff_info', N_("Remove existing RIFF INFO tags from WAVE files"), ['remove_wave_riff_info']), + SettingDesc('wave_riff_info_encoding', N_("RIFF INFO text encoding"), ['wave_riff_info_enc_cp1252', 'wave_riff_info_enc_utf8']), ], } - SETTINGS_GROUPS["cover"] = { - "title": N_("Cover Art"), - "settings": [ - SettingDesc("save_images_to_tags", N_("Embed cover images into tags"), ["save_images_to_tags"]), - SettingDesc("embed_only_one_front_image", N_("Embed only a single front image"), ["cb_embed_front_only"]), - SettingDesc("save_images_to_files", N_("Save cover images as separate files"), ["save_images_to_files"]), - SettingDesc("cover_image_filename", N_("File name for images"), ["cover_image_filename"]), - SettingDesc("save_images_overwrite", N_("Overwrite existing image files"), ["save_images_overwrite"]), - SettingDesc("save_only_one_front_image", N_("Save only a single front image as separate file"), ["save_only_one_front_image"]), - SettingDesc("image_type_as_filename", N_("Always use the primary image type as the file name for non-front images"), ["image_type_as_filename"]), - SettingDesc("ca_providers", N_("Cover art providers"), ["ca_providers_list"]), + SETTINGS_GROUPS['cover'] = { + 'title': N_("Cover Art"), + 'settings': [ + SettingDesc('save_images_to_tags', N_("Embed cover images into tags"), ['save_images_to_tags']), + SettingDesc('embed_only_one_front_image', N_("Embed only a single front image"), ['cb_embed_front_only']), + SettingDesc('save_images_to_files', N_("Save cover images as separate files"), ['save_images_to_files']), + SettingDesc('cover_image_filename', N_("File name for images"), ['cover_image_filename']), + SettingDesc('save_images_overwrite', N_("Overwrite existing image files"), ['save_images_overwrite']), + SettingDesc('save_only_one_front_image', N_("Save only a single front image as separate file"), ['save_only_one_front_image']), + SettingDesc('image_type_as_filename', N_("Always use the primary image type as the file name for non-front images"), ['image_type_as_filename']), + SettingDesc('ca_providers', N_("Cover art providers"), ['ca_providers_list']), ], } - SETTINGS_GROUPS["filerenaming"] = { - "title": N_("File Naming"), - "settings": [ + SETTINGS_GROUPS['filerenaming'] = { + 'title': N_("File Naming"), + 'settings': [ # Main File Naming Page - SettingDesc("move_files", N_("Move files"), ["move_files"]), - SettingDesc("move_files_to", N_("Destination directory"), ["move_files_to"]), - SettingDesc("move_additional_files", N_("Move additional files"), ["move_additional_files"]), - SettingDesc("move_additional_files_pattern", N_("Additional file patterns"), ["move_additional_files_pattern"]), - SettingDesc("delete_empty_dirs", N_("Delete empty directories"), ["delete_empty_dirs"]), - SettingDesc("rename_files", N_("Rename files"), ["rename_files"]), - SettingDesc("selected_file_naming_script_id", N_("Selected file naming script"), ["naming_script_selector"]), + SettingDesc('move_files', N_("Move files"), ['move_files']), + SettingDesc('move_files_to', N_("Destination directory"), ['move_files_to']), + SettingDesc('move_additional_files', N_("Move additional files"), ['move_additional_files']), + SettingDesc('move_additional_files_pattern', N_("Additional file patterns"), ['move_additional_files_pattern']), + SettingDesc('delete_empty_dirs', N_("Delete empty directories"), ['delete_empty_dirs']), + SettingDesc('rename_files', N_("Rename files"), ['rename_files']), + SettingDesc('selected_file_naming_script_id', N_("Selected file naming script"), ['naming_script_selector']), # File Naming Compatibility Page - SettingDesc("ascii_filenames", N_("Replace non-ASCII characters"), ["ascii_filenames"]), - SettingDesc("windows_compatibility", N_("Windows compatibility"), ["windows_compatibility"]), - SettingDesc("win_compat_replacements", N_("Replacement characters used for Windows compatibility"), ["win_compat_replacements"]), - SettingDesc("windows_long_paths", N_("Windows long path support"), ["windows_long_paths"]), - SettingDesc("replace_spaces_with_underscores", N_("Replace spaces with underscores"), ["replace_spaces_with_underscores"]), - SettingDesc("replace_dir_separator", N_("Replacement character to use for directory separators"), ["replace_dir_separator"]), + SettingDesc('ascii_filenames', N_("Replace non-ASCII characters"), ['ascii_filenames']), + SettingDesc('windows_compatibility', N_("Windows compatibility"), ['windows_compatibility']), + SettingDesc('win_compat_replacements', N_("Replacement characters used for Windows compatibility"), ['win_compat_replacements']), + SettingDesc('windows_long_paths', N_("Windows long path support"), ['windows_long_paths']), + SettingDesc('replace_spaces_with_underscores', N_("Replace spaces with underscores"), ['replace_spaces_with_underscores']), + SettingDesc('replace_dir_separator', N_("Replacement character to use for directory separators"), ['replace_dir_separator']), ], } - SETTINGS_GROUPS["scripting"] = { - "title": N_("Scripting"), - "settings": [ - SettingDesc("enable_tagger_scripts", N_("Enable tagger scripts"), ["enable_tagger_scripts"]), - SettingDesc("list_of_scripts", N_("Tagger scripts"), ["script_list"]), + SETTINGS_GROUPS['scripting'] = { + 'title': N_("Scripting"), + 'settings': [ + SettingDesc('enable_tagger_scripts', N_("Enable tagger scripts"), ['enable_tagger_scripts']), + SettingDesc('list_of_scripts', N_("Tagger scripts"), ['script_list']), ], } - SETTINGS_GROUPS["interface"] = { - "title": N_("User Interface"), - "settings": [ + SETTINGS_GROUPS['interface'] = { + 'title': N_("User Interface"), + 'settings': [ # Main User Interface Page - SettingDesc("toolbar_show_labels", N_("Show text labels under icons"), ["toolbar_show_labels"]), - SettingDesc("show_menu_icons", N_("Show icons in menus"), ["show_menu_icons"]), - SettingDesc("ui_language", N_("User interface language"), ["ui_language"]), - SettingDesc("ui_theme", N_("User interface color theme"), ["ui_theme"]), - SettingDesc("toolbar_multiselect", N_("Allow selection of multiple directories"), ["toolbar_multiselect"]), - SettingDesc("builtin_search", N_("Use builtin search rather than looking in browser"), ["builtin_search"]), - SettingDesc("use_adv_search_syntax", N_("Use advanced search syntax"), ["use_adv_search_syntax"]), - SettingDesc("show_new_user_dialog", N_("Show a usage warning dialog when Picard starts"), ["new_user_dialog"]), - SettingDesc("quit_confirmation", N_("Show a quit confirmation dialog for unsaved changes"), ["quit_confirmation"]), - SettingDesc("file_save_warning", N_("Show a confirmation dialog when saving files"), ["file_save_warning"]), - SettingDesc("filebrowser_horizontal_autoscroll", N_("Adjust horizontal position in file browser automatically"), ["filebrowser_horizontal_autoscroll"]), - SettingDesc("starting_directory", N_("Begin browsing in a specific directory"), ["starting_directory"]), - SettingDesc("starting_directory_path", N_("Directory to begin browsing"), ["starting_directory_path"]), + SettingDesc('toolbar_show_labels', N_("Show text labels under icons"), ['toolbar_show_labels']), + SettingDesc('show_menu_icons', N_("Show icons in menus"), ['show_menu_icons']), + SettingDesc('ui_language', N_("User interface language"), ['ui_language']), + SettingDesc('ui_theme', N_("User interface color theme"), ['ui_theme']), + SettingDesc('toolbar_multiselect', N_("Allow selection of multiple directories"), ['toolbar_multiselect']), + SettingDesc('builtin_search', N_("Use builtin search rather than looking in browser"), ['builtin_search']), + SettingDesc('use_adv_search_syntax', N_("Use advanced search syntax"), ['use_adv_search_syntax']), + SettingDesc('show_new_user_dialog', N_("Show a usage warning dialog when Picard starts"), ['new_user_dialog']), + SettingDesc('quit_confirmation', N_("Show a quit confirmation dialog for unsaved changes"), ['quit_confirmation']), + SettingDesc('file_save_warning', N_("Show a confirmation dialog when saving files"), ['file_save_warning']), + SettingDesc('filebrowser_horizontal_autoscroll', N_("Adjust horizontal position in file browser automatically"), ['filebrowser_horizontal_autoscroll']), + SettingDesc('starting_directory', N_("Begin browsing in a specific directory"), ['starting_directory']), + SettingDesc('starting_directory_path', N_("Directory to begin browsing"), ['starting_directory_path']), # User Interface Colors Page - SettingDesc("interface_colors", N_("Colors to use for light theme"), ["colors"]), - SettingDesc("interface_colors_dark", N_("Colors to use for dark theme"), ["colors"]), + SettingDesc('interface_colors', N_("Colors to use for light theme"), ['colors']), + SettingDesc('interface_colors_dark', N_("Colors to use for dark theme"), ['colors']), # User Interface Top Tags Page - SettingDesc("metadatabox_top_tags", N_("Tags to show at the top"), ["top_tags_groupBox"]), + SettingDesc('metadatabox_top_tags', N_("Tags to show at the top"), ['top_tags_groupBox']), # User Interface Action Toolbar Page - SettingDesc("toolbar_layout", N_("Layout of the tool bar"), ["toolbar_layout_list"]), + SettingDesc('toolbar_layout', N_("Layout of the tool bar"), ['toolbar_layout_list']), ], } - SETTINGS_GROUPS["advanced"] = { - "title": N_("Advanced"), - "settings": [ + SETTINGS_GROUPS['advanced'] = { + 'title': N_("Advanced"), + 'settings': [ # Main Advanced Options Page - SettingDesc("ignore_regex", N_("Ignore file paths matching a regular expression"), ["ignore_regex"]), - SettingDesc("ignore_hidden_files", N_("Ignore hidden files"), ["ignore_hidden_files"]), - SettingDesc("recursively_add_files", N_("Include sub-folders when adding files from folder"), ["recursively_add_files"]), + SettingDesc('ignore_regex', N_("Ignore file paths matching a regular expression"), ['ignore_regex']), + SettingDesc('ignore_hidden_files', N_("Ignore hidden files"), ['ignore_hidden_files']), + SettingDesc('recursively_add_files', N_("Include sub-folders when adding files from folder"), ['recursively_add_files']), SettingDesc( - "ignore_track_duration_difference_under", + 'ignore_track_duration_difference_under', N_("Ignore track duration difference under x seconds"), - ["ignore_track_duration_difference_under", "label_track_duration_diff"] + ['ignore_track_duration_difference_under', 'label_track_duration_diff'] ), SettingDesc( - "query_limit", + 'query_limit', N_("Maximum number of entities to return per MusicBrainz query"), - ["query_limit", "label_query_limit"] + ['query_limit', 'label_query_limit'] ), - SettingDesc("completeness_ignore_videos", N_("Completeness check ignore: Video tracks"), ["completeness_ignore_videos"]), - SettingDesc("completeness_ignore_pregap", N_("Completeness check ignore: Pregap tracks"), ["completeness_ignore_pregap"]), - SettingDesc("completeness_ignore_data", N_("Completeness check ignore: Data tracks"), ["completeness_ignore_data"]), - SettingDesc("completeness_ignore_silence", N_("Completeness check ignore: Silent tracks"), ["completeness_ignore_silence"]), - SettingDesc("compare_ignore_tags", N_("Tags to ignore for comparison"), ["groupBox_2"]), + SettingDesc('completeness_ignore_videos', N_("Completeness check ignore: Video tracks"), ['completeness_ignore_videos']), + SettingDesc('completeness_ignore_pregap', N_("Completeness check ignore: Pregap tracks"), ['completeness_ignore_pregap']), + SettingDesc('completeness_ignore_data', N_("Completeness check ignore: Data tracks"), ['completeness_ignore_data']), + SettingDesc('completeness_ignore_silence', N_("Completeness check ignore: Silent tracks"), ['completeness_ignore_silence']), + SettingDesc('compare_ignore_tags', N_("Tags to ignore for comparison"), ['groupBox_2']), # Network Options Page - SettingDesc("use_proxy", N_("Use a web proxy server"), []), # No highlight specified because the "use_proxy" + SettingDesc('use_proxy', N_("Use a web proxy server"), []), # No highlight specified because the 'use_proxy' # object is a QGroupBox and it highlights all sub # options, even if the sub options are not selected. - SettingDesc("proxy_type", N_("type of proxy server"), ["proxy_type_socks", "proxy_type_http"]), - SettingDesc("proxy_server_host", N_("Proxy server address"), ["server_host"]), - SettingDesc("proxy_server_port", N_("Proxy server port"), ["server_port"]), - SettingDesc("proxy_username", N_("Proxy username"), ["username"]), - SettingDesc("proxy_password", N_("Proxy password"), ["password"]), - SettingDesc("network_transfer_timeout_seconds", N_("Request timeout in seconds"), ["transfer_timeout"]), - SettingDesc("browser_integration", N_("Browser integration"), []), # No highlight specified because the "browser_integration" + SettingDesc('proxy_type', N_("type of proxy server"), ['proxy_type_socks', 'proxy_type_http']), + SettingDesc('proxy_server_host', N_("Proxy server address"), ['server_host']), + SettingDesc('proxy_server_port', N_("Proxy server port"), ['server_port']), + SettingDesc('proxy_username', N_("Proxy username"), ['username']), + SettingDesc('proxy_password', N_("Proxy password"), ['password']), + SettingDesc('network_transfer_timeout_seconds', N_("Request timeout in seconds"), ['transfer_timeout']), + SettingDesc('browser_integration', N_("Browser integration"), []), # No highlight specified because the 'browser_integration' # object is a QGroupBox and it highlights all sub options, # even if the sub options are not selected. - SettingDesc("browser_integration_port", N_("Default listening port"), ["browser_integration_port"]), - SettingDesc("browser_integration_localhost_only", N_("Listen only on localhost"), ["browser_integration_localhost_only"]), + SettingDesc('browser_integration_port', N_("Default listening port"), ['browser_integration_port']), + SettingDesc('browser_integration_localhost_only', N_("Listen only on localhost"), ['browser_integration_localhost_only']), # Matching Options Page - SettingDesc("file_lookup_threshold", N_("Minimal similarity for file lookups"), ["file_lookup_threshold"]), - SettingDesc("cluster_lookup_threshold", N_("Minimal similarity for cluster lookups"), ["cluster_lookup_threshold"]), - SettingDesc("track_matching_threshold", N_("Minimal similarity for matching files to tracks"), ["track_matching_threshold"]), + SettingDesc('file_lookup_threshold', N_("Minimal similarity for file lookups"), ['file_lookup_threshold']), + SettingDesc('cluster_lookup_threshold', N_("Minimal similarity for cluster lookups"), ['cluster_lookup_threshold']), + SettingDesc('track_matching_threshold', N_("Minimal similarity for matching files to tracks"), ['track_matching_threshold']), ], } diff --git a/picard/releasegroup.py b/picard/releasegroup.py index f8b2b6d60a3..0fdcf986d0f 100644 --- a/picard/releasegroup.py +++ b/picard/releasegroup.py @@ -56,7 +56,7 @@ def __init__(self, rg_id): self.refcount = 0 def load_versions(self, callback): - kwargs = {"release-group": self.id, "limit": 100} + kwargs = {'release-group': self.id, 'limit': 100} self.tagger.mb_api.browse_releases(partial(self._request_finished, callback), **kwargs) def _parse_versions(self, document): @@ -64,17 +64,17 @@ def _parse_versions(self, document): del self.versions[:] data = [] - namekeys = ("tracks", "year", "country", "format", "label", "catnum") + namekeys = ('tracks', 'year', 'country', 'format', 'label', 'catnum') headings = { - "tracks": N_('Tracks'), - "year": N_('Year'), - "country": N_('Country'), - "format": N_('Format'), - "label": N_('Label'), - "catnum": N_('Cat No'), + 'tracks': N_("Tracks"), + 'year': N_("Year"), + 'country': N_("Country"), + 'format': N_("Format"), + 'label': N_("Label"), + 'catnum': N_("Cat No"), } # additional keys displayed only for disambiguation - extrakeys = ("packaging", "barcode", "disambiguation") + extrakeys = ('packaging', 'barcode', 'disambiguation') try: releases = document['releases'] @@ -97,23 +97,23 @@ def _parse_versions(self, document): tracks = "+".join(str(m['track-count']) for m in node['media']) formats = [] for medium in node['media']: - if "format" in medium: + if 'format' in medium: formats.append(medium['format']) release = { - "id": node['id'], - "year": node['date'][:4] if "date" in node else "????", - "country": country_label, - "format": media_formats_from_node(node['media']), - "label": ", ".join(' '.join(x.split(' ')[:2]) for x in set(labels)), - "catnum": ", ".join(set(catnums)), - "tracks": tracks, - "barcode": node.get('barcode', '') or _('[no barcode]'), - "packaging": node.get('packaging', '') or '??', - "disambiguation": node.get('disambiguation', ''), - "_disambiguate_name": list(), - "totaltracks": sum(m['track-count'] for m in node['media']), - "countries": countries, - "formats": formats, + 'id': node['id'], + 'year': node['date'][:4] if 'date' in node else '????', + 'country': country_label, + 'format': media_formats_from_node(node['media']), + 'label': ', '.join(' '.join(x.split(' ')[:2]) for x in set(labels)), + 'catnum': ', '.join(set(catnums)), + 'tracks': tracks, + 'barcode': node.get('barcode', '') or _('[no barcode]'), + 'packaging': node.get('packaging', '') or '??', + 'disambiguation': node.get('disambiguation', ''), + '_disambiguate_name': list(), + 'totaltracks': sum(m['track-count'] for m in node['media']), + 'countries': countries, + 'formats': formats, } data.append(release) @@ -122,7 +122,7 @@ def _parse_versions(self, document): # Group versions by same display name for release in data: name = " / ".join(release[k] for k in namekeys) - if name == release["tracks"]: + if name == release['tracks']: name = "%s / %s" % (_('[no release info]'), name) versions[name].append(release) diff --git a/picard/tagger.py b/picard/tagger.py index 6b95327a0e2..6e1b62d8a53 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -189,12 +189,12 @@ def __init__(self, items): log.debug(f"Parsed: {repr(parsed)}") if not parsed.scheme: self.files.add(item) - if parsed.scheme == "file": + if parsed.scheme == 'file': # remove file:// prefix safely self.files.add(item[7:]) - elif parsed.scheme == "mbid": + elif parsed.scheme == 'mbid': self.mbids.add(parsed.netloc + parsed.path) - elif parsed.scheme in {"http", "https"}: + elif parsed.scheme in {'http', 'https'}: # .path returns / before actual link self.urls.add(parsed.path[1:]) elif IS_WIN and self.WINDOWS_DRIVE_TEST.match(item): @@ -254,7 +254,7 @@ def __init__(self, picard_args, localedir, autoupdate, pipe_handler=None): self.set_log_level(config.setting['log_verbosity']) - if picard_args.debug or "PICARD_DEBUG" in os.environ: + if picard_args.debug or 'PICARD_DEBUG' in os.environ: self.set_log_level(logging.DEBUG) if picard_args.audit: @@ -330,7 +330,7 @@ def __init__(self, picard_args, localedir, autoupdate, pipe_handler=None): # Must be before config upgrade because upgrade dialogs need to be # translated - setup_gettext(localedir, config.setting["ui_language"], log.debug) + setup_gettext(localedir, config.setting['ui_language'], log.debug) upgrade_config(config) @@ -390,9 +390,9 @@ def pipe_server(self): def _pipe_server_finished(self, result=None, error=None): if error: - log.error('pipe server failed: %r', error) + log.error("pipe server failed: %r", error) else: - log.debug('pipe server stopped') + log.debug("pipe server stopped") def start_process_commands(self): if not self._command_thread_running: @@ -455,9 +455,9 @@ def run_commands(self): def _run_commands_finished(self, result=None, error=None): if error: - log.error('command executor failed: %r', error) + log.error("command executor failed: %r", error) else: - log.debug('command executor stopped') + log.debug("command executor stopped") def load_to_picard(self, items): commands = [] @@ -649,7 +649,7 @@ def _mb_login_dialog(self, parent): return None def mb_login(self, callback, parent=None): - scopes = "profile tag rating collection submit_isrc submit_barcode" + scopes = 'profile tag rating collection submit_isrc submit_barcode' authorization_url = self.webservice.oauth_manager.get_authorization_url(scopes) webbrowser2.open(authorization_url) authorization_code = self._mb_login_dialog(parent) @@ -696,7 +696,7 @@ def move_file_to_track(self, file, albumid, recordingid): def create_nats(self): if self.nats is None: self.nats = NatAlbum() - self.albums["NATS"] = self.nats + self.albums['NATS'] = self.nats self.album_added.emit(self.nats) self.nats.item.setExpanded(True) return self.nats @@ -750,7 +750,7 @@ def run(self): def update_browser_integration(self): config = get_config() - if config.setting["browser_integration"]: + if config.setting['browser_integration']: self.browser_integration.start() else: self.browser_integration.stop() @@ -787,7 +787,7 @@ def _file_loaded(self, file, target=None, remove_file=False, unmatched_files=Non return file_moved = False - if not config.setting["ignore_file_mbids"]: + if not config.setting['ignore_file_mbids']: recordingid = file.metadata.getall('musicbrainz_recordingid') recordingid = recordingid[0] if recordingid else '' is_valid_recordingid = mbid_validate(recordingid) @@ -826,7 +826,7 @@ def _file_loaded(self, file, target=None, remove_file=False, unmatched_files=Non self.analyze([file]) # Auto cluster newly added files if they are not explicitly moved elsewhere - if self._pending_files_count == 0 and unmatched_files and config.setting["cluster_new_files"]: + if self._pending_files_count == 0 and unmatched_files and config.setting['cluster_new_files']: self.cluster(unmatched_files) def move_file(self, file, target): @@ -948,8 +948,8 @@ def add_paths(self, paths, target=None): def get_file_lookup(self): """Return a FileLookup object.""" config = get_config() - return FileLookup(self, config.setting["server_host"], - config.setting["server_port"], + return FileLookup(self, config.setting['server_host'], + config.setting['server_port'], self.browser_integration.port) def search(self, text, search_type, adv=False, mbid_matched_callback=None, force_browser=False): @@ -988,7 +988,7 @@ def collection_lookup(self): """Lookup the users collections on the MusicBrainz website.""" lookup = self.get_file_lookup() config = get_config() - lookup.collection_lookup(config.persist["oauth_username"]) + lookup.collection_lookup(config.persist['oauth_username']) def browser_lookup(self, item): """Lookup the object's metadata on the MusicBrainz website.""" @@ -1003,10 +1003,10 @@ def browser_lookup(self, item): lookup.album_lookup(itemid) else: lookup.tag_lookup( - metadata["albumartist"] if item.is_album_like() else metadata["artist"], - metadata["album"], - metadata["title"], - metadata["tracknumber"], + metadata['albumartist'] if item.is_album_like() else metadata['artist'], + metadata['album'], + metadata['title'], + metadata['tracknumber'], '' if item.is_album_like() else str(metadata.length), item.filename if isinstance(item, File) else '') @@ -1029,7 +1029,7 @@ def load_mbid(self, type, mbid): elif type == 'nat': self.load_nat(mbid) else: - log.warning('Unknown type to load: %s', type) + log.warning("Unknown type to load: %s", type) def load_album(self, album_id, discid=None): album_id = self.mbid_redirects.get(album_id, album_id) @@ -1162,8 +1162,8 @@ def lookup_cd(self, action): return self.lookup_discid_from_logfile() else: device = data - elif config.setting["cd_lookup_device"] != '': - device = config.setting["cd_lookup_device"].split(",", 1)[0] + elif config.setting['cd_lookup_device'] != '': + device = config.setting['cd_lookup_device'].split(',', 1)[0] else: # rely on python-discid auto detection device = None @@ -1215,7 +1215,7 @@ def _parse_disc_ripping_log(self, disc, path): @property def use_acoustid(self): config = get_config() - return config.setting["fingerprinting_system"] == "acoustid" + return config.setting['fingerprinting_system'] == 'acoustid' def analyze(self, objs): """Analyze the file(s).""" @@ -1266,7 +1266,7 @@ def _do_clustering(self, files): def _clustering_finished(self, callback, result=None, error=None): if error: - log.error('Error while clustering: %r', error) + log.error("Error while clustering: %r", error) return self.window.set_sorting(False) @@ -1285,7 +1285,7 @@ def _clustering_finished(self, callback, result=None, error=None): def load_cluster(self, name, artist): for cluster in self.clusters: cm = cluster.metadata - if name == cm["album"] and artist == cm["albumartist"]: + if name == cm['album'] and artist == cm['albumartist']: return cluster cluster = Cluster(name, artist) self.clusters.append(cluster) @@ -1401,7 +1401,7 @@ def print_help_for_commands(): maxwidth = 80 informative_text = [] - message = """usage: picard -e [command] [arguments ...] + message = """Usage: picard -e [command] [arguments ...] or picard -e [command 1] [arguments ...] -e [command 2] [arguments ...] List of the commands available to execute in Picard from the command-line: @@ -1435,38 +1435,38 @@ def process_picard_args(): ) # Qt default arguments. Parse them so Picard does not interpret the # arguments as file names to load. - parser.add_argument("-style", nargs=1, help=argparse.SUPPRESS) - parser.add_argument("-stylesheet", nargs=1, help=argparse.SUPPRESS) + parser.add_argument('-style', nargs=1, help=argparse.SUPPRESS) + parser.add_argument('-stylesheet', nargs=1, help=argparse.SUPPRESS) # Same for default X arguments - parser.add_argument("-display", nargs=1, help=argparse.SUPPRESS) + parser.add_argument('-display', nargs=1, help=argparse.SUPPRESS) # Picard specific arguments - parser.add_argument("-a", "--audit", action='store', + parser.add_argument('-a', '--audit', action='store', default=None, help="audit events passed as a comma-separated list, prefixes supported, " "use all to match any (see https://docs.python.org/3/library/audit_events.html#audit-events)") - parser.add_argument("-c", "--config-file", action='store', + parser.add_argument('-c', '--config-file', action='store', default=None, help="location of the configuration file") - parser.add_argument("-d", "--debug", action='store_true', + parser.add_argument('-d', '--debug', action='store_true', help="enable debug-level logging") - parser.add_argument("-e", "--exec", nargs="+", action='append', + parser.add_argument('-e', '--exec', nargs='+', action='append', help="send command (arguments can be entered after space) to a running instance " "(use `-e help` for a list of the available commands)", - metavar="COMMAND") - parser.add_argument("-M", "--no-player", action='store_true', + metavar='COMMAND') + parser.add_argument('-M', '--no-player', action='store_true', help="disable built-in media player") - parser.add_argument("-N", "--no-restore", action='store_true', + parser.add_argument('-N', '--no-restore', action='store_true', help="do not restore positions and/or sizes") - parser.add_argument("-P", "--no-plugins", action='store_true', + parser.add_argument('-P', '--no-plugins', action='store_true', help="do not load any plugins") - parser.add_argument("--no-crash-dialog", action='store_true', + parser.add_argument('--no-crash-dialog', action='store_true', help="disable the crash dialog") - parser.add_argument("-s", "--stand-alone-instance", action='store_true', + parser.add_argument('-s', '--stand-alone-instance', action='store_true', help="force Picard to create a new, stand-alone instance") parser.add_argument('-v', '--version', action='store_true', help="display version information and exit") - parser.add_argument("-V", "--long-version", action='store_true', + parser.add_argument('-V', '--long-version', action='store_true', help="display long version information and exit") parser.add_argument('FILE_OR_URL', nargs='*', help="the file(s), URL(s) and MBID(s) to load") @@ -1488,7 +1488,7 @@ def process_picard_args(): if args.exec: for e in args.exec: - args.remote_commands_help = args.remote_commands_help or "HELP" in {x.upper().strip() for x in e} + args.remote_commands_help = args.remote_commands_help or 'HELP' in {x.upper().strip() for x in e} remote_command_args = e[1:] or [''] for arg in remote_command_args: args.processable.append(f"{e[0]} {arg}") @@ -1571,10 +1571,10 @@ def main(localedir=None, autoupdate=True): locale = QtCore.QLocale() translation_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.LibraryLocation.TranslationsPath) log.debug("Looking for Qt locale %s in %s", locale.name(), translation_path) - if translator.load(locale, "qtbase_", directory=translation_path): + if translator.load(locale, 'qtbase_', directory=translation_path): tagger.installTranslator(translator) else: - log.debug('Qt locale %s not available', locale.name()) + log.debug("Qt locale %s not available", locale.name()) tagger.startTimer(1000) exit_code = tagger.run() diff --git a/picard/track.py b/picard/track.py index fbdbe06fbe9..e60736f5745 100644 --- a/picard/track.py +++ b/picard/track.py @@ -176,7 +176,7 @@ def update_file_metadata(self, file): # Run the scripts for the file to allow usage of # file specific metadata and variables config = get_config() - if config.setting["clear_existing_tags"]: + if config.setting['clear_existing_tags']: metadata = Metadata(self.orig_metadata) metadata_proxy = MultiMetadataProxy(metadata, file.metadata) self.run_scripts(metadata_proxy) @@ -394,22 +394,22 @@ def load(self, priority=False, refresh=False): config = get_config() require_authentication = False inc = { - "aliases", - "artist-credits", - "artists", + 'aliases', + 'artist-credits', + 'artists', } - if config.setting["track_ars"]: + if config.setting['track_ars']: inc |= { - "artist-rels", - "recording-rels", - "url-rels", - "work-level-rels", - "work-rels", + 'artist-rels', + 'recording-rels', + 'url-rels', + 'work-level-rels', + 'work-rels', } require_authentication = self.set_genre_inc_params(inc, config) or require_authentication - if config.setting["enable_ratings"]: + if config.setting['enable_ratings']: require_authentication = True - inc |= {"user-ratings"} + inc |= {'user-ratings'} self.tagger.mb_api.get_track_by_id( self.id, self._recording_request_finished,