def save_tag(self): """Updates the tag with the GUI data.""" tag = self.tag for key, values in tag.iteritems(): if isinstance(values, APETextValue): del tag[key] tb = self.tag_frame.tb lines = tb.get_text(tb.get_start_iter(), tb.get_end_iter()).splitlines() for line in lines: try: key, val = line.split("=", 1) except ValueError: continue else: key = key.strip() val = val.strip() if val: try: tag[key].value += "\0" + val.decode("utf-8") except (KeyError, AttributeError): try: tag[key] = APETextValue(val.decode("utf-8"), 0) except KeyError: print("Unacceptable key", key) tag.save()
def producer(self, producer: str): self.file['producer'] = APETextValue(value=producer, kind=0) return self
def disc_number(self, disc: str): self.file['DISCNUMBER'] = APETextValue(value=disc, kind=0) return self
def composer(self, composer: str): self.file['COMPOSER'] = APETextValue(value=composer, kind=0) return self
def track_number(self, track_number: str): self.file['Track'] = APETextValue(value=track_number, kind=0) return self
def genre(self, genre: str): self.file['Genre'] = APETextValue(value=genre, kind=0) return self
def album(self, album: str): self.file['Album'] = APETextValue(value=album, kind=0) return self
def year(self, year: str): self.file['Year'] = APETextValue(value=year, kind=0) return self
def album_artist(self, artist: str): self.file['Album artist'] = self.file['ALBUMARTIST'] = APETextValue( value=artist, kind=0) return self
def artist(self, artist: str): self.file['Artist'] = APETextValue(value=artist, kind=0) return self
def comments(self, comments: str): self.file['Comment'] = APETextValue(value=comments, kind=0) return self
def subtitle(self, subtitle: str): self.file['subtitle'] = APETextValue(value=subtitle, kind=0) return self
def title(self, title: str): self.file['Title'] = APETextValue(value=title, kind=0) return self