Beispiel #1
0
    ('tracker', 'http://127.0.0.1:6969/announce', 'tracker URL'),
    ('destdir', '.', 'dir to save torrent'),
    ('duration', '1:00:00', 'duration of the stream in hh:mm:ss format'),
    ('piecesize', 32768, 'transport piece size'),
    ('thumb', '', 'filename of image in JPEG format, preferably 171x96'),
    ('url', False, 'Create URL instead of torrent (cannot be used with thumb)')
]


def get_usage(defs):
    return parseargs.formatDefinitions(defs, 80)


if __name__ == "__main__":

    config, fileargs = parseargs.parseargs(sys.argv, argsdef, presets={})
    print >> sys.stderr, "config is", config

    if config['source'] == '':
        print "Usage:  ", get_usage(argsdef)
        sys.exit(0)

    if os.path.isdir(config['source']):
        raise ValueError(
            "Creating torrent from directory not yet supported, sorry!")

    tdef = TorrentDef()
    tdef.add_content(config['source'], playtime=config['duration'])
    tdef.set_tracker(config['tracker'])
    tdef.set_piece_length(config['piecesize'])  #TODO: auto based on bitrate?
Beispiel #2
0
        ClosedSwarm.write_poa_to_file(target_file)
        tf = target_file
    else:
        tf = ClosedSwarm.trivial_save_poa("./", decodestring(node_id), t.infohash, poa)
    
    print "Proof of access written to file '%s'"%tf

def get_usage(defs):
    print "Usage: ",sys.argv[0],"<torrentfile> [options]\n"
    print parseargs.formatDefinitions(defs,80)


if __name__ == "__main__":
    

    config, fileargs = parseargs.parseargs(sys.argv, defaults, presets = {})

    if len(fileargs) < 2:
        get_usage(defaults)
        raise SystemExit(1)
        
    torrent = fileargs[1]
    if not os.path.exists(torrent):
        print "Error: Could not find torrent file '%s'"%torrent
        raise SystemExit(1)
    
    if not config['key_file']:
        config['key_file'] = torrent + ".tkey"
        
    if not os.path.exists(config['key_file']):
        print "Error: Could not find key file '%s'"%config['key_file']
argsdef = [('source', '', 'source file or directory'),
           ('tracker', 'http://127.0.0.1:6969/announce', 'tracker URL'),
           ('destdir', '.','dir to save torrent'),
           ('duration', '1:00:00', 'duration of the stream in hh:mm:ss format'),           
           ('piecesize', 32768, 'transport piece size'),
           ('thumb', '', 'filename of image in JPEG format, preferably 171x96'),
           ('url', False, 'Create URL instead of torrent (cannot be used with thumb)')]


def get_usage(defs):
    return parseargs.formatDefinitions(defs,80)
    
    
if __name__ == "__main__":

    config, fileargs = parseargs.parseargs(sys.argv, argsdef, presets = {})
    print >>sys.stderr,"config is",config
    
    if config['source'] == '':
        print "Usage:  ",get_usage(argsdef)
        sys.exit(0)
        
    if os.path.isdir(config['source']):
        raise ValueError("Creating torrent from directory not yet supported, sorry!")
        
    tdef = TorrentDef()
    tdef.add_content(config['source'],playtime=config['duration'])
    tdef.set_tracker(config['tracker'])
    tdef.set_piece_length(config['piecesize']) #TODO: auto based on bitrate?
    
    if config['url']:
Beispiel #4
0
    poa = ClosedSwarm.create_poa(t.infohash, torrent_keypair, node_id)
    
    f = open(target_file, "wb")
    f.write(poa.serialize())

    print "Proof of access written to file '%s'"%target_file

def get_usage(defs):
    print "Usage: ",sys.argv[0],"<torrentfile> [options]\n"
    print parseargs.formatDefinitions(defs,80)


if __name__ == "__main__":
    

    config, fileargs = parseargs.parseargs(sys.argv, defaults, presets = {})

    if len(fileargs) < 2:
        get_usage(defaults)
        raise SystemExit(1)
        
    torrent = fileargs[1]
    if not os.path.exists(torrent):
        print "Error: Could not find torrent file '%s'"%torrent
        raise SystemExit(1)
    
    if not config['key_file']:
        config['key_file'] = torrent + ".tkey"
        
    if not os.path.exists(config['key_file']):
        print "Error: Could not find key file '%s'"%config['key_file']