def nonStaging(pac, cmdline, filename):
    if cmdline.list:
        pac.printInfo()
    elif cmdline.list_harder:
        pac.printDetailInfo()
    elif cmdline.file_info:
        file = pac.getFileById(cmdline.file_info)
        if file is not None:
            print("          id    offset       size  compress  size  filename")
            file.printDetailInfo()
    elif cmdline.extract_id:
        with open(filename, "rb") as binfile:
            idlist = map(int, cmdline.extract_id.split(","))
            if cmdline.raw:
                location = datastruct.adjustSeparatorForFS("raw-extract/")
                if cmdline.extract:
                    location = cmdline.extract
                for fid in idlist:
                    pac.dumpFileId(fid, location, binfile)
            else:
                location = datastruct.adjustSeparatorForFS("extract/")
                if cmdline.extract:
                    location = cmdline.extract
                for fid in idlist:
                    pac.extractFileId(fid, location, binfile, debuggy=cmdline.debug)

    elif cmdline.extract:
        threads = Broker(len(pac.files))
        for fid in pac.listFileIDs():
            threads.appendNfire(extractJob, (pac, fid, cmdline, filename))
        threads.stop()
        print("Extraction job completed")
def nonStaging(pac, cmdline, filename):
    if cmdline.list:
        pac.printInfo()
    elif cmdline.list_harder:
        pac.printDetailInfo()
    elif cmdline.file_info:
        file = pac.getFileById(cmdline.file_info)
        if file is not None:
            print("          id    offset       size  compress  size  filename")
            file.printDetailInfo()
    elif cmdline.extract_id:
        with open(filename, "rb") as binfile:
            idlist = map(int, cmdline.extract_id.split(","))
            if cmdline.raw:
                location = datastruct.adjustSeparatorForFS("raw-extract/")
                if cmdline.extract:
                    location = cmdline.extract
                for fid in idlist:
                    pac.dumpFileId(fid, location, binfile)
            else:
                location = datastruct.adjustSeparatorForFS("extract/")
                if cmdline.extract:
                    location = cmdline.extract
                for fid in idlist:
                    pac.extractFileId(fid, location, binfile, debuggy=cmdline.debug)

    elif cmdline.extract:
        threads = Broker(len(pac.files))
        for fid in pac.listFileIDs():
            threads.appendNfire(extractJob, (pac, fid, cmdline, filename))
        threads.stop()
        print("Extraction job completed")
Beispiel #3
0
 def capsule(thread):
     threads = Broker(len(self.app.staging.package.files))
     thread.abort_interface = threads
     fids = self.app.staging.package.searchFile(internalname, exact_match=False)
     for fid in fids:
         if thread.handbrake:
             break
         if not threads.appendNfire(extractJob,
                             (self.app.staging.package,
                              fid, saveto, self.app.staging.target)):
             break
         thread.progressCallback(self.app.staging.package.getFileById(fid))
     threads.stop()
     self.after_run(thread, "done %s %d files" % (self.opname[1], self.doneunits))