def setUp(self):

        drink_1 = Drink("Guinness", 3, 3)
        drink_2 = Drink("Whiskey Sour", 6, 5)
        drink_3 = Drink("Tsingtao", 4, 3)

        drinks_list = [drink_1, drink_2, drink_3]

        self.room_1 = Room("Plush Paradise", 3)
        self.bar_1 = Bar(500, drinks_list)

        self.venue_1 = Venue("Cara's OK Karaoke", [self.room_1], self.bar_1)

        self.song_1 = Song(10001,
                           "Let's Make Love and Listen to Death from Above",
                           "CSS", [3, 30], 2005)
        self.song_2 = Song(10002, "Song 2", "Blur", [2, 2], 1996)
        self.song_3 = Song(10003, "E-Mail My Heart", "Britney Spears", [3, 41],
                           1999)
        self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)
        self.song_5 = Song(10005, "Virtual Insanity", "Jamiroquai", [4, 4],
                           1996)

        self.guest_1 = Guest("Lovefoxxx", 36, 50, self.song_1)
        self.guest_2 = Guest("Britney Spears", 38, 100, self.song_4)
        self.guest_3 = Guest("Damon Albarn", 52, 20, self.song_3)
        self.guest_4 = Guest("Jamiroquai", 50, 5, self.song_5)
        self.guest_5 = Guest("Human Child", 8, 20, self.song_2)
        self.guest_6 = Guest("Jay-Z", 50, 10000, self.song_5)
        self.guest_7 = Guest("Shania Twain", 55, 80, self.song_1)
示例#2
0
    def setUp(self):
        self.song1 = Song("Help", "The Beatles")
        self.song2 = Song("Saturday Night", "Sam Cooke")

        self._songs = [self.song1, self.song2]

        self.guest = Guest("Hannah")
示例#3
0
    def setUp(self):
        # Drinks
        self.drink_1 = Drink("Tennents", 3.50, True)
        self.drink_2 = Drink("Coca Cola", 2.00, False)

        # Songs
        self.song_1 = Song("Shake It Off", "Taylor Swift", 219)
        self.song_2 = Song("Sweet Caroline", "Neil Diamond", 201)
        self.song_3 = Song("YMCA", "Village People", 287)
        self.song_4 = Song("I'm Gonna Be (500 Miles)", "The Proclaimers", 217)

        # Guests
        self.guest_1 = Guest("Alice", 43, 30.00, self.song_3)
        self.guest_2 = Guest("Bob", 45, 60.00, self.song_3)
        self.guest_3 = Guest("Charlie", 21, 15.50, self.song_3)
        self.guest_4 = Guest("David", 17, 10.00, self.song_2)
        self.guest_5 = Guest("Emma", 24, 29.95, self.song_2)
        self.guest_6 = Guest("Freddie", 31, 5.00, self.song_1)

        group_1 = [self.guest_1, self.guest_2, self.guest_3, self.guest_4, self.guest_5]

        # Rooms
        self.room_1 = Room(1, 4)
        self.room_2 = Room(2, 5)

        self.room_2.guests = group_1
示例#4
0
 def setUp(self):
     self.room = Room("Room 1", 45, "Wild West")
     self.guest_1 = Guest("Michael Jackson", 50)
     self.guest_2 = Guest("50 Cent", 150)
     self.song_1 = Song("Beautiful Day", "U2")
     self.song_2 = Song("Bunsen", "Frontierer")
     self.song_3 = Song("Axe To Fall", "Converge")
示例#5
0
class TestSong(unittest.TestCase):
    def setUp(self):
        self.song = Song("Highway To Hell", "AC/DC")

    def test_song_has_title(self):
        self.assertEqual("Highway To Hell", self.song.title)

    def test_song_has_artist(self):
        song = Song("Highway To Hell", "AC/DC")
        self.assertEqual("AC/DC", self.song.artist)

    def test_equals_returns_true(self):
        song = Song("Highway To Hell", "AC/DC")
        result = self.song.equals(song)
        self.assertEqual(True, result)

    def test_equals_title_different_returns_false(self):
        song = Song("Back in Black", "AC/DC")
        result = self.song.equals(song)
        self.assertEqual(False, result)

    def test_equals_artist_different_returns_false(self):
        song = Song("Highway To Hell", "Iron Maiden")
        result = self.song.equals(song)
        self.assertEqual(False, result)

    def test_equals_song_different_returns_false(self):
        song = Song("Ace of Spades", "Iron Maiden")
        result = self.song.equals(song)
        self.assertEqual(False, result)
