예제 #1
0
usage = Usage('''
    Mediaspace m3u8 extractor using Selenium
    
    :username str
        Illinois netid to use
    :password str
        Corresponding password for netid
    :-j --json
        Output as json lines
    :-t --title
        Output title of video
    :-q --quiet
        Hide status output
    ...
''')
usage.add_argument('mediaspace_urls', help='Mediaspace URLs to extract m3u8 from', nargs='*')
usage.add_argument('-m', '--metadata', type=json.loads, default={}, help='Extra json metadata to attach to each element')


def main():
    args = usage.parse()
    if not args.mediaspace_urls:
        return
    driver = shibboleth_get(args.username, args.password, args.mediaspace_urls[0], debug=not args.quiet)
    driver.implicitly_wait(10)
    metadatas = args.metadata
    if isinstance(metadatas, dict):
        metadatas = [metadatas] * len(args.mediaspace_urls)
    urls = deque(list(zip(args.mediaspace_urls, metadatas)))
    is_first = True
    while urls:
    :-v --trigger-volume float 0.9
        The average abnormality exceeded that is considered an activation. Between 0.0 and 1.0
    
    :-d --delay float 1.0
        The delay in seconds between subsequent activations
    
    :-b --bands str -
        A range/list of bands to listen for
    
    :-m --model str -
        A model file to use
    
    :-s --memory-size int 200
        Number of samples to save in memory
''')
detect_usage.add_argument('command', nargs='?', default='true', help='The command to run when noise is detected')
collect_usage = Usage('''
    Collect noise and save into a model
    
    :model str
        Noise model json file to write to
    
    :-b --bands str -
        A range/list of bands to listen for
''')


def add_subparsers(parser: ArgumentParser):
    sp = parser.add_subparsers(dest='action')
    sp.required = True
    detect_usage.apply(sp.add_parser('detect'))