def importData(verbose): print(f'importData {verbose}') importer = MusicBrainzImporter() _ = MusicDatabase() _ = MusicBrainzDatabase() print('Load data to import') time1 = datetime.now() importer.load_data_to_import() time2 = datetime.now() print(str(time2 - time1)) importer.import_everything() time2 = datetime.now() print(str(time2 - time1))
order by path''' result = c.execute(sql, {'uuid_list': tuple(uuids)}) return [x for (x,) in result.fetchall()] db = MusicDatabase() mbdb = MusicBrainzDatabase() #artists = mbdb.get_all_artists() #recordings = mbdb.get_all_recordings() #releasegroups = mbdb.get_all_releasegroups() #releases = mbdb.get_all_releases() #tracks = mbdb.get_all_tracks() #works = mbdb.get_all_works() # MusicBrainzImporter.retrieve_mbdump_file('mbdump.tar.bz2') importer = MusicBrainzImporter() # importer.retrieve_musicbrainz_dumps() importer.load_data_to_import(artist_credits=False, mediums=False, linked_entities=False) release_group = importer.get_mbdump_tableiter('release_group') print('Preloading recordings...') release_group_ids = {x['gid']: x['id'] for x in release_group.getlines() if x['id'] in importer.ids['release_group']} r_g_to_import_uuids = release_group_ids.keys()
def updateMusicBrainzDBDump(verbose): print(f'updateMusicBrainzDBDump {verbose}') importer = MusicBrainzImporter() importer.retrieve_musicbrainz_dumps()
import re medium_pattern = re.compile(r'(CD|LP)[0-9]+($| - )') def albumdirectory(path): dirname = os.path.dirname(path) (dirname2, basename) = os.path.split(dirname) return dirname2 if medium_pattern.match(basename) else dirname db = MusicDatabase() mbdb = MusicBrainzDatabase() importer = MusicBrainzImporter() importer.load_data_to_import(artist_credits=False, mediums=False, linked_entities=False) missing_files = [] missing_files2 = [] missing_files = importer.get_files_to_check_manually_for_missing_uuids() missing_files2 = importer.get_files_to_check_manually_for_missing_ids() files_with_missing_works = \ importer.get_files_to_check_manually_for_missing_works() print('--------------------') use_directories = True if use_directories: print('Directories to check manually:') dirs = set(albumdirectory(path) for path, _, _ in missing_files)