示例#6
0
 def setUp(self):
     self.room = Room("Karoke Room 1", "Saviour", 0, 3, 2)
     self.guest_1 = Guest("Baron Von Humperdink", 25, 40, "Saviour")
     self.guest_2 = Guest("Baron Von Jon", 45, 40, "Faith Alone")
     self.guest_3 = Guest("Baron Steve", 65, 40, "Blitzkrieg Bop")
     self.song_1 = Song("Saviour", "Rise Against")
     self.song_2 = Song("Blitzkrieg Bop", "Ramones")
     self.song_3 = Song("Faith Alone", "Bad Religion")
示例#7
0
    def setUp(self):
        self.song = Song("Queen", "Bohemian Rhapsody")

        self.song1 = Song("Linken park", "In the end")
        self.song2 = Song("Natasha Bedingfield", "Unwritten")
        self.song4 = Song("Linken park", "In the end")

        self.playlist = [self.song, self.song1, self.song2]
示例#8
0
 def setUp(self):
     self.song_1 = Song(10001,
                        "Let's Make Love and Listen to Death from Above",
                        "CSS", [3, 30], 2005)
     self.song_2 = Song(10002, "Song 2", "Blur", [2, 2], 1996)
     self.song_3 = Song(10003, "E-Mail My Heart", "Britney Spears", [3, 41],
                        1999)
     self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)
示例#9
0
class TestSong(unittest.TestCase):
    def setUp(self):
        self.song = Song("Help", "The Beatles")

    def test_song_has_title(self):
        self.assertEqual("Help", self.song.get_title())

    def test_song_has_artist(self):
        self.assertEqual("The Beatles", self.song.get_artist())
示例#10
0
    def setUp(self):
        self.song_1 = Song("Highway to Hell", "AC/DC")
        self.song_2 = Song("The Clansman", "Iron Maiden")
        self.song_3 = Song("Ace of Spades", "Motorhead")

        self.songs = [self.song_1, self.song_2, self.song_3]

        song = Song("Ace of Spades", "Motorhead")
        self.guest = Guest("Jack", 20, song)
示例#11
0
    def setUp(self):
        self.room = Room("Room 1", 3, 5.00, 100.00)
        self.song_1 = Song("Africa", "Toto")
        self.song_2 = Song("Purple Rain", "Prince")
        self.song_3 = Song("Dancing Queen", "Abba")

        self.guest_1 = Guest("Elton", 30.00, "Purple Rain")
        self.guest_2 = Guest("Dolly", 40.00, "Wannabe")
        self.guest_3 = Guest("Kylie", 50.00, "Africa")
        self.guest_4 = Guest("Bruce", 50.00, "Enter Sandman")
示例#12
0
    def setUp(self):
        # self.room1 = Room("Osaka", 5, 20)
        self.room = Room("Tokyo", 3, 20)

        self.song1 = Song("Fleetwood Mac", "The Chain")
        self.song2 = Song("Dubliners", "The Rocky Road to Dublin")
        self.song3 = Song("Kate Bush", "Wuthering Heights")

        self.guest1 = Guest("Stevie", 39, "The Chain", 10)
        self.guest2 = Guest("Luke", 45, "The Rocky Road to Dublin", 150)
        self.guest3 = Guest("Cathy", 31, "Wuthering Heights", 200)
    def setUp(self):
        self.room1 = Room("Room 1", 2, 5)
        self.room2 = Room("Room 2", 3, 7.5)

        self.guest1 = Guest("Sam", 5)
        self.guest2 = Guest("Bob", 10)
        self.guest3 = Guest("Joe", 15)

        self.song1 = Song("People Like Us")
        self.song2 = Song("Waterloo")
        self.song3 = Song("Ice Cream")
