import os import logging import pickle from collections import defaultdict from lib.beets import autotag from lib.beets import library from lib.beets import plugins from lib.beets import util from lib.beets.util import pipeline from lib.beets.util import syspath, normpath, displayable_path from lib.beets.util.enumeration import enum action = enum( 'SKIP', 'ASIS', 'TRACKS', 'MANUAL', 'APPLY', 'MANUAL_ID', name='action' ) QUEUE_SIZE = 128 STATE_FILE = os.path.expanduser('~/.beetsstate') SINGLE_ARTIST_THRESH = 0.25 VARIOUS_ARTISTS = u'Various Artists' # Global logger. log = logging.getLogger('beets') class ImportAbort(Exception): """Raised when the user aborts the tagging operation. """ pass
val = re.match(r'[\+-]?[0-9\.]*', val.strip()).group(0) if not val: return 0.0 else: return float(val) else: return val # Flags for encoding field behavior. # Determine style of packing, if any. packing = enum( 'SLASHED', # pair delimited by / 'TUPLE', # a python tuple of 2 items 'DATE', # YYYY-MM-DD name='packing') class StorageStyle(object): """Parameterizes the storage behavior of a single field for a certain tag format. - key: The Mutagen key used to access the field's data. - list_elem: Store item as a single object or as first element of a list. - as_type: Which type the value is stored as (unicode, int, bool, or str). - packing: If this value is packed in a multiple-value storage unit, which type of packing (in the packing enum). Otherwise, None. (Makes as_type irrelevant).
""" from __future__ import with_statement # Python 2.5 import os import logging import pickle from collections import defaultdict from lib.beets import autotag from lib.beets import library import lib.beets.autotag.art from lib.beets import plugins from lib.beets.util import pipeline from lib.beets.util import syspath, normpath, plurality from lib.beets.util.enumeration import enum action = enum("SKIP", "ASIS", "TRACKS", "MANUAL", "APPLY", "MANUAL_ID", name="action") QUEUE_SIZE = 128 STATE_FILE = os.path.expanduser("~/.beetsstate") SINGLE_ARTIST_THRESH = 0.25 VARIOUS_ARTISTS = u"Various Artists" # Global logger. log = logging.getLogger("beets") class ImportAbort(Exception): """Raised when the user aborts the tagging operation. """ pass
val = unicode(val) val = re.match(r'[\+-]?[0-9\.]*', val.strip()).group(0) if not val: return 0.0 else: return float(val) else: return val # Flags for encoding field behavior. # Determine style of packing, if any. packing = enum('SLASHED', # pair delimited by / 'TUPLE', # a python tuple of 2 items 'DATE', # YYYY-MM-DD name='packing') class StorageStyle(object): """Parameterizes the storage behavior of a single field for a certain tag format. - key: The Mutagen key used to access the field's data. - list_elem: Store item as a single object or as first element of a list. - as_type: Which type the value is stored as (unicode, int, bool, or str). - packing: If this value is packed in a multiple-value storage unit, which type of packing (in the packing enum). Otherwise, None. (Makes as_type irrelevant). - pack_pos: If the value is packed, in which position it is stored.
elif out_type == unicode: if val is None: return u"" else: return unicode(val) else: return val # Flags for encoding field behavior. # Determine style of packing, if any. packing = enum( "SLASHED", "TUPLE", "DATE", name="packing" # pair delimited by / # a python tuple of 2 items # YYYY-MM-DD ) class StorageStyle(object): """Parameterizes the storage behavior of a single field for a certain tag format. - key: The Mutagen key used to access the field's data. - list_elem: Store item as a single object or as first element of a list. - as_type: Which type the value is stored as (unicode, int, bool, or str). - packing: If this value is packed in a multiple-value storage unit, which type of packing (in the packing enum). Otherwise, None. (Makes as_type irrelevant). - pack_pos: If the value is packed, in which position it is