def open_json_dur_file(f, appState):
    """ Loads json file into opts and movie objects.  Takes an open file
    object. Returns the opts and mov objects, encased in a list object.
     Or return False if the open fails.
    """
    f.seek(0)
    try:
        loadedMovieData = json.load(f)
    except Exception as e:
        return False

    width = loadedMovieData['DurMovie']['sizeX']
    height = loadedMovieData['DurMovie']['sizeY']
    colorMode = loadedMovieData['DurMovie']['colorFormat']
    newOpts = Options(width=width, height=height)
    newOpts.framerate = loadedMovieData['DurMovie']['framerate']
    newOpts.saveFileFormat = loadedMovieData['DurMovie']['formatVersion']
    # load frames into a new movie object
    newMov = Movie(newOpts)
    currentFrame = 0
    lineNum = 0
    for frame in loadedMovieData['DurMovie']['frames']:
        #newMov.insertCloneFrame()
        newMov.addEmptyFrame()
        newMov.nextFrame()
        for line in frame['contents']:
            #pdb.set_trace()
            if lineNum < len(newMov.frames[currentFrame].content):
                newMov.frames[currentFrame].content[lineNum] = [c for c in line]
                #newMov.frames[currentFrame].content[lineNum] = [c for c in line.encode(appState.charEncoding)]
                #newMov.frames[currentFrame].content[lineNum] = [c for c in bytes(line).decode('cp437')]
            #newMov.frames[currentFrame].content = line
            lineNum += 1
        lineNum = 0
        # load color map into new movie
        #pdb.set_trace()
        for x in range(0, width):
            for y in range(0, height):
                #pdb.set_trace()
                colorPair = frame['colorMap'][x][y]
                if appState.colorMode == '16' and colorMode == '256':
                    # set a default color when down-converting color modes:
                    if colorPair[0] > 16:
                        colorPair = [8,0]
                #if newOpts.saveFileFormat < 6:
                #    colorPair = convert_old_color_to_new(oldColorPair)
                #    if colorPair == None:
                #        pdb.set_trace()
                newMov.frames[currentFrame].colorMap[y, x] = tuple(colorPair)
                newMov.frames[currentFrame].newColorMap[y][x] = colorPair
        # Add delay for the frame
        newMov.frames[currentFrame].delay = frame['delay']
        currentFrame += 1
        #pdb.set_trace()
    newMov.deleteCurrentFrame()
    newMov.gotoFrame(1)
    container = {'opts':newOpts, 'mov':newMov}
    return container
 Loads json file into opts and movie objects.  Takes an open file
    object. Returns the opts and mov objects, encased in a list object.
     Or return False if the open fails.
    
durdraw/durdraw_file.py