示例#14
0
    def setUp(self):
        self.song1 = Song("Help", "The Beatles")
        self.song2 = Song("Saturday Night", "Sam Cooke")

        self.songs = [self.song1, self.song2]

        self.guest1 = Guest("Hannah")
        self.guest2 = Guest("Louise")
        self.guest3 = Guest("Harry")

        self.guests = [self.guest1, self.guest2, self.guest3]

        self.room = Room("Motown", 3)
    def setUp(self):

        self.room_1 = Room("Karaoke Star", 50)
        self.room_2 = Room("Karaoke Rooms", 20)
        self.room_3 = Room("Scotland's got talent", 10)

        self.guest_1 = Guest("Arnold")
        self.guest_2 = Guest("John")
        self.guest_3 = Guest("Tamara")

        self.song_1 = Song("Hotel California", "Eagles", "rock")
        self.song_2 = Song("Viva Las Vegas", "Elvis Presley", "Rock and roll")
        self.song_3 = Song("Billie Jean", "Michael Jackson", "Pop")
示例#16
0
    def setUp(self):
        self.room = Room("Cover Your Ears!", 15, 10)
        self.room_small = Room("Tight Squeeze", 1, 15)

        self.song = Song("Hold a chicken in the air")
        self.song_not_fav = Song("Put that chair back")

        # fav_song should be song object, not just a string
        self.guest = Guest("Sid The Sloth", 33.25, "Hold a chicken in the air")
        # like...
        # self.guest = Guest("Sid The Sloth", 33.25, song)

        # fav_song should be song object, not just a string
        self.guest_no_money = Guest("Scrooge", 3.99, "Yeah, right!")
示例#17
0
    def setUp(self):
        # Drinks
        self.drink_1 = Drink("Tennents", 3.50, True)
        self.drink_2 = Drink("Coca Cola", 2.00, False)

        # Songs
        self.song_1 = Song("Shake It Off", "Taylor Swift", 219)
        self.song_2 = Song("Sweet Caroline", "Neil Diamond", 201)
        self.song_3 = Song("YMCA", "Village People", 287)

        # Guests
        self.guest_1 = Guest("Alice", 43, 30.00, self.song_3)
        self.guest_4 = Guest("David", 17, 10.00, self.song_2)
        self.guest_6 = Guest("Freddie", 31, 5.00, self.song_1)
示例#18
0
 def setUp(self):
     self.songs = {
         "NBT_Particles": Song("Nothing But Thieves", "Particles"),
         "NBT_Amsterdam": Song("Nothing But Thieves", "Amsterdam"),
         "ACDC_HighwayToHell": Song("AC/DC", "Highway To Hell"),
         "ACDC_TNT": Song("AC/DC", "TNT"),
         "ACDC_HellsBells": Song("AC/DC", "Hells Bells"),
         "ACDC_GirlsGotRhythm": Song("AC/DC", "Girls Got Rhythm"),
         "Metallica_SeekAndDestroy": Song("Metallica", "Seek And Destroy"),
         "Metallica_RideTheLighting": Song("Metallica",
                                           "Ride The Lighting"),
         "Metallica_Baterry": Song("Metallica", "Baterry"),
         "Slipknot_Unsainted": Song("Slipknot", "Unsainted")
     }
示例#19
0
    def setUp(self):
        self.song_1 = Song("Highway to Hell", "AC/DC")
        self.song_2 = Song("The Clansman", "Iron Maiden")
        self.song_3 = Song("Ace of Spades", "Motorhead")

        self.songs = [self.song_1, self.song_2, self.song_3]

        self.jack = Guest("Jack", 20, self.song_1)
        self.victor = Guest("Victor", 15, self.song_2)
        self.isa = Guest("Isa", 100, self.song_3)

        self.guests = [self.jack, self.victor, self.isa]

        self.winston = Guest("Winston", 10, self.song_2)
        self.room = Room("The Metal Room", 3, 10)
示例#20
0
    def setUp(self):
        self.room = Room("The Viper Room", 150, 5, 20)

        self.song1 = Song("The Rolling Stones", "She's a rainbow")
        self.song2 = Song("The Kinks", "All day and all of the night")
        self.song3 = Song("The Beatles", "Norwegian Wood")
        self.song4 = Song("The Troggs", "Wild Thing")

        self.songs = [self.song1, self.song2, self.song3, self.song4]

        self.guest1 = Guest("Holly Golighty", 20, 50, self.song1, 4)
        self.guest2 = Guest("Paul Varjak", 27, 100, self.song2, 8)
        self.guest3 = Guest("Cat", 100, 0, self.song4, 2)

        self.guests = [self.guest1, self.guest2, self.guest3]
