示例#1
0
    def raw_info(self):
        """returns a Unicode string of low-level MetaData information

        whereas __unicode__ is meant to contain complete information
        at a very high level
        raw_info() should be more developer-specific and with
        very little adjustment or reordering to the data itself
        """

        from os import linesep
        from audiotools import output_table

        # align text strings on the "=" sign, if any

        table = output_table()

        for comment in self.comment_strings:
            row = table.row()

            if (u"=" in comment):
                (tag, value) = comment.split(u"=", 1)
                row.add_column(tag, "right")
                row.add_column(u"=")
                row.add_column(value)
            else:
                row.add_column(comment)
                row.add_column(u"")
                row.add_column(u"")

        return (u"%s:  %s" % (self.__comment_name__(),
                              self.vendor_string) + linesep.decode('ascii') +
                linesep.decode('ascii').join(table.format()))
    def raw_info(self):
        """returns a Unicode string of low-level MetaData information

        whereas __unicode__ is meant to contain complete information
        at a very high level
        raw_info() should be more developer-specific and with
        very little adjustment or reordering to the data itself
        """

        from os import linesep
        from . import output_table

        #align text strings on the "=" sign, if any

        table = output_table()

        for comment in self.comment_strings:
            row = table.row()

            if (u"=" in comment):
                (tag, value) = comment.split(u"=", 1)
                row.add_column(tag, "right")
                row.add_column(u"=")
                row.add_column(value)
            else:
                row.add_column(comment)
                row.add_column(u"")
                row.add_column(u"")

        return (u"%s:  %s" % (self.__comment_name__(),
                              self.vendor_string) + linesep.decode('ascii') +
                linesep.decode('ascii').join(table.format()))
示例#3
0
    def raw_info(self):
        """returns a Unicode string of low-level MetaData information

        whereas __unicode__ is meant to contain complete information
        at a very high level
        raw_info() should be more developer-specific and with
        very little adjustment or reordering to the data itself
        """

        from os import linesep
        from . import display_unicode

        #align text strings on the "=" sign, if any

        if (len(self.comment_strings) > 0):
            max_indent = max([len(display_unicode(comment.split(u"=", 1)[0]))
                              for comment in self.comment_strings
                              if u"=" in comment])

            comment_strings = []
            for comment in self.comment_strings:
                if (u"=" in comment):
                    comment_strings.append(
                        u" " * (max_indent -
                                len(
                                display_unicode(comment.split(u"=", 1)[0]))) +
                        comment)
                else:
                    comment_strings.append(comment)
        else:
            comment_strings = 0

        return linesep.decode('ascii').join(
            [u"%s:  %s" % (self.__comment_name__(), self.vendor_string)] +
            comment_strings)
    def raw_info(self):
        from os import linesep
        from . import display_unicode

        #align text strings on the "=" sign, if any

        if (len(self.comment_strings) > 0):
            max_indent = max([len(display_unicode(comment.split(u"=", 1)[0]))
                              for comment in self.comment_strings
                              if u"=" in comment])

            comment_strings = []
            for comment in self.comment_strings:
                if (u"=" in comment):
                    comment_strings.append(
                        u" " * (max_indent -
                                len(
                                display_unicode(comment.split(u"=", 1)[0]))) +
                        comment)
                else:
                    comment_strings.append(comment)
        else:
            comment_strings = 0

        return linesep.decode('ascii').join(
            [u"Vorbis Comment:  %s" % (self.vendor_string)] +
            comment_strings)
示例#5
0
    def raw_info(self):
        """returns the ApeTag as a human-readable unicode string"""

        from os import linesep
        from audiotools import output_table

        # align tag values on the "=" sign
        table = output_table()

        for tag in self.tags:
            row = table.row()
            (key, value) = tag.raw_info_pair()
            row.add_column(key, "right")
            row.add_column(u" = ")
            row.add_column(value)

        return (u"APEv2:" + linesep.decode('ascii') +
                linesep.decode('ascii').join(table.format()))
示例#6
0
    def raw_info(self):
        """returns the ApeTag as a human-readable unicode string"""

        from os import linesep
        from audiotools import output_table

        # align tag values on the "=" sign
        table = output_table()

        for tag in self.tags:
            row = table.row()
            (key, value) = tag.raw_info_pair()
            row.add_column(key, "right")
            row.add_column(u" = ")
            row.add_column(value)

        return (u"APEv2:" + linesep.decode('ascii') +
                linesep.decode('ascii').join(table.format()))
    def raw_info(self):
        from os import linesep

        return linesep.decode('ascii').join(
            [u"ID3v1:",
             u"  track name = %s" % (self.track_name),
             u" artist name = %s" % (self.artist_name),
             u"  album name = %s" % (self.album_name),
             u"        year = %s" % (self.year),
             u"     comment = %s" % (self.comment),
             u"track number = %d" % (self.track_number),
             u"       genre = %d" % (self.genre)])
示例#8
0
    def raw_info(self):
        """returns a human-readable version of this metadata
        as a unicode string"""

        from os import linesep

        return linesep.decode('ascii').join([u"ID3v1.1:"] + [
            u"%s = %s" % (label, getattr(self, attr)) for (label, attr) in
            [(u"  track name", "track_name"), (u" artist name", "artist_name"),
             (u"  album name", "album_name"), (u"        year", "year"),
             (u"     comment", "comment"), (u"track number", "track_number")]
            if (getattr(self, attr) is not None)
        ] + [u"       genre = %d" % (ord(self.__genre__))])
示例#9
0
    def raw_info(self):
        from os import linesep
        from . import display_unicode

        #align tag values on the "=" sign
        if (len(self.tags) > 0):
            max_indent = max([len(display_unicode(tag.raw_info_pair()[0]))
                              for tag in self.tags])
            tag_strings = [u"%s%s = %s" %
                           (u" " * (max_indent - len(display_unicode(key))),
                            key, value) for (key, value) in
                           [tag.raw_info_pair() for tag in self.tags]]
        else:
            tag_strings = []

        return linesep.decode('ascii').join([u"APEv2:"] + tag_strings)
示例#10
0
    def raw_info(self):
        """returns a human-readable version of this metadata
        as a unicode string"""

        from os import linesep

        return linesep.decode('ascii').join(
            [u"ID3v1.1:"] +
            [u"%s = %s" % (label, getattr(self, attr))
             for (label, attr) in [(u"  track name", "track_name"),
                                   (u" artist name", "artist_name"),
                                   (u"  album name", "album_name"),
                                   (u"        year", "year"),
                                   (u"     comment", "comment"),
                                   (u"track number", "track_number")]
             if (getattr(self, attr) is not None)] +
            [u"       genre = %d" % (ord(self.__genre__))])
示例#11
0
    def raw_info(self):
        """returns a human-readable version of this metadata
        as a unicode string"""

        from os import linesep

        return linesep.decode("ascii").join(
            [
                u"ID3v1:",
                u"  track name = %s" % (self.track_name),
                u" artist name = %s" % (self.artist_name),
                u"  album name = %s" % (self.album_name),
                u"        year = %s" % (self.year),
                u"     comment = %s" % (self.comment),
                u"track number = %d" % (self.track_number),
                u"       genre = %d" % (self.genre),
            ]
        )