Ejemplo n.º 1
0
 def get(self):
     an = models.ArtistName.all().fetch(2000)
     total = 0
     try:
         for a in an:
             if not a.search_names:
                 total += 1
                 a.search_names = models.artistSearchName(a.lowercase_name).split()
                 a.put()
         self.response.out.write("converted %d artist names." % total)
     except DeadlineExceededError:
         self.response.out.write("converted %d artist names, incomplete." % total)
Ejemplo n.º 2
0
 def get(self):
     an = models.ArtistName.all().fetch(2000)
     total = 0
     try:
         for a in an:
             if not a.search_names:
                 total += 1
                 a.search_names = models.artistSearchName(
                     a.lowercase_name).split()
                 a.put()
         self.response.out.write("converted %d artist names." % total)
     except DeadlineExceededError:
         self.response.out.write("converted %d artist names, incomplete." %
                                 total)
Ejemplo n.º 3
0
def tryPutArtist(artist_name):
  # See if the artist is in the datastore already
  key = getArtistKey(artist_name)
  if key:
    # We have a new album, so we might as well memcache the artist.
    return getArtist(key)
  
  artist = models.ArtistName(
    artist_name=artist_name,
    lowercase_name=artist_name.lower(),
    search_names=models.artistSearchName(artist_name).split())
  artist.put()
  mcset(artist, ARTIST_ENTRY, artist.key())
  injectArtistAutocomplete(artist)
  return artist
Ejemplo n.º 4
0
 def get(self):
     labels = [
         "Manage DJs", "Manage Programs", "Manage Permissions",
         "Manage Albums", "Manage Genres", "Manage Blog", "Manage Events"
     ]
     for l in labels:
         if not models.getPermission(l):
             permission = models.Permission(title=l, dj_list=[])
             permission.put()
     seth = models.getDjByEmail("*****@*****.**")
     if not seth:
         seth = models.Dj(fullname='Seth Glickman',
                          lowername='seth glickman',
                          email='*****@*****.**',
                          username='******',
                          password_hash=hash_password('testme'))
         seth.put()
         program = models.Program(
             title='Seth\'s Show',
             slug='seth',
             desc='This is the show where Seth plays his favorite music.',
             dj_list=[seth.key()],
             page_html='a <b>BOLD</b> show!')
         program.put()
     for l in labels:
         permission = models.getPermission(l)
         if seth.key() not in permission.dj_list:
             permission.dj_list.append(seth.key())
             permission.put()
     if not models.getLastPosts(3):
         post1 = models.BlogPost(
             title="Blog's first post!",
             text="This is really just filler text on the first post.",
             slug="first-post",
             post_date=datetime.datetime.now())
         post1.put()
         time.sleep(2)
         post2 = models.BlogPost(title="Blog's second post!",
                                 text="More filler text, alas.",
                                 slug="second-post",
                                 post_date=datetime.datetime.now())
         post2.put()
     artists = [
         "Bear In Heaven",
         "Beck",
         "Arcade Fire",
         "Andrew Bird",
         "The Antlers",
         "Arcade Fire",
         "The Beach Boys",
         "Brian Wilson",
         "The Beatles",
         "Beethoven",
         "Beirut",
         "Belle & Sebastian",
         "Benji Hughes",
         "Club 8",
         "Crayon Fields",
     ]
     for a in artists:
         if not models.ArtistName.all().filter("artist_name =", a).fetch(1):
             ar = models.ArtistName(
                 artist_name=a,
                 lowercase_name=a.lower(),
                 search_names=models.artistSearchName(a).split())
             ar.put()
     self.session.add_flash(
         "Permissions set up, ArtistNames set up, Blog posts set up, DJ Seth entered."
     )
     self.redirect('/')
Ejemplo n.º 5
0
 def get(self):
     labels = [
         "Manage DJs",
         "Manage Programs",
         "Manage Permissions",
         "Manage Albums",
         "Manage Genres",
         "Manage Blog",
         "Manage Events",
     ]
     for l in labels:
         if not models.getPermission(l):
             permission = models.Permission(title=l, dj_list=[])
             permission.put()
     seth = models.getDjByEmail("*****@*****.**")
     if not seth:
         seth = models.Dj(
             fullname="Seth Glickman",
             lowername="seth glickman",
             email="*****@*****.**",
             username="******",
             password_hash=hash_password("testme"),
         )
         seth.put()
         program = models.Program(
             title="Seth's Show",
             slug="seth",
             desc="This is the show where Seth plays his favorite music.",
             dj_list=[seth.key()],
             page_html="a <b>BOLD</b> show!",
         )
         program.put()
     for l in labels:
         permission = models.getPermission(l)
         if seth.key() not in permission.dj_list:
             permission.dj_list.append(seth.key())
             permission.put()
     if not models.getLastPosts(3):
         post1 = models.BlogPost(
             title="Blog's first post!",
             text="This is really just filler text on the first post.",
             slug="first-post",
             post_date=datetime.datetime.now(),
         )
         post1.put()
         time.sleep(2)
         post2 = models.BlogPost(
             title="Blog's second post!",
             text="More filler text, alas.",
             slug="second-post",
             post_date=datetime.datetime.now(),
         )
         post2.put()
     artists = [
         "Bear In Heaven",
         "Beck",
         "Arcade Fire",
         "Andrew Bird",
         "The Antlers",
         "Arcade Fire",
         "The Beach Boys",
         "Brian Wilson",
         "The Beatles",
         "Beethoven",
         "Beirut",
         "Belle & Sebastian",
         "Benji Hughes",
         "Club 8",
         "Crayon Fields",
     ]
     for a in artists:
         if not models.ArtistName.all().filter("artist_name =", a).fetch(1):
             ar = models.ArtistName(
                 artist_name=a, lowercase_name=a.lower(), search_names=models.artistSearchName(a).split()
             )
             ar.put()
     self.session.add_flash("Permissions set up, ArtistNames set up, Blog posts set up, DJ Seth entered.")
     self.redirect("/")