def __init__(self, tag, value): super(SplitDisc, self).__init__(_("Split Disc out of _Album"), use_underline=True) self.set_image( Gtk.Image.new_from_stock(Gtk.STOCK_FIND_AND_REPLACE, Gtk.IconSize.MENU)) self.set_sensitive(split_album(value)[1] is not None)
def __init__(self, tag, value): super(SplitDisc, self).__init__(label=_("Split Disc out of _Album"), use_underline=True) self.set_image( Gtk.Image.new_from_icon_name(Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) self.set_sensitive(split_album(value)[1] is not None)
def plugin_song(self, song): if has_album_splittable(song): album, disc = split_album(song["album"]) if album: song["album"] = album if disc: song["discnumber"] = disc
def plugin_song(self, song): if ("album" in song and "discnumber" not in song and song.can_change("album") and song.can_change("discnumber")): album, disc = split_album(song["album"]) if album: song["album"] = album if disc: song["discnumber"] = disc
def __init__(self, tag, value): super().__init__( label=_("Split Disc out of _Album"), use_underline=True) self.set_image(Gtk.Image.new_from_icon_name( Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) album, disc = split_album(value) if disc is not None: album = album if len(album) <= 64 else album[:64] + "…" self.set_label("{}={}, {}={}".format(tag, album, self.needs[0], disc)) self.set_sensitive(disc is not None)
def plugin_song(self, song): if has_title_splittable(song): title, versions = split_title(song["title"]) if title: song["title"] = title if versions: song["version"] = "\n".join(versions) if has_album_splittable(song): album, disc = split_album(song["album"]) if album: song["album"] = album if disc: song["discnumber"] = disc
def plugin_song(self, song): if ("title" in song and song.can_change("title") and song.can_change("version")): title, versions = split_title(song["title"]) if title: song["title"] = title if versions: song["version"] = "\n".join(versions) if ("album" in song and "discnumber" not in song and song.can_change("album") and song.can_change("discnumber")): album, disc = split_album(song["album"]) if album: song["album"] = album if disc: song["discnumber"] = disc
def test_basic_disc(self): self.failUnlessEqual( split_album("foo disc 1/2"), ("foo", "1/2"))
def test_weird_not_disc(self): self.failUnlessEqual(split_album("foo ~crazy 3~"), ("foo ~crazy 3~", None))
def test_weird_disc(self): self.failUnlessEqual(split_album("foo ~disk 3~"), ("foo", "3"))
def test_disc_album_and_disc(self): self.failUnlessEqual(split_album("disc foo disc 1"), ("disc foo", "1"))
def test_looks_like_disc_but_isnt(self): self.failUnlessEqual(split_album("disc foo disc"), ("disc foo disc", None))
def test_basic_disc(self): self.failUnlessEqual(split_album("foo disc 1/2"), ("foo", "1/2"))
def test_weird_disc(self): self.failUnlessEqual( split_album("foo ~disk 3~"), ("foo", "3"))
def test_looks_like_disc_but_isnt(self): self.failUnlessEqual( split_album("disc foo disc"), ("disc foo disc", None))
def test_weird_not_disc(self): self.failUnlessEqual( split_album("foo ~crazy 3~"), ("foo ~crazy 3~", None))
def test_album_looks_like_disc(self): self.failUnlessEqual( split_album("disk 2"), ("disk 2", None))
def __init__(self, tag, value): super(SplitDisc, self).__init__( label=_("Split Disc out of _Album"), use_underline=True) self.set_image(Gtk.Image.new_from_icon_name( Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) self.set_sensitive(split_album(value)[1] is not None)
def test_disc_album_and_disc(self): self.failUnlessEqual( split_album("disc foo disc 1"), ("disc foo", "1"))
def activated(self, tag, value): album, disc = split_album(value) return [(tag, album), ("discnumber", disc)]
def test_album_looks_like_disc(self): self.failUnlessEqual(split_album("disk 2"), ("disk 2", None))
def test_custom_splitter(self): self.failUnlessEqual( split_album("foo |CD 1|", ["||"]), ("foo", "1"))