def test_visible_sublanes(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) humorous, ig = Genre.lookup(self._db, classifier.Humorous_Fiction) visible_sublane = Lane(self._db, "Humorous Fiction", genres=humorous) visible_grandchild = Lane(self._db, "Urban Fantasy", genres=urban_fantasy) invisible_sublane = Lane(self._db, "Fantasy", invisible=True, genres=fantasy, sublanes=[visible_grandchild], subgenre_behavior=Lane.IN_SAME_LANE) lane = Lane(self._db, "English", sublanes=[visible_sublane, invisible_sublane], subgenre_behavior=Lane.IN_SAME_LANE) eq_(2, len(lane.visible_sublanes)) assert visible_sublane in lane.visible_sublanes assert visible_grandchild in lane.visible_sublanes
def test_custom_sublanes(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) urban_fantasy_lane = Lane(self._db, "Urban Fantasy", genres=urban_fantasy) fantasy_lane = Lane(self._db, "Fantasy", fantasy, genres=fantasy, subgenre_behavior=Lane.IN_SAME_LANE, sublanes=[urban_fantasy_lane]) eq_([urban_fantasy_lane], fantasy_lane.sublanes.lanes) # You can just give the name of a genre as a sublane and it # will work. fantasy_lane = Lane(self._db, "Fantasy", fantasy, genres=fantasy, subgenre_behavior=Lane.IN_SAME_LANE, sublanes="Urban Fantasy") eq_([["Urban Fantasy"]], [x.genre_names for x in fantasy_lane.sublanes.lanes])
def test_search_info(self): # Searching this lane will use the language # and audience restrictions from the lane. lane = self._lane() lane.display_name = "Fiction" lane.languages = ["eng", "ger"] lane.audiences = [Classifier.AUDIENCE_YOUNG_ADULT] lane.fiction = True info = OpenSearchDocument.search_info(lane) eq_("Search", info['name']) eq_("Search English/Deutsch Young Adult", info['description']) eq_("english/deutsch-young-adult", info['tags']) # This lane is the root for a patron type, so searching # it will use all the lane's restrictions. root_lane = self._lane() root_lane.root_for_patron_type = ['A'] root_lane.display_name = "Science Fiction & Fantasy" sf, ignore = Genre.lookup(self._db, "Science Fiction") fantasy, ignore = Genre.lookup(self._db, "Fantasy") root_lane.add_genre(sf) root_lane.add_genre(fantasy) info = OpenSearchDocument.search_info(root_lane) eq_("Search", info['name']) eq_("Search Science Fiction & Fantasy", info['description']) eq_("science-fiction-&-fantasy", info['tags'])
def teardown(self): # Close the session. self._db.close() # Roll back all database changes that happened during this # test, whether in the session that was just closed or some # other session. self.transaction.rollback() # Remove any database objects cached in the model classes but # associated with the now-rolled-back session. Collection.reset_cache() ConfigurationSetting.reset_cache() DataSource.reset_cache() DeliveryMechanism.reset_cache() ExternalIntegration.reset_cache() Genre.reset_cache() Library.reset_cache() # Also roll back any record of those changes in the # Configuration instance. for key in [ Configuration.SITE_CONFIGURATION_LAST_UPDATE, Configuration.LAST_CHECKED_FOR_SITE_CONFIGURATION_UPDATE ]: if key in Configuration.instance: del (Configuration.instance[key]) if self.search_mock: self.search_mock.stop()
def test_gather_matching_genres(self): self.fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) self.urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) self.cooking, ig = Genre.lookup(self._db, classifier.Cooking) self.history, ig = Genre.lookup(self._db, classifier.History) # Fantasy contains three subgenres and is restricted to fiction. fantasy, default = Lane.gather_matching_genres( [self.fantasy], Lane.FICTION_DEFAULT_FOR_GENRE) eq_(4, len(fantasy)) eq_(True, default) fantasy, default = Lane.gather_matching_genres([self.fantasy], True) eq_(4, len(fantasy)) eq_(True, default) fantasy, default = Lane.gather_matching_genres([self.fantasy], True, [self.urban_fantasy]) eq_(3, len(fantasy)) eq_(True, default) # Attempting to create a contradiction (like nonfiction fantasy) # will create a lane broad enough to actually contain books fantasy, default = Lane.gather_matching_genres([self.fantasy], False) eq_(4, len(fantasy)) eq_(Lane.BOTH_FICTION_AND_NONFICTION, default) # Fantasy and history have conflicting fiction defaults, so # although we can make a lane that contains both, we can't # have it use the default value. assert_raises(UndefinedLane, Lane.gather_matching_genres, [self.fantasy, self.history], Lane.FICTION_DEFAULT_FOR_GENRE)
def teardown(self): # Close the session. self._db.close() # Roll back all database changes that happened during this # test, whether in the session that was just closed or some # other session. self.transaction.rollback() # Remove any database objects cached in the model classes but # associated with the now-rolled-back session. Collection.reset_cache() ConfigurationSetting.reset_cache() DataSource.reset_cache() DeliveryMechanism.reset_cache() ExternalIntegration.reset_cache() Genre.reset_cache() Library.reset_cache() # Also roll back any record of those changes in the # Configuration instance. for key in [ Configuration.SITE_CONFIGURATION_LAST_UPDATE, Configuration.LAST_CHECKED_FOR_SITE_CONFIGURATION_UPDATE ]: if key in Configuration.instance: del(Configuration.instance[key]) if self.search_mock: self.search_mock.stop()
def test_all_matching_genres(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) cooking, ig = Genre.lookup(self._db, classifier.Cooking) matches = Lane.all_matching_genres(self._db, [fantasy, cooking]) names = sorted([x.name for x in matches]) eq_([ u'Cooking', u'Epic Fantasy', u'Fantasy', u'Historical Fantasy', u'Urban Fantasy' ], names)
def test_from_description(self): """Create a LaneList from a simple description.""" lanes = LaneList.from_description( self._db, None, [dict( full_name="Fiction", fiction=True, audiences=Classifier.AUDIENCE_ADULT, ), classifier.Fantasy, dict( full_name="Young Adult", fiction=Lane.BOTH_FICTION_AND_NONFICTION, audiences=Classifier.AUDIENCE_YOUNG_ADULT, ), ] ) fantasy_genre, ignore = Genre.lookup(self._db, classifier.Fantasy.name) urban_fantasy_genre, ignore = Genre.lookup(self._db, classifier.Urban_Fantasy.name) fiction = lanes.by_languages['']['Fiction'] young_adult = lanes.by_languages['']['Young Adult'] fantasy = lanes.by_languages['']['Fantasy'] urban_fantasy = lanes.by_languages['']['Urban Fantasy'] eq_(set([fantasy, fiction, young_adult]), set(lanes.lanes)) eq_("Fiction", fiction.name) eq_(set([Classifier.AUDIENCE_ADULT]), fiction.audiences) eq_([], fiction.genre_ids) eq_(True, fiction.fiction) eq_("Fantasy", fantasy.name) eq_(set(), fantasy.audiences) expect = set(x.name for x in fantasy_genre.self_and_subgenres) eq_(expect, set(fantasy.genre_names)) eq_(True, fantasy.fiction) eq_("Urban Fantasy", urban_fantasy.name) eq_(set(), urban_fantasy.audiences) eq_([urban_fantasy_genre.id], urban_fantasy.genre_ids) eq_(True, urban_fantasy.fiction) eq_("Young Adult", young_adult.name) eq_(set([Classifier.AUDIENCE_YOUNG_ADULT]), young_adult.audiences) eq_([], young_adult.genre_ids) eq_(Lane.BOTH_FICTION_AND_NONFICTION, young_adult.fiction)
def test_custom_lanes_conflict_with_subgenre_sublanes(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) urban_fantasy_lane = Lane( self._db, "Urban Fantasy", genres=urban_fantasy) assert_raises(UndefinedLane, Lane, self._db, "Fantasy", fantasy, genres=fantasy, audiences=Lane.AUDIENCE_YOUNG_ADULT, subgenre_behavior=Lane.IN_SUBLANES, sublanes=[urban_fantasy_lane] )
def _lane(self, display_name=None, library=None, parent=None, genres=None, languages=None, fiction=None): display_name = display_name or self._str library = library or self._default_library lane, is_new = get_one_or_create( self._db, Lane, library=library, parent=parent, display_name=display_name, create_method_kwargs=dict(fiction=fiction)) if is_new and parent: lane.priority = len(parent.sublanes) - 1 if genres: if not isinstance(genres, list): genres = [genres] for genre in genres: if isinstance(genre, basestring): genre, ignore = Genre.lookup(self._db, genre) lane.genres.append(genre) if languages: if not isinstance(languages, list): languages = [languages] lane.languages = languages return lane
def load_genres(): """Load genres into a separate table.""" print "Genres" Genre.query.delete() with open('seed_data/ign.csv') as csvfile: game_data = reader(csvfile, dialect='excel') next(game_data) for row in game_data: genres = row[6] genre_types = genres.split(',') for genre_type in genre_types: if Genre.query.filter(Genre.genre_type == genre_type).first() or "": pass else: genre = Genre(genre_type=genre_type) db.session.add(genre) db.session.commit()
def create_genre(genre): genre = Genre(genre=genre) db.session.add(genre) db.session.commit() return genre
def test_get_search_target(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) lane = Lane( self._db, "YA Fantasy", genres=fantasy, languages='eng', audiences=Lane.AUDIENCE_YOUNG_ADULT, age_range=[15,16], subgenre_behavior=Lane.IN_SUBLANES ) sublanes = lane.sublanes.lanes names = sorted([x.name for x in sublanes]) eq_(["Epic Fantasy", "Historical Fantasy", "Urban Fantasy"], names) # To start with, none of the lanes are searchable. eq_(None, lane.search_target) eq_(None, sublanes[0].search_target) # If we make a lane searchable, suddenly there's a search target. lane.searchable = True eq_(lane, lane.search_target) # The searchable lane also becomes the search target for its # children. eq_(lane, sublanes[0].search_target)
def load_genre(cls, _db, descriptor): """Turn some kind of genre descriptor into a (Genre, GenreData) 2-tuple. The descriptor might be a 2-tuple, a 3-tuple, a Genre object or a GenreData object. """ if isinstance(descriptor, tuple): if len(descriptor) == 2: genre, subgenres = descriptor else: genre, subgenres, audience_restriction = descriptor else: genre = descriptor if isinstance(genre, GenreData): genredata = genre else: if isinstance(genre, Genre): genre_name = genre.name else: genre_name = genre # It's in the database--just make sure it's not an old entry # that shouldn't be in the database anymore. genredata = classifier.genres.get(genre_name) if not isinstance(genre, Genre): genre, ignore = Genre.lookup(_db, genre) return genre, genredata
def _lane(self, display_name=None, library=None, parent=None, genres=None, languages=None, fiction=None ): display_name = display_name or self._str library = library or self._default_library lane, is_new = create( self._db, Lane, library=library, parent=parent, display_name=display_name, fiction=fiction ) if is_new and parent: lane.priority = len(parent.sublanes)-1 if genres: if not isinstance(genres, list): genres = [genres] for genre in genres: if isinstance(genre, basestring): genre, ignore = Genre.lookup(self._db, genre) lane.genres.append(genre) if languages: if not isinstance(languages, list): languages = [languages] lane.languages = languages return lane
def create_new_movie(imdb_id, movie_url, imdb_rating, title, plot, release_date, poster_img, genres): '''Create new movie row in DB, returns Movie object genres =[Genre1, Genre2...]''' #create instance of new movie new_movie = Movie(imdb_id=imdb_id, movie_url=movie_url, imdb_rating=imdb_rating, title=title, plot=plot, usa_release_date=release_date, poster_img=poster_img, genres= []) #fetching existing genres in DB genres_tpl = db.session.query(Genre.genre_title).all() #adding new genres to DB and add all genres to new movie for genre in genres: if (genre, ) not in genres_tpl: #create new genre object new_genre = Genre(genre_title=genre) else: #fetching genre object for genre existing in DB new_genre = Genre.query.filter_by(genre_title=genre).one() new_movie.genres.append(new_genre) db.session.add(new_movie) db.session.commit() return new_movie
def test_gather_matching_genres(self): self.fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) self.urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) self.cooking, ig = Genre.lookup(self._db, classifier.Cooking) self.history, ig = Genre.lookup(self._db, classifier.History) # Fantasy contains three subgenres and is restricted to fiction. fantasy, default = Lane.gather_matching_genres( self._db, [self.fantasy], Lane.FICTION_DEFAULT_FOR_GENRE) eq_(4, len(fantasy)) eq_(True, default) fantasy, default = Lane.gather_matching_genres(self._db, [self.fantasy], True) eq_(4, len(fantasy)) eq_(True, default) fantasy, default = Lane.gather_matching_genres(self._db, [self.fantasy], True, [self.urban_fantasy]) eq_(3, len(fantasy)) eq_(True, default) # If there are only exclude_genres available, then it and its # subgenres are ignored while every OTHER genre is set. genres, default = Lane.gather_matching_genres(self._db, [], True, [self.fantasy]) eq_(False, any([g for g in self.fantasy.self_and_subgenres if g in genres])) # According to known fiction status, that is. eq_(True, all([g.default_fiction == True for g in genres])) # Attempting to create a contradiction (like nonfiction fantasy) # will create a lane broad enough to actually contain books fantasy, default = Lane.gather_matching_genres(self._db, [self.fantasy], False) eq_(4, len(fantasy)) eq_(Lane.BOTH_FICTION_AND_NONFICTION, default) # Fantasy and history have conflicting fiction defaults, so # although we can make a lane that contains both, we can't # have it use the default value. assert_raises(UndefinedLane, Lane.gather_matching_genres, self._db, [self.fantasy, self.history], Lane.FICTION_DEFAULT_FOR_GENRE)
def new_genre(): """ Add new genre """ if request.method == 'POST': genre_item = Genre(name=request.form['name']) db.session.add(genre_item) db.session.commit() return redirect(url_for('show_collection'))
def create_genre(genre_id, genre_name): """Create and return a genre.""" genre = Genre(genre_id=genre_id, genre_name=genre_name) db.session.add(genre) db.session.commit() return genre
def test_visible_parent(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) sublane = Lane( self._db, "Urban Fantasy", genres=urban_fantasy) invisible_parent = Lane( self._db, "Fantasy", invisible=True, genres=fantasy, sublanes=[sublane], subgenre_behavior=Lane.IN_SAME_LANE) visible_grandparent = Lane( self._db, "English", sublanes=[invisible_parent], subgenre_behavior=Lane.IN_SAME_LANE) eq_(sublane.visible_parent(), visible_grandparent) eq_(invisible_parent.visible_parent(), visible_grandparent) eq_(visible_grandparent.visible_parent(), None)
def load_movies(): """Load movies from u.item into database.""" print("Movies") Movie.query.delete() genre_list = [] with open("seed_data/movies_metadata.csv", newline='') as csvfile: reader = csv.DictReader(csvfile) for row in reader: genre_list = [] if row['title'] in (None, ""): continue else: title = row['title'] genres = row['genres'] genres = eval(genres) for genre in genres: genre_id = genre['id'] genre_name = genre['name'] exists = Genre.query.get(genre_id) if exists == None: new_genre = Genre(genre_id=genre_id, gname=genre_name) genre_list.append(new_genre) db.session.add(new_genre) else: genre_list.append(exists) continue imdb_id = row['imdb_id'] plot = row['overview'] if row['poster_path'] in (None, ""): continue else: poster = 'https://image.tmdb.org/t/p/w500' + row['poster_path'] if row['release_date'] in (None, ""): continue else: released_at = row['release_date'][:4] movie = Movie(imdb_id=imdb_id, title=title, plot=plot, released_at=released_at, poster=poster) movie.genres.extend(genre_list) db.session.add(movie) db.session.commit() print("Successfully added all movies")
def add_genre(): name = request.form.get('name') try: gnr = Genre(name=name) db.session.add(gnr) db.session.commit() except Exception: flash('') return redirect(url_for('genre')) return redirect(url_for('genre'))
def create_genre(name): current_user_id = get_current_user_id() if not current_user_id: return False genre = get_genre_by_name(name) if genre: return genre genre = Genre(name=name, owner_id=current_user_id) session.add(genre) session.commit() return genre
def test_visible_ancestors(self): fantasy, ig = Genre.lookup(self._db, classifier.Fantasy) urban_fantasy, ig = Genre.lookup(self._db, classifier.Urban_Fantasy) lane = Lane( self._db, "Urban Fantasy", genres=urban_fantasy) visible_parent = Lane( self._db, "Fantasy", genres=fantasy, sublanes=[lane], subgenre_behavior=Lane.IN_SAME_LANE) invisible_grandparent = Lane( self._db, "English", invisible=True, sublanes=[visible_parent], subgenre_behavior=Lane.IN_SAME_LANE) visible_ancestor = Lane( self._db, "Books With Words", sublanes=[invisible_grandparent], subgenre_behavior=Lane.IN_SAME_LANE) eq_(lane.visible_ancestors(), [visible_parent, visible_ancestor])
def load_genres(): """Load genres into db""" print("Genres") # Delete row to avoid duplicates Genre.query.delete() for row in (open('data/genres.csv')): new_genre = Genre(genre=row) db.session.add(new_genre) db.session.commit()
def add_genre(name): """Adds genres to the database.""" genre = Genre(name=name) # Add to the session. db.session.add(genre) # Commit the session/data to the dbase. db.session.commit() return genre.genre_id
def seed_genres(): genre_file = open("seed_data/comic_genres.txt") # Open file for line in genre_file: #split into strings line = line.rstrip() genre = Genre(genre=line) db.session.add(genre) db.session.commit() print "Genres seeded " genre_file.close()
def load_genres(): """Load list of starting genres from file""" print "Genres" Genre.query.delete() for row in open("seed_data/genres.txt"): row = row.rstrip() genre = Genre(genre=str(row)) db.session.add(genre) db.session.commit()
def load_genres(): """Load genres from genres.txt into database""" """delete info in case this is run twice, won't dupe data""" Genre.query.delete() for row in open("seed_data/genres.txt"): row = row.rstrip() genre_id, name = row.split("|") genre = Genre(genre_id=genre_id, name=name) db.session.add(genre) db.session.commit()
def load_genres(file_name): """Loads genres into db.""" file_obj = open(file_name) for line in file_obj: row = line.split(" ") genre_id = row[0] genre_name = row[1].rstrip() #Connects data from Genres.txt to variables in the genre table genre = Genre(genre_id=genre_id, genre_name=genre_name) #Adds the Genre to the genres table in the database. db.session.add(genre) db.session.commit()
def load_genres(): """Load genres from genre.txt into database.""" print "Genres" for i, name in enumerate(open("data/genre.txt")): name = name.rstrip() genre = Genre(name=name) # Add to the session. db.session.add(genre) # Commit the session/data to the dbase. db.session.commit()
def load_genres(genre_filename): """Load users from u.user into database.""" print("Genres") for i, row in enumerate(open(genre_filename)): row = row.rstrip() genre_id, name = row.split("|") genre = Genre(genre_id=int(genre_id), name=name) # We need to add to the session or it won't ever be stored db.session.add(genre) # Once we're done, we should commit our work db.session.commit()
def _work(self, title=None, authors=None, genre=None, language=None, audience=None, fiction=True, with_license_pool=False, with_open_access_download=False, quality=0.5, series=None, presentation_edition=None, collection=None, data_source_name=None): """Create a Work. For performance reasons, this method does not generate OPDS entries or calculate a presentation edition for the new Work. Tests that rely on this information being present should call _slow_work() instead, which takes more care to present the sort of Work that would be created in a real environment. """ pools = [] if with_open_access_download: with_license_pool = True language = language or "eng" title = unicode(title or self._str) audience = audience or Classifier.AUDIENCE_ADULT if audience == Classifier.AUDIENCE_CHILDREN and not data_source_name: # TODO: This is necessary because Gutenberg's childrens books # get filtered out at the moment. data_source_name = DataSource.OVERDRIVE elif not data_source_name: data_source_name = DataSource.GUTENBERG if fiction is None: fiction = True new_edition = False if not presentation_edition: new_edition = True presentation_edition = self._edition( title=title, language=language, authors=authors, with_license_pool=with_license_pool, with_open_access_download=with_open_access_download, data_source_name=data_source_name, series=series, collection=collection, ) if with_license_pool: presentation_edition, pool = presentation_edition if with_open_access_download: pool.open_access = True pools = [pool] else: pools = presentation_edition.license_pools work, ignore = get_one_or_create( self._db, Work, create_method_kwargs=dict( audience=audience, fiction=fiction, quality=quality), id=self._id) if genre: if not isinstance(genre, Genre): genre, ignore = Genre.lookup(self._db, genre, autocreate=True) work.genres = [genre] work.random = 0.5 work.set_presentation_edition(presentation_edition) if pools: # make sure the pool's presentation_edition is set, # bc loan tests assume that. if not work.license_pools: for pool in pools: work.license_pools.append(pool) for pool in pools: pool.set_presentation_edition() # This is probably going to be used in an OPDS feed, so # fake that the work is presentation ready. work.presentation_ready = True work.calculate_opds_entries(verbose=False) return work
def get(self): if not auth_admin(): self.response.out.write("Acesso negado") return logging.error("Recriando a tabela de generos") classica = Genre(id=16, name='Classica', bands=[113188, 808615, 339774, 1195728, 39303, 313967, 1281661, 1052575, 1418803, 1277278, 1489418, 1463301, 133680, 1620949, 1651907, 1608536, 501288, 1618233, 1633169, 783825, 1266364, 1717490, 1666056, 1716718, 1393156, 1738858, 1628526, 1669886, 1779793, 1798078, 1715270, 1708060, 1746029, 1799192, 1796946, 1206821, 1206460, 256866, 1792370, 1847960, 1839493, 1853756, 1657350, 259537, 1378877, 1374360, 1843422, 1882197, 1890789, 1802124, 1663947, 1868661, 1846493, 1658152, 1838241, 1729907, 1850868], lastUpdate=datetime.date.today()) classica.put() latina = Genre(id=17, name='Latina', bands=[948336, 894957, 104252, 165655, 329990, 1014075, 44674, 223858, 220085, 1642306, 1610108, 819632, 1654512, 61109, 187271, 1681099, 871890, 1247081, 1612914], lastUpdate=datetime.date.today()) latina.put() modernrock = Genre(id=4, name='Modern Rock', bands=[59459, 237592, 494751, 459617, 582172, 47124, 1485900, 287309, 1346842, 88786, 792062, 932064, 225831, 95601, 794125, 649206, 94328, 214999, 76251, 779202, 517415, 1083916, 197107, 69990, 995032, 729200, 1701373, 136804, 1141297, 1524696, 1155149, 18098, 501642, 709839, 148237, 36914, 1674139, 750834, 1619704, 1057074, 1623540, 1193499, 1614002, 131517, 1732778, 1837308, 34732, 1091828, 255687, 371271, 440039, 726273, 1251433], lastUpdate=datetime.date.today()) modernrock.put() heavymetal = Genre(id=5, name='Heavy Metal', bands=[685621, 184355, 1604461, 40495, 130432, 124776, 497259, 883774, 51111, 353585, 42927, 746451, 833908, 42958, 54572, 890871, 1549561, 136816, 1553909, 1507013, 1522802, 741261, 1142787, 1158539, 1111306, 94964, 465392, 254192, 1228187, 1190663, 1021031, 1687974, 577080, 1545119, 531902, 214263, 1494750, 1492071, 1387141, 648662, 614310, 479483, 1403380, 1711639, 373429, 413933, 115212, 1652129, 935858, 1060418, 1214004, 1167355, 72611, 918372, 999661, 29046, 379063, 885557, 1880504], lastUpdate=datetime.date.today()) heavymetal.put() eletronica = Genre(id=7, name='Eletronica', bands=[209379, 902742, 1188719, 129130, 93848, 828030, 1306258, 883108, 1476371, 1404501, 953840, 520897, 1338341, 1411183, 635238, 1517085, 249924, 532295, 1639623, 457800, 477559, 387106, 59564, 120854, 887093, 147319, 898091, 451098, 1685021, 1214895, 1367600, 1142771, 1204371, 906371, 1722167, 1727614, 1261678, 1031179, 1689196, 1761628, 1520601, 305199, 780831, 926863, 1295958, 1705741, 1131026, 1554098, 1374478, 581120, 794062, 805432, 1635713, 665196, 1332974, 1510957, 407875], lastUpdate=datetime.date.today()) eletronica.put() pop = Genre(id=8, name='Pop', bands=[49096, 543264, 424075, 42324, 1534850, 376842, 469749, 142508, 264133, 1352680, 279057, 1415253, 1459182, 1498991, 1392869, 1038625, 452107, 1567962, 596419, 532662, 551198, 492602, 1370384, 1131420, 1578977, 230885, 890882, 51666, 1628578, 34275, 1645681, 1904870, 1260489, 76291, 1226188, 1522284, 565190], lastUpdate=datetime.date.today()) pop.put() world = Genre(id=12, name='World Music', bands=[93014, 295590, 1797759, 450556, 263800, 1790913, 1404594, 617137, 429012, 773158, 1764394, 59669, 1798452, 777282, 1071578, 544695, 39705, 1263694, 1648063, 287790, 1749992, 1890314, 172247, 1541540, 97115, 930819, 654910, 1769748, 1036208, 1149655, 1808471, 1854504, 1374513, 921654, 37278, 416066, 314006, 701929, 1781690, 1656243, 1876029, 1775571, 1688965], lastUpdate=datetime.date.today()) world.put() rock = Genre(id=3, name='Rock', bands=[88342, 104937, 668859], lastUpdate=datetime.date.today()) rock.put() country = Genre(id=13, name='Country', bands=[878064, 1161118, 460406, 420654, 1736000, 111160, 416977, 432889, 1559517, 1639868, 1785986, 683930, 1706062, 1663974, 1710956, 1255329, 1672775, 1636417, 1043343, 1734123], lastUpdate=datetime.date.today()) country.put() flamenco = Genre(id=19, name='Flamenco', bands=[1239460, 1679342, 1169799, 1435443, 1021031, 1569030, 966987, 1235226, 1874444, 1181254, 1294504, 1110324, 1894517, 1898061, 1145421, 1550637, 1896162, 1670356], lastUpdate=datetime.date.today()) flamenco.put() punk = Genre(id=6, name='Punk Rock', bands=[285550, 198612, 43886, 1090139, 1253380, 94869, 1004668, 444071, 713094, 445527, 1212123, 1064185, 1686531, 777304, 59007, 497141, 1890722, 895187], lastUpdate=datetime.date.today()) punk.put() blues = Genre(id=15, name='Blues', bands=[1114453, 325886, 22358, 908492, 471296, 1408613, 1141973, 1553171, 769437, 1775046, 1553743, 206950, 1260693, 332666, 65634, 314096, 1008820, 765669, 1668154, 798157, 832935, 497624, 443553, 1803588, 1677193, 32635, 1322332, 625994, 580518, 1534005], lastUpdate=datetime.date.today()) blues.put() hiphop = Genre(id=9, name='Hip Hop', bands=[1408987, 1145465, 1888438, 469586, 1735906, 1775030, 537511, 724094, 486917, 635223, 1531885, 1256116, 121814, 1191277, 1781066, 1870652, 1539448, 1610234, 134068, 889270, 1656068, 1364480, 1839483], lastUpdate=datetime.date.today()) hiphop.put() rb = Genre(id=10, name='R&B', bands=[1402222, 1191044, 1671295, 1850711, 1795504, 568320, 1527471, 1533552, 1500414, 1876910], lastUpdate=datetime.date.today()) rb.put() jazz = Genre(id=14, name='Jazz', bands=[521474, 1915216, 66804, 895252, 218507, 979008, 487234, 88789, 641607, 1384114, 1407160, 26863, 1049948 , 664754, 254600, 1030796, 1834523, 1703631, 1418047, 1347204, 1371232 , 850752, 341800, 1518575, 229055, 939292, 586520, 1894212, 41474, 1825807], lastUpdate=datetime.date.today()) jazz.put() african = Genre(id=18, name='Africana', bands=[586072, 333107, 1928978, 1885961, 1817342, 1878518, 1763279, 1937240, 1570136, 1911668, 1872755, 119850, 1694527, 754481, 1951271, 1971304, 1907179, 1917160, 79110, 1854233], lastUpdate=datetime.date.today()) african.put() reggae = Genre(id=11, name='Reggae', bands=[682385, 834788, 277537, 1617800, 1821623], lastUpdate=datetime.date.today()) reggae.put() teste = Genre(id=1, name='Teste', bands=[1,2], lastUpdate=datetime.date.today()) teste.put()