def Display_DVD_Information(DVD1, DVD2, DVD3):
    LINE_LENGTH = 60
    NUM_COLUMNS = 4
    COL_WIDTH = LINE_LENGTH // NUM_COLUMNS
    print('{0:<{1}s}'.format("Title:", COL_WIDTH), end='')
    print('${0:<{1}s}'.format("Cost:", COL_WIDTH), end='')
    print('{0:<{1}s}'.format("Type:", COL_WIDTH),"\n")

    for i in range(1,4):
        DVD = eval("DVD" + str(i))
        print('{0:<{1}s}'.format(DVD.getTitle(), COL_WIDTH), end='')
        print('${0:<{1}.2f}'.format(DVD.getCost(), COL_WIDTH), end='')
        print('{0:<{1}s}'.format(DVD.getType(), COL_WIDTH),)
    print("\n")
 def create_dvd(item_info: dict) -> DVD:
     """
     Creates a DVD.
     """
     release_day = input("Enter Release Date:")
     region_code = input("Enter Region Code:")
     item_info["release_date"] = release_day
     item_info["region_code"] = region_code
     return DVD(**item_info)
示例#3
0
 def create():
     title = input("Enter a title: ")
     call_num = input("Enter a call number: ")
     num_copies = input("Enter number of copies: ")
     release = input("Enter Release Date: ")
     region = input("Enter Region Code: ")
     return DVD(title=title,
                call_num=call_num,
                num_copies=num_copies,
                date=release,
                region=region)
    def add_dvd(self):
        """
		Add a brand new DVD to the library with a unique call number.
		:return: a DVD
		"""
        dvd_data = self.add_basic_info()
        release_date = input("Enter Release Date: ")
        region_code = input("Enter Region Code")
        new_dvd = DVD(dvd_data[0], dvd_data[1], dvd_data[2], release_date,
                      region_code)
        return new_dvd
 def create_dvd() -> DVD:
     """
     Creates a DVD.
     """
     call_number = input("Enter Call Number: ")
     title = input("Enter title: ")
     num_copies = int(input("Enter number of copies "
                            "(positive number): "))
     release_day = input("Enter Release Day:")
     region_code = input("Enter Region Code:")
     return DVD(call_number, title, num_copies, release_day, region_code)
示例#6
0
def generate_test_items():
    """
    Return a list of items with dummy data.
    :return: a list
    """
    item_list = [
        Book("100.200.300", "Harry Potter 1", 2, "J K Rowling"),
        Book("999.224.854", "Harry Potter 2", 5, "J K Rowling"),
        Journal("631.495.302", "Harry Potter 3", 4, "53434", "Router"),
        DVD("123.02.204", "The Cat in the Hat", 1, "2014-01-05", "342DV")
    ]
    return item_list
    def create_dvd(cls):
        """
        Prompts user to create a dvd item
        :return: a dvd item
        """
        title = input("input dvd title\n")
        call_num = input("input dvd call number\n")
        num_copies = input("input number of copies\n")
        release_date = input("input release date\n")
        region_code = input("input region code\n")

        return DVD(title, call_num, int(num_copies), release_date, region_code)
示例#8
0
 def create_item(self):
     item_type = input("Enter an item type:\n1: Book\n2: Dvd\n3: Journal")
     item = "invalid input given"
     if item_type == "1":
         item = Book(self._title, input("Enter Authour name: "),
                     self._call_num, self._num_copies)
     elif item_type == "2":
         item = DVD(self._title, input("Enter Release Date: "), input("Enter Region Code: "),\
                    self._call_num, self._num_copies)
     elif item_type == "3":
         item = Journal(self._title, input("Enter Issue Number: "),
                        input("Enter Publisher Name: "), self._call_num,
                        self._num_copies)
     return item
示例#9
0
def generate_test_books() -> list:
    """
    Return a list of books with dummy data.
    :return: a list
    """
    book_list = [
        Book("100.200.300", "Harry Potter 1", 2, "J K Rowling"),
        Book("999.224.854", "Harry Potter 2", 5, "J K Rowling"),
        Book("631.495.302", "Harry Potter 3", 4, "J K Rowling"),
        Book("123.02.204", "The Cat in the Hat", 1, "Dr. Seuss"),
        Journal("100.132.126", "My Travel", 5, "123.1231.614a", "Luke"),
        DVD("123.456.123", "My Dream", 10, "2020-03-10", "123")
    ]
    return book_list
示例#10
0
    def __init__(self):
        """
        Initialize an item list of the catalogue.
        """
        # Item Dictionary (key: call number, value: Item object)
        self.item_list = {}

        # Add some items manually for testing purposes.
        book1 = Book("In praise of Idleness", "B-1", 3, "bertrand russell")
        book2 = Book("Breaking the Code", "B-2", 1, "Pat Matter")
        dvd = DVD("Breaking Bad", "D-1", 2, "2019-01-05", "CA")
        self._add_item_by_item(book1)
        self._add_item_by_item(book2)
        self._add_item_by_item(dvd)
示例#11
0
def main():
    """ Main entry point of the app """
    logger.info("CopyDisc Starting Up")

    # Log some variables
    # logger.info("var1: %s, var2: %s", var1, var2)

    copydisc = Copydisc('/dev/ttyUSB0')
    dvd = DVD()
    handbrake = Handbrake('/mnt/nas/Movies')

    copydisc.calibrate()

    # dvdTitle = handbrake.getTitle()
    # logger.info("Ripping: %s", dvdTitle)
    # handbrake.ripDVD()

    dvd.open()

    while True:
        try:
            copydisc.insert()
        except:
            logger.info("No Discs in Loader, finished")
            sys.exit()

        dvd.close()

        time.sleep(20)

        dvdTitle = handbrake.getTitle()
        logger.info("Ripping: %s", dvdTitle)

        handbrake.ripDVD()

        time.sleep(10)
        dvd.open()
        time.sleep(5)
        copydisc.accept()
示例#12
0
from customer import Customer
from dvd import DVD
from movieworld import MovieWorld

c1 = Customer("John", 16, 1)
c2 = Customer("Anna", 55, 2)

d1 = DVD("Black Widow", 1, 2020, "April", 18)
d2 = DVD.from_date(2, "The Croods 2", "23.12.2020", 3)
# d3 = DVD.from_date(3, "The Croods 2", "23.12.2020", 3)
movie_world = MovieWorld("The Best Movie Shop")
movie_world.add_customer(c1)
movie_world.add_customer(c2)
movie_world.add_dvd(d1)
movie_world.add_dvd(d2)
# movie_world.add_dvd(d3)
print(movie_world.rent_dvd(1, 1))
print(movie_world.rent_dvd(2, 1))
print(movie_world.rent_dvd(1, 2))
# print(movie_world.rent_dvd(1, 3))
print(movie_world)
    def create_item(self) -> DVD:
        kwargs = self.get_input()
        release_date = input("input release date\n")
        region_code = input("input region code\n")

        return DVD(release_date, region_code, **kwargs)