Exemplo n.º 1
0
 def complete(self):
     try:
         make_meta_files(self.announce_url, self.file_list, self.flag,
                         self.set_progress_value, self.set_file,
                         self.piece_length)
         if not self.flag.isSet():
             self.set_title('Done.')
             self.label.set_text('Done building torrents.')
             self.set_progress_value(1)
             self.action_area.remove(self.cancelbutton)
             self.action_area.pack_start(self.done_button)
             self.done_button.show()
     except (OSError, IOError), e:
         self.set_title('Error!')
         self.label.set_text('Error building torrents: ' + str(e))
Exemplo n.º 2
0
 def complete(self):
     try:
         make_meta_files(self.announce_url,
                     self.file_list,
                     self.flag,
                     self.set_progress_value,
                     self.set_file,
                     self.piece_length)
         if not self.flag.isSet():
             self.set_title('Done.')
             self.label.set_text('Done building torrents.')
             self.set_progress_value(1)
             self.action_area.remove(self.cancelbutton)
             self.action_area.pack_start(self.done_button)
             self.done_button.show()
     except (OSError, IOError), e:
         self.set_title('Error!')
         self.label.set_text('Error building torrents: ' + str(e))
Exemplo n.º 3
0
    ('comment', '',
        "optional human-readable comment to put in .torrent"),
    ('target', '',
        "optional target file for the torrent"),
    ('filesystem_encoding', '',
     "character encoding used on the local filesystem. If left empty, autodetected. Autodetection doesn't work under python versions older than 2.3.")
    ]


def dc(v):
    print v

def prog(amount):
    print '%.1f%% complete\r' % (amount * 100),

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        printHelp('btmaketorrent', defaults)
    else:
        try:
            config, args = parseargs(sys.argv[1:], defaults, 2, None)
            print config
            print args
            if len(sys.argv) == 3:
                make_meta_files(args[0], args[1:], piece_len_pow2=config['piece_size_pow2'], progressfunc=prog, filefunc=dc, comment=config['comment'], target=config['target'], filesystem_encoding=config['filesystem_encoding'])
            else:
                make_meta_files(args[0], args[2:], piece_len_pow2=config['piece_size_pow2'], progressfunc=prog, filefunc=dc, comment=config['comment'], target=config['target'], filesystem_encoding=config['filesystem_encoding'])
        except BTFailure, e:
            print str(e)
            sys.exit(1)
Exemplo n.º 4
0

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        printHelp('btmaketorrent', defaults)
    else:
        try:
            config, args = parseargs(sys.argv[1:], defaults, 2, None)
            print config
            print args
            if len(sys.argv) == 3:
                make_meta_files(
                    args[0],
                    args[1:],
                    piece_len_pow2=config['piece_size_pow2'],
                    progressfunc=prog,
                    filefunc=dc,
                    comment=config['comment'],
                    target=config['target'],
                    filesystem_encoding=config['filesystem_encoding'])
            else:
                make_meta_files(
                    args[0],
                    args[2:],
                    piece_len_pow2=config['piece_size_pow2'],
                    progressfunc=prog,
                    filefunc=dc,
                    comment=config['comment'],
                    target=config['target'],
                    filesystem_encoding=config['filesystem_encoding'])
        except BTFailure, e: