Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
    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)
Пример #7
0
    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
Пример #8
0
    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
Пример #9
0
    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
Пример #10
0
 def test_basic_disc(self):
     self.failUnlessEqual(
         split_album("foo disc 1/2"), ("foo", "1/2"))
Пример #11
0
 def test_weird_not_disc(self):
     self.failUnlessEqual(split_album("foo ~crazy 3~"),
                          ("foo ~crazy 3~", None))
Пример #12
0
 def test_weird_disc(self):
     self.failUnlessEqual(split_album("foo ~disk 3~"), ("foo", "3"))
Пример #13
0
 def test_disc_album_and_disc(self):
     self.failUnlessEqual(split_album("disc foo disc 1"), ("disc foo", "1"))
Пример #14
0
 def test_looks_like_disc_but_isnt(self):
     self.failUnlessEqual(split_album("disc foo disc"),
                          ("disc foo disc", None))
Пример #15
0
 def test_basic_disc(self):
     self.failUnlessEqual(split_album("foo disc 1/2"), ("foo", "1/2"))
Пример #16
0
 def test_weird_disc(self):
     self.failUnlessEqual(
         split_album("foo ~disk 3~"), ("foo", "3"))
Пример #17
0
 def test_looks_like_disc_but_isnt(self):
     self.failUnlessEqual(
         split_album("disc foo disc"), ("disc foo disc", None))
Пример #18
0
 def test_weird_not_disc(self):
     self.failUnlessEqual(
         split_album("foo ~crazy 3~"), ("foo ~crazy 3~", None))
Пример #19
0
 def test_album_looks_like_disc(self):
     self.failUnlessEqual(
         split_album("disk 2"), ("disk 2", None))
Пример #20
0
 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)
Пример #21
0
 def test_disc_album_and_disc(self):
     self.failUnlessEqual(
         split_album("disc foo disc 1"), ("disc foo", "1"))
Пример #22
0
 def activated(self, tag, value):
     album, disc = split_album(value)
     return [(tag, album), ("discnumber", disc)]
Пример #23
0
 def test_album_looks_like_disc(self):
     self.failUnlessEqual(split_album("disk 2"), ("disk 2", None))
Пример #24
0
 def activated(self, tag, value):
     album, disc = split_album(value)
     return [(tag, album), ("discnumber", disc)]
Пример #25
0
 def test_custom_splitter(self):
     self.failUnlessEqual(
         split_album("foo |CD 1|", ["||"]), ("foo", "1"))