예제 #1
0
    def getMBFilename(self, track):
        """Attempt to fuzzily match release name from filepath using MusicBrainz.
        
        We look for the release name in the folder and file name."""

        folderFilePath = self.getFilenameForMB(track)
        return mb.askMB(self.fieldName, folderFilePath, track)
예제 #2
0
 def getMBFilename(self, track):
     """Attempt to fuzzily match release name from filepath using MusicBrainz.
     
     We look for the release name in the folder and file name."""
     
     folderFilePath = self.getFilenameForMB(track)
     return mb.askMB(self.fieldName, folderFilePath, track)
예제 #3
0
    def getMBTag(self, track):
        """Fuzzily match current value in tag using MusicBrainz."""

        tag = tagging.getTag(track.filePath, self.fieldName)
        if not tag:
            log("Unable to match because current tag is empty.")
            result = None           
        else:
            result = mb.askMB(self.fieldName, tag, track)
        
        return result
예제 #4
0
    def getMBFilenameKnownData(self, track):
        """Try to match the file name to a title using MB."""

        if not ("release" in track.metadata and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --" " the release and track number.")
            result = None

        else:
            fileName = self.getFilenameForMB(track)
            # Here we're searching for a track.
            result = mb.askMB(self.fieldName, fileName, track, ["release", "tracknumber", "artist"])

        return result
예제 #5
0
    def getMBFilenameKnownData(self, track):
        """Try to match the file name to a title using MB."""

        if not ("release" in track.metadata
                and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --"
                " the release and track number.")
            result = None

        else:
            fileName = self.getFilenameForMB(track)
            # Here we're searching for a track.
            result = mb.askMB(self.fieldName, fileName, track,
                              ["release", "tracknumber", "artist"])

        return result
예제 #6
0
    def getMBNumTracksInDir(self, track):
        """See if the number of tracks in the directory matches with MB."""
        
        if not "release" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the release.")
            result = None
            
        else:
            numTracks = self.getNumTracksInDir(track)
            result = mb.askMB(self.fieldName, numTracks, track, 
                              ["release", "artist", "date", "tracktotal"])
            if result:
                result = result.zfill(2)

        return result
예제 #7
0
    def getMBNumTracksInDir(self, track):
        """See if the number of tracks in the directory matches with MB."""

        if not "release" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the release.")
            result = None

        else:
            numTracks = self.getNumTracksInDir(track)
            result = mb.askMB(self.fieldName, numTracks, track,
                              ["release", "artist", "date", "tracktotal"])
            if result:
                result = result.zfill(2)

        return result
예제 #8
0
    def getMBFilenameKnownData(self, track):
        """Attempt to fuzzily match release name from filepath using MusicBrainz.
       
        We look for the release name in the folder and file name."""

        if not ("artist" in track.metadata or "date" in track.metadata
                or "title" in track.metadata):
            log("The currently known data does not include the fields we need --"
                " the artist or the date or the track titles.")
            result = None

        else:
            folderFilePath = self.getFilenameForMB(track)
            result = mb.askMB(self.fieldName, folderFilePath, track,
                              ["artist", "date", "tracks", "tracktotal"])

        return result
예제 #9
0
    def getMBKnownData(self, track):
        """Query MB using known data.
        
        To find a date we...
            Need: Artist AND (Date OR Titles)
            Can Use: Tracktotal"""

        if not (("artist" in track.metadata) and
                ("date" in track.metadata or "title" in track.metadata)):
            log("The currently known data does not include the fields we need --"
                " the artist and the (date or track titles).")
            result = None

        else:
            result = mb.askMB(self.fieldName, None, track,
                              ["artist", "date", "tracks", "tracktotal"])

        return result
예제 #10
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""

        titleTag = tagging.getTag(track.filePath, "title")

        if not titleTag:
            log("The current tag is empty.")
            result = None

        elif not ("release" in track.metadata and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --" " the release and track number.")
            result = None

        else:
            # Here we're searching for a track.
            result = mb.askMB(self.fieldName, titleTag, track, ["release", "tracknumber", "artist"])

        return result
예제 #11
0
    def getMBKnownData(self, track):
        """Query MB using known data.
        
        To find a tracktotal we...
            Need: A release
            Can Use: A date, an artist"""
        
        if not "release" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the release.")
            result = None
        else:
            result = mb.askMB(self.fieldName, None, track, 
                              ["release", "artist", "date"])
            if result:
                result = result.zfill(2)

        return result
예제 #12
0
 def getMBKnownData(self, track):
     """Query MB using known data.
     
     To find a date we...
         Need: Artist AND (Date OR Titles)
         Can Use: Tracktotal"""
     
     if not (("artist" in track.metadata) and
             ("date" in track.metadata or "title" in track.metadata)):
         log("The currently known data does not include the fields we need --"
             " the artist and the (date or track titles).")
         result = None
         
     else:
         result = mb.askMB(self.fieldName, None, track, 
                           ["artist", "date", "tracks", "tracktotal"])
     
     return result
예제 #13
0
    def getMBKnownData(self, track):
        """Query MB using known data.
        
        To find a tracknumber we...
            Need: A track title
            Can Use: A release, an artist"""

        if not "title" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the track title.")
            result = None
        else:
            result = mb.askMB(self.fieldName, None, track,
                              ["title", "artist", "release"])
            if result:
                result = result.zfill(2)

        return result
예제 #14
0
    def getMBKnownData(self, track):
        """Query MB using known data.
            
        We can find the title from the release and a tracknumber.
        To do this we...
            Need: release, tracknumber
            Can Use: date, artist, tracktotal"""

        if not ("release" in track.metadata and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --" " the release and track number.")
            result = None

        else:
            # We can use these extra fields because we are searching for a
            # release, not a track.
            result = mb.askMB(self.fieldName, None, track, ["release", "tracknumber", "date", "artist", "tracktotal"])

        return result
예제 #15
0
 def getMBKnownData(self, track):
     """Query MB using known data.
     
     To find a date we...
         Need: A release
         Can Use: An artist, a tracktotal
         Might Use: Tracknames"""
     
     if not "release" in track.metadata:
         log("The currently known data does not include the field we need --"
             " the release.")
         result = None
         
     else:
         result = mb.askMB("date", None, track, 
                           ["release", "artist", "tracktotal"])
     
     return result
예제 #16
0
 def getMBFilenameKnownData(self, track):
     """Attempt to fuzzily match release name from filepath using MusicBrainz.
    
     We look for the release name in the folder and file name."""
     
     if not ("artist" in track.metadata or
             "date" in track.metadata or
             "title" in track.metadata):
         log("The currently known data does not include the fields we need --"
             " the artist or the date or the track titles.")
         result = None
         
     else:
         folderFilePath = self.getFilenameForMB(track)
         result = mb.askMB(self.fieldName, folderFilePath, track, 
                           ["artist", "date", "tracks", "tracktotal"])
     
     return result
예제 #17
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""

        artistTag = tagging.getTag(track.filePath, "artist")

        if not artistTag:
            log("The current tag is empty.")
            result = None

        elif not "release" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the release.")
            result = None

        else:
            result = mb.askMB(self.fieldName, artistTag, track,
                              ["release", "date", "tracktotal"])

        return result
예제 #18
0
 def getMBKnownData(self, track):
     """Query MB using known data.
         
     We can find the artist from the release.
     To do this we...
         Need: release
         Can Use: date, tracktotal
         Might Use: tracks"""
     
     if not "release" in track.metadata:
         log("The currently known data does not include the field we need --"
             " the release.")
         result = None
         
     else:
         result = mb.askMB(self.fieldName, None, track, 
                           ["release", "date", "tracktotal", "tracks"])
         
     return result
예제 #19
0
 def getMBTagKnownData(self, track):
     """Query MB using known data and the current tag."""
     
     artistTag = tagging.getTag(track.filePath, "artist")
     
     if not artistTag:
         log("The current tag is empty.")
         result = None
         
     elif not "release" in track.metadata:
         log("The currently known data does not include the field we need --"
             " the release.")
         result = None
         
     else:
         result = mb.askMB(self.fieldName, artistTag, track, 
                           ["release", "date", "tracktotal"])
     
     return result
예제 #20
0
    def getMBKnownData(self, track):
        """Query MB using known data.
            
        We can find the artist from the release.
        To do this we...
            Need: release
            Can Use: date, tracktotal
            Might Use: tracks"""

        if not "release" in track.metadata:
            log("The currently known data does not include the field we need --"
                " the release.")
            result = None

        else:
            result = mb.askMB(self.fieldName, None, track,
                              ["release", "date", "tracktotal", "tracks"])

        return result
예제 #21
0
    def getMBFilenameKnownData(self, track):
        """Match track number from filename against MB using known data."""

        tracknumber = self.getFilename(track)
        if not tracknumber:
            log("Unable to match because no track number was found in filename.")
            result = None
        
        elif not "title" in track.metadata:
            log("The currently known data does not include the fields we need --"
                " the track title.")
            result = None
            
        else:
            result = mb.askMB(self.fieldName, tracknumber, track, 
                              ["title", "artist", "release", "tracknumber"])
            if result:
                result = result.zfill(2)
        
        return result
예제 #22
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""

        releaseTag = tagging.getTag(track.filePath, "release")

        if not releaseTag:
            log("The current tag is empty.")
            result = None

        elif not ("artist" in track.metadata or "date" in track.metadata
                  or "title" in track.metadata):
            log("The currently known data does not include the fields we need --"
                " the artist or the date or the track titles.")
            result = None

        else:
            result = mb.askMB(self.fieldName, releaseTag, track,
                              ["artist", "date", "tracks", "tracktotal"])

        return result
예제 #23
0
 def getMBTagKnownData(self, track):
     """Query MB using known data and the current tag."""
             
     releaseTag = tagging.getTag(track.filePath, "release")
     
     if not releaseTag:
         log("The current tag is empty.")
         result = None
         
     elif not ("artist" in track.metadata or
               "date" in track.metadata or
               "title" in track.metadata):
         log("The currently known data does not include the fields we need --"
             " the artist or the date or the track titles.")
         result = None
         
     else:
         result = mb.askMB(self.fieldName, releaseTag, track, 
                           ["artist", "date", "tracks", "tracktotal"])
     
     return result
예제 #24
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""

        tracknumberTag = tagging.getTag(track.filePath, "tracknumber")

        if not tracknumberTag:
            log("The current tag is empty.")
            result = None

        elif not "title" in track.metadata:
            log("The currently known data does not include the fields we need --"
                " the track title.")
            result = None

        else:
            result = mb.askMB(self.fieldName, tracknumberTag, track,
                              ["title", "artist", "release", "tracknumber"])
            if result:
                result = result.zfill(2)

        return result
예제 #25
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""

        titleTag = tagging.getTag(track.filePath, "title")

        if not titleTag:
            log("The current tag is empty.")
            result = None

        elif not ("release" in track.metadata
                  and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --"
                " the release and track number.")
            result = None

        else:
            # Here we're searching for a track.
            result = mb.askMB(self.fieldName, titleTag, track,
                              ["release", "tracknumber", "artist"])

        return result
예제 #26
0
    def getMBFilenameKnownData(self, track):
        """Match track number from filename against MB using known data."""

        tracknumber = self.getFilename(track)
        if not tracknumber:
            log("Unable to match because no track number was found in filename."
                )
            result = None

        elif not "title" in track.metadata:
            log("The currently known data does not include the fields we need --"
                " the track title.")
            result = None

        else:
            result = mb.askMB(self.fieldName, tracknumber, track,
                              ["title", "artist", "release", "tracknumber"])
            if result:
                result = result.zfill(2)

        return result
예제 #27
0
    def getMBTagKnownData(self, track):
        """Query MB using known data and the current tag."""
        
        tracknumberTag = tagging.getTag(track.filePath, "tracknumber")

        if not tracknumberTag:
            log("The current tag is empty.")
            result = None
            
        elif not "title" in track.metadata:
            log("The currently known data does not include the fields we need --"
                " the track title.")
            result = None
            
        else:
            result = mb.askMB(self.fieldName, tracknumberTag, track, 
                              ["title", "artist", "release", "tracknumber"])
            if result:
                result = result.zfill(2)
        
        return result
예제 #28
0
    def getMBKnownData(self, track):
        """Query MB using known data.
            
        We can find the title from the release and a tracknumber.
        To do this we...
            Need: release, tracknumber
            Can Use: date, artist, tracktotal"""

        if not ("release" in track.metadata
                and "tracknumber" in track.metadata):
            log("The currently known data does not include the fields we need --"
                " the release and track number.")
            result = None

        else:
            # We can use these extra fields because we are searching for a
            # release, not a track.
            result = mb.askMB(
                self.fieldName, None, track,
                ["release", "tracknumber", "date", "artist", "tracktotal"])

        return result
예제 #29
0
    def getMBFilename(self, track):
        """Try to match the file name to a title using MB."""

        fileName = self.getFilenameForMB(track)
        return mb.askMB(self.fieldName, fileName, track)
예제 #30
0
    def getMBFilename(self, track):
        """Try to match the file name to a title using MB."""

        fileName = self.getFilenameForMB(track)
        return mb.askMB(self.fieldName, fileName, track)
예제 #31
0
 def getMBFilename(self, track):
     """Try to match the file name to an artist using MB."""
     
     folderFilePath = self.getFilenameForMB(track)
     return mb.askMB(self.fieldName, folderFilePath, track)
예제 #32
0
    def getMBFilename(self, track):
        """Try to match the file name to an artist using MB."""

        folderFilePath = self.getFilenameForMB(track)
        return mb.askMB(self.fieldName, folderFilePath, track)