示例#21
0
    def getSong(self, url):
        info = self.getInfo(url)
        if not info:
            return None

        return Song(info['title'], info['formats'][0]['url'], info['duration'],
                    info['thumbnail'])
示例#22
0
    def setUp(self):
        self.room1 = Room("Boiler room", 20, 5)
        self.room2 = Room("Grinder room", 35, 3)
        self.guest = Guest("Jack", 28, 50.00, "In the end")
        self.guest1 = Guest("Andy", 35, 75.00, "In the end")
        self.guest2 = Guest("Alex", 25, 30.00, "Unwritten")
        self.guest3 = Guest("Collin", 30, 45.00, "Dancing in the moonlight")
        self.guests1 = [self.guest, self.guest1, self.guest2]
        self.guests2 = [self.guest, self.guest1, self.guest2, self.guest3]
        self.guests3 = [self.guest1, self.guest2, self.guest3]
        self.song = Song("Queen", "Bohemian Rhapsody")

        self.song1 = Song("Linken park", "In the end")
        self.song2 = Song("Natasha Bedingfield", "Unwritten")
        self.song4 = Song("Top Loader", "Dancing in the moonlight")
        self.playlist = [self.song, self.song1, self.song2]
    def setUp(self):

        self.song1 = Song("The Rolling Stones", "She's a rainbow")
        self.song2 = Song("The Kinks", "All day and all of the night")
        self.song3 = Song("The Beatles", "Norwegian Wood")
        self.song4 = Song("The Troggs", "Wild Thing")

        self.songs = [self.song1, self.song2, self.song3, self.song4]

        self.drink = Drink("rum", 5.00, 30)
        self.food = Food("peanuts", 2.00, 25)
        self.guest1 = Guest("Holly Golighty", 20, 50, self.song1, 4)
        self.guest2 = Guest("Paul Varjak", 27, 100, self.song2, 8)
        self.guest3 = Guest("Cat", 100, 0, self.song4, 2)

        self.guests = [self.guest1, self.guest2, self.guest3]
示例#24
0
    def setUp(self):

        drink_1 = Drink("Guinness", 3, 3)
        drink_2 = Drink("Whiskey Sour", 6, 5)
        drink_3 = Drink("Tsingtao", 4, 3)
        
        drinks_list = [drink_1, drink_2, drink_3]

        self.bar_1 = Bar(500, drinks_list)

        self.song_1 = Song(10001, "Let's Make Love and Listen to Death from Above", "CSS", [3,30], 2005)
        self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)

        self.guest_1 = Guest("Lovefoxxx", 36, 50, self.song_1)
        self.guest_2 = Guest("Britney Spears", 38, 100, self.song_4)

        self.room_1 = Room("Plush Paradise", 3)
示例#25
0
def parse_music(music_content):
    playlists = {}
    playlist = ""
    songs = []
    lines = [x + "\n" for x in music_content.split("\n")]

    index = 0
    while index < len(lines):
        # Save playlist and reset songs
        if lines[index].startswith("** "):
            if playlist != "":
                playlists[playlist] = songs
            playlist = lines[index][3:-1]
            songs = []
        # Add a new song
        elif lines[index].startswith("- "):
            line = lines[index].replace("[", "").replace("- ", "",
                                                         1).split("]")
            songs.append(Song(line[1], line[0]))
        # Add a new snippet collection
        elif lines[index].startswith("+ "):
            #
            # Find functions to load data
            #
            start_index = index
            acc = ""
            while lines[index].endswith("\\\n"):
                acc += lines[index][:-1]
                index += 1

            link = re.search("\[\[.+?\]", acc).group(0)
            link = link.replace("[", "").replace("]", "")

            code = acc[acc.find("{"):acc.rfind("};") + 1].replace("\\", "")
            code = json.loads(code)

            title_func = eval(code["title"])
            time_func = eval(code["time"])

            #
            # Load snippet collection
            #
            index = start_index
            while "};" not in lines[index]:
                index += 1
            index += 1

            snippet_collection = SnippetCollection(link)
            while lines[index].endswith("\\\n"):
                title = title_func(lines[index])
                time = time_func(lines[index])
                snippet_collection.snippets.append(Snippet(title, time))
                index += 1
            songs.append(snippet_collection)
        index += 1
    playlists[playlist] = songs
    return playlists
    def setUp(self):
        self.guest_1 = Guest("Eddie Vedder", "The Wrong Car", 500)
        self.guest_2 = Guest("Kurt Cobain", "Teen Spirit", 300)
        self.guest_3 = Guest("Billy Corgan", "1979", 500)
        self.guest_4 = Guest("Chris Cornell", "The Day I Tried To Live", 385)
        self.guest_5 = Guest("Zack De la Rocha", "Testify", 500)
        self.guest_6 = Guest("Chino Moreno", "Change In the House of Flies",
                             350)

        self.room_1 = Room("Yellow Submarine", 8, 50)
        self.room_2 = Room("Purple Rain", 10, 60)
        self.room_3 = Room("Blue Monday", 12, 70)

        self.song_1 = Song("Tether", "Chvrches", "Synth Pop")
        self.song_2 = Song("Questions and Answers", "Biffy Clyro", "Alt Rock")
        self.song_3 = Song("The Wrong Car", "The Twilight Sad", "Post Punk")
        self.song_4 = Song("Fast Blood", "Frightened Rabbit", "Indie Folk")
        self.song_5 = Song("Scottish Fiction", "Idlewild", "Indie")
