Example #1
0
def console():
    global path
    global user
    global comment
    global pause
    global duration
    global audioNum

    # [[[ 1. Update Playing Video ]]]
    if 0 != len(Book.List()) and False is pause:
        # < Can Play >
        if False is video.CheckPlaying():
            # < Not Playing >
            # [[ 1.1. Lock ]]
            lock.acquire()
            try:
                # [[ 1.2. Get and Update First Reservation ]]
                bookList = Book.List()[0]
                path = bookList[2]
                user = bookList[3]
                comment = bookList[4]
                dummy = bookList[8]
                audioIndex = int(bookList[7])
                duration = videoInfo.GetDuration(path)
                audioNum = videoInfo.GetAudioNum(path)
                # [[ 1.2. Check Dummy ]]
                if 0 == dummy:
                    # < Not Dummy >
                    # [ 1.2.1. Play Video ]
                    video.Open(path, vol, audioNum, audioIndex)
                    # [ 1.2.2. Add History ]
                    History.Add(path, user, comment)
                    # [ 1.2.3. Update pause status for playing ]
                    pause = False
                else:
                    # < Dummy >
                    # [ 1.2.4. Switch HDMI Signal ]
                    hdmi.Switch()
                    # [ 1.2.5. Update pause status for pausing ]
                    pause = True
            except:
                import traceback
                traceback.print_exc()
            finally:
                # [[ 1.3. Delete Playing Book ]]
                Book.Delete(bookList[0])
                # [[ 1.4. Unlock ]]
                lock.release()
Example #2
0
def delete():
    Book.Delete(int(request.query.bookId))
    redirect( \
      "/playlist?user=" + request.query.user)