Esempio n. 1
0
    def GET(self, command = None, id = None):
        if command == None:
            print '\n** Main movie page\n'
            return send_page(self, movie_pages.main_page())

        elif command == 'genre':
            if id == None:
                print '\n** Listing all genres\n'
                return send_page(self, movie_pages.genre_page())

            else:
                print '\n** Listing all movies in genre ID: %s\n' % id
                title = media_db.get_genre_name(id)
                return send_page(self, movie_pages.film_grid(genre=id, title=title))

        elif command == 'favorite':
            print '\n** Listing favorite movies\n'
            return send_page(self, movie_pages.film_grid(favorite=True, title='Favorites'))

        elif command == 'all':
            print '\n** Listing all movies\n'
            return send_page(self, movie_pages.film_grid())

        elif command == 'detail':
            print '\n** Movie detail, id %s' % id
            return send_page(self, movie_pages.detail(id))

        elif command == 'play':
            print '\n** Play movie id %s' % id
            return send_page(self, movie_pages.play_movie(id))
Esempio n. 2
0
    def GET(self, command = None, id = None):
        if id == None:
            print "\n** Playing media, but no id received\n"
        
        elif command == 'play':
            media = media_db.get_item(id)
            filename = media['filename']

            return serve_file(filename, content_type = 'video/mp4')

        elif command == 'toggle_favorite':
            print "\n** Toggling favorite for media id %s" % id
            media_db.toggle_favorite(id)
            return send_page(self, movie_pages.detail(id))