#!/usr/bin/env python
import sys, os
import ncutils

#check syntax
import optparse
parser = optparse.OptionParser()
opts, args = parser.parse_args()
assert len(args) > 0

#config check
import json
confpath = os.path.expanduser(os.path.join( "~", ".ncutils"))
with open(confpath) as f:
    conf = json.load(f)

#do the work
assert ncutils.login(conf["username"], conf["password"])

for smid in args:
    try:
        video = ncutils.Video(smid)
        video.download()
    except:
        pass

