コード例 #1
0
def main(path, fake_release_mbid):
    releases = {}
    #Get all the mbid of the recordings
    onlyfiles = [
        f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))
    ]
    for i in onlyfiles:
        head, tail = os.path.split(i)
        filename, file_extension = os.path.splitext(i)
        if file_extension == '.mp3':
            c = eyed3.load(os.path.join(path, i))
            mbid = c.tag.unique_file_ids.get(
                "http://musicbrainz.org").render()[33:]
            try:
                rel = mb.get_recording_by_id(mbid, includes=["releases"])
                release = None
                if len(rel['recording']['release-list']):
                    #create release
                    release = rel['recording']['release-list'][0]['id']
                else:
                    release = fake_release_mbid
                    #use *fake* release
                if release not in releases:
                    releases[release] = []
                releases[release].append(mbid)
            except:
                print "couldn't find a release for the recording %s" % mbid
                continue
    coll = Collection.objects.get(mbid="544f7aec-dba6-440c-943f-103cf344efbb")
    r = makam_importer.MakamReleaseImporter(coll)
    for i in releases.keys():
        r.import_release(i, "")
        for j in releases[i]:
            r.add_and_get_recording(j)
コード例 #2
0
ファイル: jobs.py プロジェクト: dbogdanov/dunya
def get_release_importer(collection):
    name = collection.name.lower()
    name = name.lower()
    data_coll = data.models.Collection.objects.get(collectionid=collection.id)
    ri = None
    if "hindustani" in name:
        ri = hindustani_importer.HindustaniReleaseImporter(data_coll)
    elif "carnatic" in name:
        ri = carnatic_importer.CarnaticReleaseImporter(data_coll)
    elif "makam" in name:
        ri = makam_importer.MakamReleaseImporter(data_coll)
    elif "andalusian" in name:
        ri = andalusian_importer.AndalusianReleaseImporter(data_coll)
    return ri
コード例 #3
0
 def setUp(self):
     self.mi = makam_importer.MakamReleaseImporter(None)