Exemple #1
0
 def get(self, song_id):
     if utils.is_number(song_id):
         song = Song.get_by_id(int(song_id))
     if song:
         self.render("song.html", song=song, recordings=song.get_recordings(), edit_lyrics=True)
     else:
         self.error(404)
Exemple #2
0
 def get(self, song_id):
     if utils.is_number(song_id):
         song = Song.get_by_id(int(song_id))
     if song:
         self.render("recording.html", song=song)
     else:
         self.error(404)
Exemple #3
0
 def post(self, song_id):
     if utils.is_number(song_id):
         song = Song.get_by_id(int(song_id))
     if song:
         song.delete_self()
         self.redirect("/")
     else:
         self.error(404)
Exemple #4
0
 def post(self, song_id):
     if utils.is_number(song_id):
         song = Song.get_by_id(int(song_id))
     if song:
         lyrics = self.request.get("lyrics")
         song.set_lyrics(lyrics)
         self.redirect(song.get_url())
     else:
         self.error(404)
Exemple #5
0
    def get(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        if song and rec:
            self.render("recording.html", song=song, audiolink=rec.audiolink, performer=rec.performer)
        else:
            self.error(404)
Exemple #6
0
    def post(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        if song and rec:
            rec.delete_self()
            self.redirect(song.get_url())
        else:
            self.error(404)
Exemple #7
0
    def post(self, song_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if not song:
            self.error(404)

        audiolink = self.request.get("audiolink")
        performer = self.request.get("performer")
        if audiolink:
            song.add_recording(audiolink, performer)
            self.redirect("/song/%s" % str(song.key().id()))
        else:
            error = u"Линк не может быть пустым"
            self.render("recording.html", song=song, audiolink=audiolink, performer=performer, error=error)
Exemple #8
0
    def post(self, song_id, rec_id):
        if utils.is_number(song_id):
            song = Song.get_by_id(int(song_id))
        if song and utils.is_number(rec_id):
            rec = Recording.get_by_id(int(rec_id), parent=song.key())

        audiolink = self.request.get("audiolink")
        performer = self.request.get("performer")
        if audiolink:
            rec.update(audiolink, performer)
            self.redirect("/song/" + str(song.key().id()))
        else:
            error = u"Линк не может быть пустым"
            self.render("recording.html", song=song, audiolink=audiolink, performer=performer, error=error)