示例#1
0
文件: utils.py 项目: zer03nvy/picard
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from picard.const import MB_ATTRIBUTES
from picard.i18n import gettext_attr

# list of types from http://musicbrainz.org/doc/Cover_Art/Types
# order of declaration is preserved in selection box
CAA_TYPES = []
for k, v in sorted(MB_ATTRIBUTES.items(), key=lambda k_v: k_v[0]):
    if k.startswith('DB:cover_art_archive.art_type/name:'):
        CAA_TYPES.append({'name': v.lower(), 'title': v})

# pseudo type, used for the no type case
CAA_TYPES.append({'name': "unknown", 'title': N_("Unknown")})

CAA_TYPES_TR = {}
for t in CAA_TYPES:
    CAA_TYPES_TR[t['name']] = t['title']


def translate_caa_type(name):
    if name == 'unknown':
        return _(CAA_TYPES_TR[name])
    else:
示例#2
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from picard.const import MB_ATTRIBUTES
from picard.i18n import gettext_attr


# list of types from http://musicbrainz.org/doc/Cover_Art/Types
# order of declaration is preserved in selection box
CAA_TYPES = []
for k, v in sorted(MB_ATTRIBUTES.items(), key=lambda k_v: k_v[0]):
    if k.startswith('DB:cover_art_archive.art_type/name:'):
        CAA_TYPES.append({'name': v.lower(), 'title': v})

# pseudo type, used for the no type case
CAA_TYPES.append({'name': "unknown", 'title': N_("Unknown")})

CAA_TYPES_TR = {}
for t in CAA_TYPES:
    CAA_TYPES_TR[t['name']] = t['title']


def translate_caa_type(name):
    if name == 'unknown':
        return _(CAA_TYPES_TR[name])
    else:
示例#3
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from picard.const import MB_ATTRIBUTES
from picard.i18n import ugettext_attr

# list of types from http://musicbrainz.org/doc/Cover_Art/Types
# order of declaration is preserved in selection box
CAA_TYPES = []
for k, v in sorted(MB_ATTRIBUTES.items(), key=lambda (k, v): k):
    if k.startswith(u'DB:cover_art_archive.art_type/name:'):
        CAA_TYPES.append({'name': v.lower(), 'title': v})

# pseudo type, used for the no type case
CAA_TYPES.append({'name': "unknown", 'title': N_(u"Unknown")})

CAA_TYPES_TR = {}
for t in CAA_TYPES:
    CAA_TYPES_TR[t['name']] = t['title']


def translate_caa_type(name):
    if name == 'unknown':
        return _(CAA_TYPES_TR[name])
    else: