# Path: chirp/common/printing.py
# class CustomPrint(object):
#     def __init__(self):
#     def __call__(self, message=None, **kwargs):
#     def default_write(self, message=None, **kwargs):
#     def use_write_function(self, func):
# 
# Path: chirp/library/artists.py
# _LIBRARY_DATA_PREFIX = os.path.join(ROOT_DIR, "library", "data")
# _WHITELIST_FILE = os.path.join(_LIBRARY_DATA_PREFIX, "artist-whitelist")
# _MAPPINGS_FILE = os.path.join(_LIBRARY_DATA_PREFIX, "artist-mappings")
# _MAPPINGS_SEP = u"\xbb\xbb\xbb"
# _BASE_SPLIT_PATTERN = (
#     r"\s*((feat\.?)|(ft\.)|(featuring)|(with)|(w/)|(and)|(&))"
#     r"\s+(?P<feat>.*)")
# _SPLIT_RES = [
#     re.compile(r"%s%s%s" % (a, _BASE_SPLIT_PATTERN, b), re.IGNORECASE)
#     for a, b in ((r"\(", r"\)"), (r"\[", r"\]"), ("", ""))]
#     MAX_DIST = 10
#     MAX_NORM_DIST = 0.25
# def all():
# def sort_key(artist_name):
# def _standardize_simple(artist_name, whitelist, mappings):
# def _standardize(artist_name, whitelist, mappings):
# def standardize(artist_name):
# def is_standardized(artist_name):
# def split(artist_name):
# def split_and_standardize(artist_name):
# def suggest(name):
# def _seq_to_whitelist(seq_of_names):
# def reset_artist_whitelist(seq_of_names):
# def _read_artist_whitelist_from_file(file_obj):
# def _read_artist_mappings_from_file(file_obj):
# def _init():
# def merge_whitelist_and_mappings(whitelist, raw_mappings):
# 
# Path: chirp/library/dropbox.py
# class Dropbox(object):
#     def __init__(self, dropbox_path=None):
#     def files(self):
#     def scan_fast(self):
#     def albums(self):
#     def tracks(self):


import codecs
import sys
from chirp.common.printing import cprint
from chirp.library import artists
from chirp.library import dropbox
#!/usr/bin/env python



def main_generator(rewrite):
    drop = dropbox.Dropbox()
    new_artists = set()
    for au_file in drop.tracks():
        try:
            tpe1 = au_file.mutagen_id3["TPE1"].text[0]
        except:
            cprint(u'** file: %r' % au_file.path)
            raise
        if artists.standardize(tpe1) is None:
            new_artists.add(tpe1)

    to_print = list(new_artists)
    if rewrite:

# Path: chirp/common/printing.py
# class CustomPrint(object):
#     def __init__(self):
#     def __call__(self, message=None, **kwargs):
#     def default_write(self, message=None, **kwargs):
#     def use_write_function(self, func):
# 
# Path: chirp/library/artists.py
# _LIBRARY_DATA_PREFIX = os.path.join(ROOT_DIR, "library", "data")
# _WHITELIST_FILE = os.path.join(_LIBRARY_DATA_PREFIX, "artist-whitelist")
# _MAPPINGS_FILE = os.path.join(_LIBRARY_DATA_PREFIX, "artist-mappings")
# _MAPPINGS_SEP = u"\xbb\xbb\xbb"
# _BASE_SPLIT_PATTERN = (
#     r"\s*((feat\.?)|(ft\.)|(featuring)|(with)|(w/)|(and)|(&))"
#     r"\s+(?P<feat>.*)")
# _SPLIT_RES = [
#     re.compile(r"%s%s%s" % (a, _BASE_SPLIT_PATTERN, b), re.IGNORECASE)
#     for a, b in ((r"\(", r"\)"), (r"\[", r"\]"), ("", ""))]
#     MAX_DIST = 10
#     MAX_NORM_DIST = 0.25
# def all():
# def sort_key(artist_name):
# def _standardize_simple(artist_name, whitelist, mappings):
# def _standardize(artist_name, whitelist, mappings):
# def standardize(artist_name):
# def is_standardized(artist_name):
# def split(artist_name):
# def split_and_standardize(artist_name):
# def suggest(name):
# def _seq_to_whitelist(seq_of_names):
# def reset_artist_whitelist(seq_of_names):
# def _read_artist_whitelist_from_file(file_obj):
# def _read_artist_mappings_from_file(file_obj):
# def _init():
# def merge_whitelist_and_mappings(whitelist, raw_mappings):
# 
# Path: chirp/library/dropbox.py
# class Dropbox(object):
#     def __init__(self, dropbox_path=None):
#     def files(self):
#     def scan_fast(self):
#     def albums(self):
#     def tracks(self):


# Path: chirp/library/do_dump_new_artists_in_dropbox.py
import codecs
import sys
from chirp.common.printing import cprint
from chirp.library import artists
from chirp.library import dropbox

#!/usr/bin/env python



def main_generator(rewrite):
    drop = dropbox.Dropbox()
    new_artists = set()
    for au_file in drop.tracks():
        try:
            tpe1 = au_file.mutagen_id3["TPE1"].text[0]
        except:
            cprint(u'** file: %r' % au_file.path)
            raise
        if artists.standardize(tpe1) is None:
            new_artists.add(tpe1)

    to_print = list(new_artists)
    if rewrite:

        to_print.extend(artists.all())