コード例 #1
0
ファイル: media_test.py プロジェクト: iamranbi/itunes-search
 def testInstanceNotRelevant(self):
     m1 = proj1.Media("1999", "Prince", "1982")
     m2 = proj1.Song("Undo", "Sanna Nielsen", "2014", "No Album", "Pop",
                     190000)
     m3 = proj1.Movie("Inception", "Christopher Nolan", "2010", "PG",
                      8880000)
     self.assertFalse(
         'rating'
         in dir(m1))  #Media does not have 'rating' instance variable
     self.assertFalse(
         'movielength'
         in dir(m1))  #Media does not have 'movie length' instance variable
     self.assertFalse(
         'tracklength'
         in dir(m1))  #Media does not have 'track length' instance variable
     self.assertFalse(
         'rating'
         in dir(m2))  #Song does not have 'rating' instance variable
     self.assertFalse(
         'movielength'
         in dir(m2))  #Song does not have 'movie length' instance variable
     self.assertFalse(
         'tracklength'
         in dir(m3))  #Movie does not have 'track length' instance variable
     self.assertFalse(
         'genre' in dir(m3))  #Movie does not have 'genre' instance variable
     self.assertFalse(
         'album' in dir(m3))  #Movie does not have 'album' instance variable
コード例 #2
0
ファイル: media_test.py プロジェクト: iamranbi/itunes-search
 def test__len__(self):
     m1 = proj1.Media("1999", "Prince", "1982")
     m2 = proj1.Song("Undo", "Sanna Nielsen", "2014", "No Album", "Pop",
                     190000)
     m3 = proj1.Movie("Inception", "Christopher Nolan", "2010", "PG",
                      8880000)
     self.assertEqual(m1.__len__(), 0)
     self.assertEqual(m2.__len__(), 190)
     self.assertEqual(m3.__len__(), 148)
コード例 #3
0
ファイル: media_test.py プロジェクト: iamranbi/itunes-search
 def test__str__(self):
     m1 = proj1.Media("1999", "Prince", "1982")
     m2 = proj1.Song("Undo", "Sanna Nielsen", "2014", "No Album", "Pop",
                     190000)
     m3 = proj1.Movie("Inception", "Christopher Nolan", "2010", "PG",
                      8880000)
     self.assertEqual(m1.__str__(), "1999 by Prince (1982)")
     self.assertEqual(m2.__str__(), "Undo by Sanna Nielsen (2014) [Pop]")
     self.assertEqual(m3.__str__(),
                      "Inception by Christopher Nolan (2010) [PG]")
コード例 #4
0
ファイル: media_test.py プロジェクト: iamranbi/itunes-search
 def testConstructor(self):
     m0 = proj1.Media()
     m1 = proj1.Media("1999", "Prince", "1982")
     m2 = proj1.Song("Undo", "Sanna Nielsen", "2014", "No Album", "Pop",
                     190000)
     m3 = proj1.Movie("Inception", "Christopher Nolan", "2010", "PG",
                      8880000)
     self.assertEqual(m0.title, "No Title")
     self.assertEqual(m0.author, "No Author")
     self.assertEqual(m1.title, "1999")
     self.assertEqual(m1.author, "Prince")
     self.assertEqual(m1.releaseyear, "1982")
     self.assertEqual(m2.title, "Undo")
     self.assertEqual(m2.author, "Sanna Nielsen")
     self.assertEqual(m2.releaseyear, "2014")
     self.assertEqual(m2.genre, "Pop")
     self.assertEqual(m2.tracklength, 190000)
     self.assertEqual(m3.title, "Inception")
     self.assertEqual(m3.author, "Christopher Nolan")
     self.assertEqual(m3.releaseyear, "2010")
     self.assertEqual(m3.rating, "PG")
     self.assertEqual(m3.movielength, 8880000)
コード例 #5
0
import media
import fresh_tomatoes

# NCS Cartoon on and on song : title, description, poster image, video song url
NCS_cartoon_on_and_on = media.Song(
    "NCS Cartoon on&on", "Cool song", "ncs_on_nd_on.jpg",
    "https://www.youtube.com/watch?v=K4DyBUG242c")

# Starset:It has begun song : title, description, poster image, video song url
starset_it_has_begun = media.Song(
    "It has begun", "Starset 1", "starset_it_has_begun.jpg",
    "https://www.youtube.com/watch?v=O1asGKxmS34")

# Starset:My Demons song : title, description, poster image, video song url
starset_my_demons = media.Song("My Demons", "Starset 2", "mydemons.jpg",
                               "https://www.youtube.com/watch?v=LSvOTw8UH6s")

