Пример #1
0
	def metadata(self, filename) :
		debug("Considering "+filename)
		mi = MusicInfo()
		try :
			lookup = MbzTrackLookup(filename)
			mbzuri = lookup.getMbzTrackURI()
			mbzconvert = MbzURIConverter(mbzuri)
			af = AudioFile(urlencode(os.path.basename(filename)))
			mbz = Track(mbzconvert.getURI())
			mbz.available_as = af
			mi.add(af); mi.add(mbz)
			self.succeeded+=1
		except MbzLookupException, e:
			error(" - " + e.message)
Пример #2
0
	def metadata(self, filename) :
		debug("Considering "+filename)
		mi = MusicInfo()
		try :
			lookup = MbzTrackLookup(filename)
			mbzuri = lookup.getMbzTrackURI()
			mbzconvert = MbzURIConverter(mbzuri)
			af = AudioFile(urlencode(os.path.basename(filename)))  # there is some bug with my os.path.basename settings?
			zitgisturi=mbzconvert.getURI()
			mbid=mbzconvert.getId()
			mbz = Track(zitgisturi)
			mbz.available_as = af    #to link the musicbrainz ID with the local album collection
			mi.add(af); mi.add(mbz)
			self.succeeded+=1
		except MbzLookupException, e:
			error(" - " + e.message)
Пример #3
0
 def open(self, filename):
     if not os.path.exists(filename):
         try:
             self.f = open(filename, "w")
             self.filename = filename
             self.mi = MusicInfo()
             return True
         except Exception, e:
             error("Couldn't open file for writing : " + filename +
                   "\nException info : " + str(e))
Пример #4
0
	def metadata(self, filename, true_md=None, just_URI=False) :
		debug("Considering "+filename)
		mi = MusicInfo()
		try :
			lookup = MbzTrackLookup(filename,true_md)
			mbzuri = lookup.getMbzTrackURI()
			mbzconvert = MbzURIConverter(mbzuri)
			if just_URI:
				return mbzconvert.getURI()
			if (filename.startswith("http://")):
				af = AudioFile(filename)
			else:
				af = AudioFile(urlencode(os.path.basename(filename)))
			mbz = Track(mbzconvert.getURI())
			mbz.available_as = af
			mi.add(af); mi.add(mbz)
			self.succeeded+=1
		except MbzLookupException, e:
			error(" - " + e.message)
Пример #5
0
 def metadata(self, filename):
     debug("Considering " + filename)
     mi = MusicInfo()
     try:
         lookup = MbzTrackLookup(filename)
         mbzuri = lookup.getMbzTrackURI()
         mbzconvert = MbzURIConverter(mbzuri)
         af = AudioFile(urlencode(os.path.basename(filename)))
         mbz = Track(mbzconvert.getURI())
         mbz.available_as = af
         mi.add(af)
         mi.add(mbz)
         self.succeeded += 1
     except MbzLookupException, e:
         error(" - " + e.message)
Пример #6
0
 def metadata(self, filename):
     debug("Considering " + filename)
     mi = MusicInfo()
     try:
         lookup = MbzTrackLookup(filename)
         mbzuri = lookup.getMbzTrackURI()
         mbzconvert = MbzURIConverter(mbzuri)
         af = AudioFile(
             urlencode(os.path.basename(filename))
         )  # there is some bug with my os.path.basename settings?
         zitgisturi = mbzconvert.getURI()
         mbid = mbzconvert.getId()
         mbz = Track(zitgisturi)
         mbz.available_as = af  #to link the musicbrainz ID with the local album collection
         mi.add(af)
         mi.add(mbz)
         self.succeeded += 1
     except MbzLookupException, e:
         error(" - " + e.message)
Пример #7
0
                        +" to "+str(s)+" type "+str(type(objs[s]))\
                        +" for property "+str(s_propdict[str(p)])+"...\n" + str(e) +"\nIgnoring...\n")
                        continue

            else:
                if strict:
                    raise ImportException("NO PROPERTY TO MODEL " + str(p) +
                                          " in class " + str(type(objs[s])) +
                                          "\nKnown properties : " +
                                          str(s_propURIs))
                else:
                    error("NO PROPERTY TO MODEL " + str(p) + " in class " +
                          str(type(objs[s])))
                    continue

    mi = MusicInfo(objs.values())
    # Add any namespaces mentioned in the file which we didn't already know :
    mi.namespaceBindings.update(
        dict([(NSName, str(NSURI)) for NSName, NSURI in g.namespaces()]))
    return mi


# Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
# [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# >>> from RDFInterface import *
# >>> mi = importRDFFile("L1 tiny.n3","n3")
# >>> mi.SoloMusicArtistIdx.values()[0].name
# PropertySet(['Dave Mustaine'])
# >>> mi.SoloMusicArtistIdx.values()[0].name = "Davy Crockett"
# >>> mi.SoloMusicArtistIdx.values()[0].name