def test_originally_by(self): self.failUnlessEqual( split_people("title (originally by artist)"), ("title", ["artist"])) self.failUnlessEqual( split_people("title [originally by artist & artist2]"), ("title", ["artist", "artist2"]))
def __init__(self, tag, value): super(SplitPerson, self).__init__(label=self.title, use_underline=True) self.set_image(Gtk.Image.new_from_icon_name( Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) spls = config.get("editing", "split_on").decode( 'utf-8', 'replace').split() self.set_sensitive(bool(split_people(value, spls)[1]))
def __init__(self, tag, value): super(SplitPerson, self).__init__(label=self.title, use_underline=True) self.set_image( Gtk.Image.new_from_icon_name(Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) spls = config.gettext("editing", "split_on").split() self.set_sensitive(bool(split_people(value, spls)[1]))
def __init__(self, tag, value): super(SplitPerson, self).__init__(label=self.title, use_underline=True) self.set_image(Gtk.Image.new_from_stock( Gtk.STOCK_FIND_AND_REPLACE, Gtk.IconSize.MENU)) spls = config.get("editing", "split_on").decode( 'utf-8', 'replace').split() self.set_sensitive(bool(split_people(value, spls)[1]))
def __init__(self, tag, value): super().__init__(label=self.title, use_underline=True) self.set_image(Gtk.Image.new_from_icon_name( Icons.EDIT_FIND_REPLACE, Gtk.IconSize.MENU)) tag_spls = config.gettext("editing", "split_on").split() sub_spls = config.gettext("editing", "sub_split_on").split() artist, others = split_people(value, tag_spls, sub_spls) if others: artist = artist if len(artist) <= 64 else artist[:64] + "…" others = [other if len(other) <= 64 else other[:64] + "…" for other in others] string = (", ".join(["{}={}".format(tag, artist)] + ["{}={}".format(self.needs[0], o) for o in others])) self.set_label(string) self.set_sensitive(bool(others))
def activated(self, tag, value): spls = config.get("editing", "split_on").decode('utf-8', 'replace').split() artist, others = split_people(value, spls) return [(tag, artist)] + [(self.needs[0], o) for o in others]
def test_cover(self): self.failUnlessEqual( split_people("Pyscho Killer [Talking Heads Cover]"), ("Pyscho Killer", ["Talking Heads"]))
def activated(self, tag, value): tag_spls = config.gettext("editing", "split_on").split() sub_spls = config.gettext("editing", "sub_split_on").split() artist, others = split_people(value, tag_spls, sub_spls) return [(tag, artist)] + [(self.needs[0], o) for o in others]
def test_featuring_two_people(self): self.failUnlessEqual(split_people("foo featuring bar, qx"), ("foo", ["bar", "qx"]))
def test_featuring_person_bracketed(self): self.failUnlessEqual(split_people("foo (Ft. bar)"), ("foo", ["bar"])) self.failUnlessEqual(split_people("foo(feat barman)"), ("foo", ["barman"]))
def test_parened_person(self): self.failUnlessEqual(split_people("foo (bar)"), ("foo", ["bar"]))
def test_with_with_person(self): self.failUnlessEqual(split_people("foo (with with bar)"), ("foo", ["with bar"]))
def activated(self, tag, value): spls = config.gettext("editing", "split_on").split() artist, others = split_people(value, spls) return [(tag, artist)] + [(self.needs[0], o) for o in others]
def test_custom_splitter(self): self.failUnlessEqual( split_people("foo |With bar|", " ", ["||"]), ("foo", ["bar"]))
def test_with_with_person(self): self.failUnlessEqual( split_people("foo (with with bar)"), ("foo", ["with bar"]))
def test_cover(self): self.failUnlessEqual( split_people("Psycho Killer [Talking Heads Cover]"), ("Psycho Killer", ["Talking Heads"]))
def test_featuring_two_people(self): self.failUnlessEqual( split_people("foo featuring bar, qx"), ("foo", ["bar", "qx"]))
def test_featuring_person_bracketed(self): self.failUnlessEqual( split_people("foo (Ft. bar)"), ("foo", ["bar"])) self.failUnlessEqual( split_people("foo(feat barman)"), ("foo", ["barman"]))