示例#27
0
 def setUp(self):
     song_1 = Song("Run-D.M.C.", "Christmas in Hollis")
     song_2 = Song("Skeletons", "Stevie Wonder")
     song_3 = Song("Beethoven", "Ode to Joy")
     song_4 = Song("Let It Snow! Let It Snow! Let It Snow!", "Vaughn Monroe")
     self.guest_1 = Guest("John McLean", 39, song_1, 100.00, "Yippee-ky-ay!!")
     self.guest_2 = Guest(
         "Al Powell",
         43,
         song_2,
         50.00,
         "Now means now goddammit!, I'm under automatic rifle fire at Nakatomi, I need backup assistance now! NOW, GODDAMMIT, NOW!",
     )
     self.guest_3 = Guest(
         "Hans Gruber", 47, song_3, 10000.00, "WHERE ARE MY DETONATORS!"
     )
     self.guest_4 = Guest(
         "Karl Vreski", 35, song_4, 0.00, "No one kills him but me!"
     )
示例#28
0
class TestSong(unittest.TestCase):
    def setUp(self):
        self.song = Song("Crystal Lake", "Disobey")

    def test_has_artist_and_title(self):
        self.assertEqual("Crystal Lake", self.song.artist)
        self.assertEqual("Disobey", self.song.title)

    def test_created_song(self):
        actual = self.song.create_song(self.song)
        self.assertEqual({"Crystal Lake": "Disobey"}, actual)
示例#29
0
def getM3uMusic(m3u_file_path):
    """ Creates a list of Song objects
    Songs files are parsed from the m3u file
    """
    songs = []
    with open(m3u_file_path) as m3u_file:
        for line in m3u_file:
            if lineIsMusic(line.rstrip()):
                print("\t%s" % line)
                songs.append(Song(getFileInfo(line.rstrip())))
    return songs if len(songs) > 0 else None
示例#30
0
    def setUp(self):
        self.guest_1 = Guest("Gavin", 35, "Closing Time", 50.00)
        self.guest_2 = Guest("Ailsa", 27, "Romeo and Juliet", 45.00)
        self.guest_3 = Guest(
            "Stewart", 32,
            "Just Dropped In (To See What Condition My Condition Was In)",
            55.00)
        self.guest_4 = Guest("Karissa", 27, "Super Trouper", 48.00)
        self.guest_5 = Guest("Isla", 28, "Oops! I Did it Again", 52.00)
        self.guest_6 = Guest("Kirsty", 16, "What's My Age Again?", 25.00)

        self.song_1 = Song("Closing Time", "Semisonic", "Alt Rock")
        self.song_2 = Song("Romeo and Juliet", "Dire Straits", "Rock")
        self.song_3 = Song("Thank You For the Music", "ABBA", "Pop")
        room_songs = {self.song_1, self.song_2, self.song_3}

        self.room_1 = Room("Jungle Room", 5, 50.00, room_songs)

        self.drink_1 = Drink("Cocktail Pitcher", 12.00)
        self.drink_2 = Drink("Punk IPA", 5.00)