Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(5)  |  Derive(0)  |  Import(5)
Make a single .torrent file for a given location

        def make_meta_file(loc, url, params=None, flag=None,
                   progress=lambda x: None, progress_percent=True):
    """Make a single .torrent file for a given location"""
    if params is None:
        params = {}
    if flag is None:
        flag = threading.Event()

    tree = BTTree(loc, [])

    # Extract target from parameters
    if 'target' not in params or params['target'] == '':
        fname, ext = os.path.split(loc)
        if ext == '':
            target = fname + '.torrent'
        else:
            target = os.path.join(fname, ext + '.torrent')
        params['target'] = target

    info = tree.makeInfo(flag=flag, progress=progress,
                         progress_percent=progress_percent, **params)

    if flag is not None and flag.isSet():
        return

    metainfo = MetaInfo(announce=url, info=info, **params)
    metainfo.write(params['target'])
        


src/b/i/BitTornado-HEAD/btmaketorrentgui.py   BitTornado(Download)
import os
import threading
from BitTornado.BT1.makemetafile import make_meta_file, completedir
from BitTornado.Info import MetaInfo
try:
                            self.valcallback, self.filecallback)
            else:
                make_meta_file(self.d, self.a, self.params, self.flag,
                               self.valcallback, progress_percent=1)
            if not self.flag.isSet():

src/f/r/FriendlyTorrent-HEAD/src/tornado/btmakemetafile.py   FriendlyTorrent(Download)
from os.path import split
assert version >= '2', "Install Python 2.0 or greater"
from BitTornado.BT1.makemetafile import make_meta_file, defaults, print_announcelist_details
from BitTornado.parseargs import parseargs, formatDefinitions
 
    config, args = parseargs(argv[1:], defaults, 2, None)
    for file in args[1:]:
        make_meta_file(file, args[0], config, progress = prog)
except ValueError, e:
    print 'error: ' + str(e)

src/b/i/BitTornado-HEAD/bt-t-make.py   BitTornado(Download)
import threading
import traceback
from BitTornado.BT1.makemetafile import make_meta_file
from BitTornado.Info import MetaInfo
 
    def complete(self):
        try:
            make_meta_file(self.d, self.a, self.params, self.uiflag,
                           self.call.build_setgauge, progress_percent=1)
            if not self.uiflag.isSet():

src/b/i/BitTornado-HEAD/btmakemetafile.py   BitTornado(Download)
import sys
import os
from BitTornado.BT1.makemetafile import make_meta_file, defaults, \
    announcelist_details
from BitTornado.parseargs import parseargs, formatDefinitions
        config, args = parseargs(argv[1:], defaults, 2, None)
        for file in args[1:]:
            make_meta_file(file, args[0], config.copy(), progress=prog)
    except ValueError as e:
        print 'error: ' + str(e)

src/s/w/swarm-HEAD/swarm/torrent.py   swarm(Download)
from BitTornado.BT1.makemetafile import make_meta_file
from swarm import output
 
 
def make_torrent(source_file, torrent_file, tracker):
    """Creates torrent meta file."""
    make_meta_file(source_file, 'http://%s/announce' % tracker, {