Exemple #1
0
class ReleaseWindow(tk.tkinter.Toplevel):
    def __init__(self, frame):
        tk.tkinter.Toplevel.__init__(self, frame)
        self._release_builder = ReleaseBuilder()
        self.fields = ([
            EntryInput(self, "Title",
                       Validate().not_empty),
            EntryInput(self, "Year",
                       Validate().year),
            EntryInput(self, "C Line",
                       Validate().not_empty),
            EntryInput(self, "P Line",
                       Validate().not_empty),
            EntryInput(self, "Artist",
                       Validate().not_empty),
            EntryInput(self, "Label",
                       Validate().not_empty),
            CheckboxInput(self, "Explicit")
        ])

    def draw_fields(self):
        for i in range(len(self.fields)):
            self.fields[i].draw(i)

    def create_deal(self):
        deal_window = DealWindow(self)
        deal_window.wait_window()
        deal = deal_window.create_deal()
        self._release_builder.add_deal(deal)
    def test_releases_should_only_add_resource_references_once(self):
        subject = ReleaseBuilder()
        reference = "R0"
        subject.add_resource(reference)
        subject.add_resource(reference)

        release = subject.build()

        resource_references = list(map(lambda x: x[0], release.release_resource_references))
        self.assertTrue(resource_references.count(reference) == 1, resource_references)
Exemple #3
0
    def test_releases_should_only_add_resource_references_once(self):
        subject = ReleaseBuilder()
        reference = "R0"
        subject.add_resource(reference)
        subject.add_resource(reference)

        release = subject.build()

        resource_references = list(
            map(lambda x: x[0], release.release_resource_references))
        self.assertTrue(
            resource_references.count(reference) == 1, resource_references)
Exemple #4
0
 def __init__(self, frame):
     tk.tkinter.Toplevel.__init__(self, frame)
     self._release_builder = ReleaseBuilder()
     self.fields = ([
         EntryInput(self, "Title",
                    Validate().not_empty),
         EntryInput(self, "Year",
                    Validate().year),
         EntryInput(self, "C Line",
                    Validate().not_empty),
         EntryInput(self, "P Line",
                    Validate().not_empty),
         EntryInput(self, "Artist",
                    Validate().not_empty),
         EntryInput(self, "Label",
                    Validate().not_empty),
         CheckboxInput(self, "Explicit")
     ])
Exemple #5
0
 def __init__(self, frame):
     tk.tkinter.Toplevel.__init__(self, frame)
     self._release_builder = ReleaseBuilder()
     self.fields = ([
         EntryInput(self, "Title", Validate().not_empty),
         EntryInput(self, "Year", Validate().year),
         EntryInput(self, "C Line", Validate().not_empty),
         EntryInput(self, "P Line", Validate().not_empty),
         EntryInput(self, "Artist", Validate().not_empty),
         EntryInput(self, "Label", Validate().not_empty),
         CheckboxInput(self, "Explicit")
     ])
Exemple #6
0
def valid_track_release(isrc):
    return (ReleaseBuilder().title("Racing Green")
                .c_line("Copyright hospital records")
                .p_line("Published by Westbury Music")
                .year(2004)
                .reference("A0")
                .release_id(ReleaseIdType.Isrc, isrc)
                .release_type("Track")
                .artist("High Contrast")
                .label("Hospital Records")
                .parental_warning(False)
                .add_deal(Deal("PayAsYouGoModel", "PermanentDownload", "FR", datetime(2004, 9, 6)))
                .build())
Exemple #7
0
class ReleaseWindow(tk.tkinter.Toplevel):
    def __init__(self, frame):
        tk.tkinter.Toplevel.__init__(self, frame)
        self._release_builder = ReleaseBuilder()
        self.fields = ([
            EntryInput(self, "Title", Validate().not_empty),
            EntryInput(self, "Year", Validate().year),
            EntryInput(self, "C Line", Validate().not_empty),
            EntryInput(self, "P Line", Validate().not_empty),
            EntryInput(self, "Artist", Validate().not_empty),
            EntryInput(self, "Label", Validate().not_empty),
            CheckboxInput(self, "Explicit")
        ])

    def draw_fields(self):
        for i in range(len(self.fields)):
            self.fields[i].draw(i)

    def create_deal(self):
        deal_window = DealWindow(self)
        deal_window.wait_window()
        deal = deal_window.create_deal()
        self._release_builder.add_deal(deal)
 def test_can_get_title(self):
     title = "Thriller"
     release_builder = ReleaseBuilder().title(title)
     
     self.assertEqual(release_builder.get_title(), title)
 def test_can_get_isrc(self):
     isrc = "FR132131234"
     release_builder = ReleaseBuilder().release_id(ReleaseIdType.Isrc, isrc)
     
     self.assertEqual(release_builder.get_isrc(), isrc)
Exemple #10
0
    def test_can_get_title(self):
        title = "Thriller"
        release_builder = ReleaseBuilder().title(title)

        self.assertEqual(release_builder.get_title(), title)
Exemple #11
0
    def test_can_get_isrc(self):
        isrc = "FR132131234"
        release_builder = ReleaseBuilder().release_id(ReleaseIdType.Isrc, isrc)

        self.assertEqual(release_builder.get_isrc(), isrc)
Exemple #12
0
 def test_errors_if_a_non_string_resource_reference_is_passed_in(self):
     self.assertRaises(TypeError, lambda: ReleaseBuilder().reference(123))