def restore_watched(plex, opts):
    """ Restore watched status from the specified filepath. """
    with open(opts.filepath, 'r') as handle:
        source = json.load(handle)
    # Find the differences
    differences = defaultdict(lambda: dict())
    for section in _iter_sections(plex, opts):
        print('Finding differences in %s..' % section.title)
        skey = section.title.lower()
        for item in _iter_items(section):
            ikey = _item_key(item)
            sval = source.get(skey,{}).get(ikey)
            if sval is None:
                raise SystemExit('%s not found' % ikey)
            if (sval is not None and item.isWatched != sval) and (not opts.watchedonly or sval):
                differences[skey][ikey] = {'isWatched':sval, 'item':item}
    print('Applying %s differences to destination' % len(differences))
    import pprint; pprint.pprint(differences)
Restore watched status from the specified filepath.