# Starset:carnivore song : title, description, poster image, video song url
starset_carnivore = media.Song("Carnovore", "Starset 3",
                               "starset_carnivore.jpg",
                               "https://www.youtube.com/watch?v=LAMiX5EEbFU")

# One Piece Anime sound track 1: title, description, poster image, song url
one_piece_epic_theme = media.Song(
    "One Piece Epic Battle theme", "Soundtrack at another level 1",
    "one-piece-poster-shanks.jpg",
    "https://www.youtube.com/watch?v=4J7K3yacig4")

# One Piece Anime sound track 2: title, description, poster image, song url
one_piece_ost_overtaken = media.Song(
    "One Piece OST Overtaken", "Soundtrack at another level 2",
コード例 #6
0
import media

media_library = []
movie_library = []
song_library = []
picture_library = []

# base objects are just so I can call the add() method through them
baseMovie = media.Movie("no", 1, "no", 1)
baseSong = media.Song("no", 1, "no", "no")
basePicture = media.Picture("no", 1, 1)


def menu_op():
    print("\n*** Media Library ***")
    print("a. Display all Media")
    print("b. Display only Songs")
    print("c. Display only Movies")
    print("d. Display only Pictures")
    print("e. Play a Song")
    print("f. Play a Movie")
    print("g. Show a Picture")
    print("h. Add a Song")
    print("i. Add a Movie")
    print("j. Add a Picture")
    print("k. Exit the program")

    choice = input("\nEnter your choice: ")
    if choice.lower() == "a":
        for media in media_library:
            if type(media) == type(baseSong):
コード例 #7
0
import media
import fresh_tomatoes
import webbrowser

allah = media.Song(
    "Allah Ho", "MTV Coke Studio",
    "http://mtvstat.in.com/252c68bdb46aff808e087ba32cd7c30f_ls_xl.jpg",
    "https://www.youtube.com/watch?v=Pt0nqbSJiEE")

madari = media.Song(
    "Madari", "MTV Coke Studio",
    "http://mtvstat.in.com/02bfb81bdeead583f03f38a65a8358ba_ls_xl.jpg",
    "https://www.youtube.com/watch?v=LRnbNpTUpTo")

bad = media.Song(
    "Badtameez Dil", "Yeh Jawaani Yeh Deewani",
    "http://media2.intoday.in/indiatoday/images/stories/badtameez-dil_350_040913113720.jpg",
    "https://www.youtube.com/watch?v=8_ixcsWqC8c")

guns = media.Song(
    "21 Guns", "Green Day",
    "http://fc08.deviantart.net/fs47/f/2009/173/b/2/21_Guns___2_by_jusso11.jpg",
    "https://www.youtube.com/watch?v=r00ikilDxW4")

songs = [allah, madari, bad, guns]
fresh_tomatoes.open_movies_page(songs)
コード例 #8
0
"""
list of Top10 Singles (Nov11) that feed into fresh_tomatoes.py file
"""
import media
import fresh_tomatoes

ROCKABYE = media.Song(
    "1", "Rockabye (feat. Sean Paul)", "Clean Bandit & Anne-Marie",
    "http://s.mxmcdn.net/images-storage/albums4/4/2/9/1/1/2/35211924_350_350.jpg",
    "https://www.youtube.com/watch?v=2F3YbB9hu6c", "New Entry this Week!",
    False, None)

SHOUT_OUT_TO_MY_EX = media.Song(
    "2", "Shout Out To My Ex", "Little Mix",
    "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRrYW6cRQVXPrMl2vJCC80_PGQHwB1a3OrgSo5VMi5nVdIDq3U_5Q",
    "https://www.youtube.com/watch?v=o04PXpriWTg", " ", False, None)

SAY_YOU_WONT_LET_GO = media.Song(
    "3", "Say You Won't Let Go", "James Arthur",
    "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTAxCrO3wlcDcrycjPNcb-eIorWBarDtn8MxAc-P4lqSMuT69NqYQ",
    "https://www.youtube.com/watch?v=kWehLbsIKbs", " ", False, None)

STARBOY = media.Song(
    "4", "Starboy (feat. Daft Punk)", "The Weeknd",
    "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRm5rOMgcc04cSzJQH_z9zjkyl79VdTscgRG4sGLBDBF0me1cqc",
    "https://www.youtube.com/watch?v=z0BuVC7j1og", " ", True, None)

TWENTYFOURK_MAGIC = media.Song(
    "5", "24K Magic", "Bruno Mars",
    "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTuWcDYUAdgkJm2S2_mHC0bs_srwy35d0GfiT1m-9AY0vUinRNG",
    "https://www.youtube.com/watch?v=KkupLU5kdTc", " ", False, None)