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