mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 15:14:13 +00:00
Added default release country option (ticket #3452)
This commit is contained in:
@@ -128,7 +128,12 @@ class Album(DataObject, Item):
|
||||
break
|
||||
else:
|
||||
if self.release_events:
|
||||
self.current_release_event = self.release_events[0]
|
||||
preferred_events = [rel for rel in self.release_events
|
||||
if rel.releasecountry == self.config.setting["preferred_release_country"]]
|
||||
if preferred_events:
|
||||
self.current_release_event = preferred_events[0]
|
||||
else:
|
||||
self.current_release_event = self.release_events[0]
|
||||
if self.current_release_event:
|
||||
self.current_release_event.to_metadata(m)
|
||||
|
||||
|
||||
249
picard/const.py
249
picard/const.py
@@ -34,3 +34,252 @@ AMAZON_STORE_ASSOCIATE_IDS = {
|
||||
|
||||
# MusicDNS client ID
|
||||
MUSICDNS_KEY = "0736ac2cd889ef77f26f6b5e3fb8a09c"
|
||||
|
||||
# Release countries
|
||||
RELEASE_COUNTRIES = {
|
||||
u'BD': N_('Bangladesh'),
|
||||
u'BE': N_('Belgium'),
|
||||
u'BF': N_('Burkina Faso'),
|
||||
u'BG': N_('Bulgaria'),
|
||||
u'BB': N_('Barbados'),
|
||||
u'WF': N_('Wallis and Futuna Islands'),
|
||||
u'BM': N_('Bermuda'),
|
||||
u'BN': N_('Brunei Darussalam'),
|
||||
u'BO': N_('Bolivia'),
|
||||
u'BH': N_('Bahrain'),
|
||||
u'BI': N_('Burundi'),
|
||||
u'BJ': N_('Benin'),
|
||||
u'BT': N_('Bhutan'),
|
||||
u'JM': N_('Jamaica'),
|
||||
u'BV': N_('Bouvet Island'),
|
||||
u'BW': N_('Botswana'),
|
||||
u'WS': N_('Samoa'),
|
||||
u'BR': N_('Brazil'),
|
||||
u'BS': N_('Bahamas'),
|
||||
u'BY': N_('Belarus'),
|
||||
u'BZ': N_('Belize'),
|
||||
u'RU': N_('Russian Federation'),
|
||||
u'RW': N_('Rwanda'),
|
||||
u'RE': N_('Reunion'),
|
||||
u'TM': N_('Turkmenistan'),
|
||||
u'TJ': N_('Tajikistan'),
|
||||
u'RO': N_('Romania'),
|
||||
u'TK': N_('Tokela'),
|
||||
u'GW': N_('Guinea-Bissa'),
|
||||
u'GU': N_('Guam'),
|
||||
u'GT': N_('Guatemala'),
|
||||
u'GR': N_('Greece'),
|
||||
u'GQ': N_('Equatorial Guinea'),
|
||||
u'GP': N_('Guadeloupe'),
|
||||
u'JP': N_('Japan'),
|
||||
u'GY': N_('Guyana'),
|
||||
u'GF': N_('French Guiana'),
|
||||
u'GE': N_('Georgia'),
|
||||
u'GD': N_('Grenada'),
|
||||
u'GB': N_('United Kingdom'),
|
||||
u'GA': N_('Gabon'),
|
||||
u'SV': N_('El Salvador'),
|
||||
u'GN': N_('Guinea'),
|
||||
u'GM': N_('Gambia'),
|
||||
u'GL': N_('Greenland'),
|
||||
u'GI': N_('Gibraltar'),
|
||||
u'GH': N_('Ghana'),
|
||||
u'OM': N_('Oman'),
|
||||
u'TN': N_('Tunisia'),
|
||||
u'JO': N_('Jordan'),
|
||||
u'HT': N_('Haiti'),
|
||||
u'HU': N_('Hungary'),
|
||||
u'HK': N_('Hong Kong'),
|
||||
u'HN': N_('Honduras'),
|
||||
u'HM': N_('Heard and Mc Donald Islands'),
|
||||
u'VE': N_('Venezuela'),
|
||||
u'PR': N_('Puerto Rico'),
|
||||
u'PW': N_('Pala'),
|
||||
u'PT': N_('Portugal'),
|
||||
u'SJ': N_('Svalbard and Jan Mayen Islands'),
|
||||
u'PY': N_('Paraguay'),
|
||||
u'IQ': N_('Iraq'),
|
||||
u'PA': N_('Panama'),
|
||||
u'PF': N_('French Polynesia'),
|
||||
u'PG': N_('Papua New Guinea'),
|
||||
u'PE': N_('Per'),
|
||||
u'PK': N_('Pakistan'),
|
||||
u'PH': N_('Philippines'),
|
||||
u'PN': N_('Pitcairn'),
|
||||
u'PL': N_('Poland'),
|
||||
u'PM': N_('St. Pierre and Miquelon'),
|
||||
u'ZM': N_('Zambia'),
|
||||
u'EH': N_('Western Sahara'),
|
||||
u'EE': N_('Estonia'),
|
||||
u'EG': N_('Egypt'),
|
||||
u'ZA': N_('South Africa'),
|
||||
u'EC': N_('Ecuador'),
|
||||
u'IT': N_('Italy'),
|
||||
u'VN': N_('Viet Nam'),
|
||||
u'SB': N_('Solomon Islands'),
|
||||
u'ET': N_('Ethiopia'),
|
||||
u'SO': N_('Somalia'),
|
||||
u'ZW': N_('Zimbabwe'),
|
||||
u'SA': N_('Saudi Arabia'),
|
||||
u'ES': N_('Spain'),
|
||||
u'ER': N_('Eritrea'),
|
||||
u'MD': N_('Moldova, Republic of'),
|
||||
u'MG': N_('Madagascar'),
|
||||
u'MA': N_('Morocco'),
|
||||
u'MC': N_('Monaco'),
|
||||
u'UZ': N_('Uzbekistan'),
|
||||
u'MM': N_('Myanmar'),
|
||||
u'ML': N_('Mali'),
|
||||
u'MO': N_('Maca'),
|
||||
u'MN': N_('Mongolia'),
|
||||
u'MH': N_('Marshall Islands'),
|
||||
u'MK': N_('Macedonia, The Former Yugoslav Republic of'),
|
||||
u'MU': N_('Mauritius'),
|
||||
u'MT': N_('Malta'),
|
||||
u'MW': N_('Malawi'),
|
||||
u'MV': N_('Maldives'),
|
||||
u'MQ': N_('Martinique'),
|
||||
u'MP': N_('Northern Mariana Islands'),
|
||||
u'MS': N_('Montserrat'),
|
||||
u'MR': N_('Mauritania'),
|
||||
u'UG': N_('Uganda'),
|
||||
u'MY': N_('Malaysia'),
|
||||
u'MX': N_('Mexico'),
|
||||
u'IL': N_('Israel'),
|
||||
u'FR': N_('France'),
|
||||
u'IO': N_('British Indian Ocean Territory'),
|
||||
u'SH': N_('St. Helena'),
|
||||
u'FI': N_('Finland'),
|
||||
u'FJ': N_('Fiji'),
|
||||
u'FK': N_('Falkland Islands (Malvinas)'),
|
||||
u'FM': N_('Micronesia, Federated States of'),
|
||||
u'FO': N_('Faroe Islands'),
|
||||
u'NI': N_('Nicaragua'),
|
||||
u'NL': N_('Netherlands'),
|
||||
u'NO': N_('Norway'),
|
||||
u'NA': N_('Namibia'),
|
||||
u'VU': N_('Vanuat'),
|
||||
u'NC': N_('New Caledonia'),
|
||||
u'NE': N_('Niger'),
|
||||
u'NF': N_('Norfolk Island'),
|
||||
u'NG': N_('Nigeria'),
|
||||
u'NZ': N_('New Zealand'),
|
||||
u'ZR': N_('Zaire'),
|
||||
u'NP': N_('Nepal'),
|
||||
u'NR': N_('Naur'),
|
||||
u'NU': N_('Niue'),
|
||||
u'CK': N_('Cook Islands'),
|
||||
u'CI': N_('Cote d\'Ivoire'),
|
||||
u'CH': N_('Switzerland'),
|
||||
u'CO': N_('Colombia'),
|
||||
u'CN': N_('China'),
|
||||
u'CM': N_('Cameroon'),
|
||||
u'CL': N_('Chile'),
|
||||
u'CC': N_('Cocos (Keeling) Islands'),
|
||||
u'CA': N_('Canada'),
|
||||
u'CG': N_('Congo'),
|
||||
u'CF': N_('Central African Republic'),
|
||||
u'CZ': N_('Czech Republic'),
|
||||
u'CY': N_('Cyprus'),
|
||||
u'CX': N_('Christmas Island'),
|
||||
u'CR': N_('Costa Rica'),
|
||||
u'CV': N_('Cape Verde'),
|
||||
u'CU': N_('Cuba'),
|
||||
u'SZ': N_('Swaziland'),
|
||||
u'SY': N_('Syrian Arab Republic'),
|
||||
u'KG': N_('Kyrgyzstan'),
|
||||
u'KE': N_('Kenya'),
|
||||
u'SR': N_('Suriname'),
|
||||
u'KI': N_('Kiribati'),
|
||||
u'KH': N_('Cambodia'),
|
||||
u'KN': N_('Saint Kitts and Nevis'),
|
||||
u'KM': N_('Comoros'),
|
||||
u'ST': N_('Sao Tome and Principe'),
|
||||
u'SI': N_('Slovenia'),
|
||||
u'KW': N_('Kuwait'),
|
||||
u'SN': N_('Senegal'),
|
||||
u'SM': N_('San Marino'),
|
||||
u'SL': N_('Sierra Leone'),
|
||||
u'SC': N_('Seychelles'),
|
||||
u'KZ': N_('Kazakhstan'),
|
||||
u'KY': N_('Cayman Islands'),
|
||||
u'SG': N_('Singapore'),
|
||||
u'SE': N_('Sweden'),
|
||||
u'SD': N_('Sudan'),
|
||||
u'DO': N_('Dominican Republic'),
|
||||
u'DM': N_('Dominica'),
|
||||
u'DJ': N_('Djibouti'),
|
||||
u'DK': N_('Denmark'),
|
||||
u'VG': N_('Virgin Islands (British)'),
|
||||
u'DE': N_('Germany'),
|
||||
u'YE': N_('Yemen'),
|
||||
u'DZ': N_('Algeria'),
|
||||
u'US': N_('United States'),
|
||||
u'UY': N_('Uruguay'),
|
||||
u'YT': N_('Mayotte'),
|
||||
u'UM': N_('United States Minor Outlying Islands'),
|
||||
u'LB': N_('Lebanon'),
|
||||
u'LC': N_('Saint Lucia'),
|
||||
u'LA': N_('Lao People\'s Democratic Republic'),
|
||||
u'TV': N_('Tuval'),
|
||||
u'TW': N_('Taiwan'),
|
||||
u'TT': N_('Trinidad and Tobago'),
|
||||
u'TR': N_('Turkey'),
|
||||
u'LK': N_('Sri Lanka'),
|
||||
u'LI': N_('Liechtenstein'),
|
||||
u'LV': N_('Latvia'),
|
||||
u'TO': N_('Tonga'),
|
||||
u'LT': N_('Lithuania'),
|
||||
u'LU': N_('Luxembourg'),
|
||||
u'LR': N_('Liberia'),
|
||||
u'LS': N_('Lesotho'),
|
||||
u'TH': N_('Thailand'),
|
||||
u'TF': N_('French Southern Territories'),
|
||||
u'TG': N_('Togo'),
|
||||
u'TD': N_('Chad'),
|
||||
u'TC': N_('Turks and Caicos Islands'),
|
||||
u'LY': N_('Libyan Arab Jamahiriya'),
|
||||
u'VA': N_('Vatican City State (Holy See)'),
|
||||
u'VC': N_('Saint Vincent and The Grenadines'),
|
||||
u'AE': N_('United Arab Emirates'),
|
||||
u'AD': N_('Andorra'),
|
||||
u'AG': N_('Antigua and Barbuda'),
|
||||
u'AF': N_('Afghanistan'),
|
||||
u'AI': N_('Anguilla'),
|
||||
u'VI': N_('Virgin Islands (U.S.)'),
|
||||
u'IS': N_('Iceland'),
|
||||
u'IR': N_('Iran (Islamic Republic of)'),
|
||||
u'AM': N_('Armenia'),
|
||||
u'AL': N_('Albania'),
|
||||
u'AO': N_('Angola'),
|
||||
u'AN': N_('Netherlands Antilles'),
|
||||
u'AQ': N_('Antarctica'),
|
||||
u'AS': N_('American Samoa'),
|
||||
u'AR': N_('Argentina'),
|
||||
u'AU': N_('Australia'),
|
||||
u'AT': N_('Austria'),
|
||||
u'AW': N_('Aruba'),
|
||||
u'IN': N_('India'),
|
||||
u'TZ': N_('Tanzania, United Republic of'),
|
||||
u'AZ': N_('Azerbaijan'),
|
||||
u'IE': N_('Ireland'),
|
||||
u'ID': N_('Indonesia'),
|
||||
u'UA': N_('Ukraine'),
|
||||
u'QA': N_('Qatar'),
|
||||
u'MZ': N_('Mozambique'),
|
||||
u'BA': N_('Bosnia and Herzegovina'),
|
||||
u'CD': N_('Congo, The Democratic Republic of the'),
|
||||
u'CS': N_('Serbia and Montenegro'),
|
||||
u'HR': N_('Croatia'),
|
||||
u'KP': N_('Korea (North), Democratic People\'s Republic of'),
|
||||
u'KR': N_('Korea (South), Republic of'),
|
||||
u'SK': N_('Slovakia'),
|
||||
u'SU': N_('Soviet Union (historical, 1922-1991)'),
|
||||
u'TL': N_('East Timor'),
|
||||
u'XC': N_('Czechoslovakia (historical, 1918-1992)'),
|
||||
u'XE': N_('Europe'),
|
||||
u'XG': N_('East Germany (historical, 1949-1990)'),
|
||||
u'XU': N_('[Unknown Country]'),
|
||||
u'XW': N_('[Worldwide]'),
|
||||
u'YU': N_('Yugoslavia (historical, 1918-1992)'),
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ from PyQt4 import QtCore, QtGui
|
||||
from picard.config import BoolOption, TextOption
|
||||
from picard.ui.options import OptionsPage, OptionsCheckError, register_options_page
|
||||
from picard.ui.ui_options_metadata import Ui_MetadataOptionsPage
|
||||
from picard.const import RELEASE_COUNTRIES
|
||||
import operator
|
||||
|
||||
|
||||
class MetadataOptionsPage(OptionsPage):
|
||||
@@ -38,6 +40,7 @@ class MetadataOptionsPage(OptionsPage):
|
||||
BoolOption("setting", "release_ars", True),
|
||||
BoolOption("setting", "track_ars", False),
|
||||
BoolOption("setting", "folksonomy_tags", False),
|
||||
TextOption("setting", "preferred_release_country", u""),
|
||||
]
|
||||
|
||||
def __init__(self, parent=None):
|
||||
@@ -46,12 +49,17 @@ class MetadataOptionsPage(OptionsPage):
|
||||
self.ui.setupUi(self)
|
||||
self.connect(self.ui.va_name_default, QtCore.SIGNAL("clicked()"), self.set_va_name_default)
|
||||
self.connect(self.ui.nat_name_default, QtCore.SIGNAL("clicked()"), self.set_nat_name_default)
|
||||
self.ui.preferred_release_country.addItem(N_("None"), QtCore.QVariant(""))
|
||||
for country, name in sorted(RELEASE_COUNTRIES.items(), key=operator.itemgetter(1)):
|
||||
self.ui.preferred_release_country.addItem(name, QtCore.QVariant(country))
|
||||
|
||||
def load(self):
|
||||
self.ui.translate_artist_names.setChecked(self.config.setting["translate_artist_names"])
|
||||
self.ui.release_ars.setChecked(self.config.setting["release_ars"])
|
||||
self.ui.track_ars.setChecked(self.config.setting["track_ars"])
|
||||
self.ui.folksonomy_tags.setChecked(self.config.setting["folksonomy_tags"])
|
||||
current_release_country = QtCore.QVariant(self.config.setting["preferred_release_country"])
|
||||
self.ui.preferred_release_country.setCurrentIndex(self.ui.preferred_release_country.findData(current_release_country))
|
||||
self.ui.va_name.setText(self.config.setting["va_name"])
|
||||
self.ui.nat_name.setText(self.config.setting["nat_name"])
|
||||
|
||||
@@ -60,6 +68,7 @@ class MetadataOptionsPage(OptionsPage):
|
||||
self.config.setting["release_ars"] = self.ui.release_ars.isChecked()
|
||||
self.config.setting["track_ars"] = self.ui.track_ars.isChecked()
|
||||
self.config.setting["folksonomy_tags"] = self.ui.folksonomy_tags.isChecked()
|
||||
self.config.setting["preferred_release_country"] = self.ui.preferred_release_country.itemData(self.ui.preferred_release_country.currentIndex()).toString()
|
||||
self.config.setting["va_name"] = self.ui.va_name.text()
|
||||
self.config.setting["nat_name"] = self.ui.nat_name.text()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/options_metadata.ui'
|
||||
#
|
||||
# Created: Sat Feb 16 19:53:00 2008
|
||||
# Created: Tue Apr 1 21:09:17 2008
|
||||
# by: PyQt4 UI code generator 4.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@@ -12,7 +12,7 @@ from PyQt4 import QtCore, QtGui
|
||||
class Ui_MetadataOptionsPage(object):
|
||||
def setupUi(self, MetadataOptionsPage):
|
||||
MetadataOptionsPage.setObjectName("MetadataOptionsPage")
|
||||
MetadataOptionsPage.resize(QtCore.QSize(QtCore.QRect(0,0,387,302).size()).expandedTo(MetadataOptionsPage.minimumSizeHint()))
|
||||
MetadataOptionsPage.resize(QtCore.QSize(QtCore.QRect(0,0,415,355).size()).expandedTo(MetadataOptionsPage.minimumSizeHint()))
|
||||
|
||||
self.vboxlayout = QtGui.QVBoxLayout(MetadataOptionsPage)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
@@ -38,6 +38,14 @@ class Ui_MetadataOptionsPage(object):
|
||||
self.folksonomy_tags = QtGui.QCheckBox(self.rename_files)
|
||||
self.folksonomy_tags.setObjectName("folksonomy_tags")
|
||||
self.gridlayout.addWidget(self.folksonomy_tags,3,0,1,1)
|
||||
|
||||
self.preferred_release_country = QtGui.QComboBox(self.rename_files)
|
||||
self.preferred_release_country.setObjectName("preferred_release_country")
|
||||
self.gridlayout.addWidget(self.preferred_release_country,5,0,1,1)
|
||||
|
||||
self.label = QtGui.QLabel(self.rename_files)
|
||||
self.label.setObjectName("label")
|
||||
self.gridlayout.addWidget(self.label,4,0,1,1)
|
||||
self.vboxlayout.addWidget(self.rename_files)
|
||||
|
||||
self.rename_files_2 = QtGui.QGroupBox(MetadataOptionsPage)
|
||||
@@ -91,6 +99,7 @@ class Ui_MetadataOptionsPage(object):
|
||||
self.release_ars.setText(_("Use release relationships"))
|
||||
self.track_ars.setText(_("Use track relationships"))
|
||||
self.folksonomy_tags.setText(_("Use folksonomy tags as genre"))
|
||||
self.label.setText(_("Preferred release country:"))
|
||||
self.rename_files_2.setTitle(_("Custom Fields"))
|
||||
self.label_3.setText(_("Various artists:"))
|
||||
self.label_4.setText(_("Non-album tracks:"))
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>387</width>
|
||||
<height>302</height>
|
||||
<width>415</width>
|
||||
<height>355</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
@@ -44,6 +44,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QComboBox" name="preferred_release_country" />
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Preferred release country:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user