# Path: resync/resource_dump_manifest.py
# class ResourceDumpManifest(ResourceList):
#     """Class representing a Resource Dump Manifest.
# 
#     A ResourceDumpManifest comprises a set of files/resources
#     in a content package. Properties much Like a ResourceList
#     and implemented as a sub-class of ResourceList.
#     """
# 
#     def __init__(self, resources=None, md=None, ln=None,
#                  uri=None, allow_multifile=None, mapper=None,
#                  spec_version='1.1', add_lastmod=False):
#         """Initialize ResourceDumpManifest."""
#         super(ResourceDumpManifest, self).__init__(
#             resources=resources, md=md, ln=ln, uri=uri, mapper=mapper,
#             spec_version=spec_version, add_lastmod=add_lastmod)
#         self.capability_name = 'resourcedump-manifest'


import logging
import os.path
from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
from resync.resource_dump_manifest import ResourceDumpManifest
            from warc import WARCFile, WARCHeader, WARCRecord
            dumpbase = "%s%05d" % (basename, n)
            dumpfile = "%s.%s" % (dumpbase, self.format)
            if (write_separate_manifests):
                manifest.write(basename=dumpbase + '.xml')
            if (self.format == 'zip'):
                self.write_zip(manifest.resources, dumpfile)
            elif (self.format == 'warc'):
                self.write_warc(manifest.resources, dumpfile)
            else:
                raise DumpError(
                    "Unknown dump format requested (%s)" %
                    (self.format))
            n += 1
        self.logger.info("Wrote %d dump files" % (n))
        return(n)

    def write_zip(self, resources=None, dumpfile=None):
        """Write a ZIP format dump file.

        Writes a ZIP file containing the resources in the iterable resources along with
        a manifest file manifest.xml (written first). No checks on the size of files
        or total size are performed, this is expected to have been done beforehand.
        """
        compression = (ZIP_DEFLATED if self.compress else ZIP_STORED)
        zf = ZipFile(
            dumpfile,
            mode="w",
            compression=compression,
            allowZip64=True)
        # Write resources first

# Path: resync/resource_dump_manifest.py
# class ResourceDumpManifest(ResourceList):
#     """Class representing a Resource Dump Manifest.
# 
#     A ResourceDumpManifest comprises a set of files/resources
#     in a content package. Properties much Like a ResourceList
#     and implemented as a sub-class of ResourceList.
#     """
# 
#     def __init__(self, resources=None, md=None, ln=None,
#                  uri=None, allow_multifile=None, mapper=None,
#                  spec_version='1.1', add_lastmod=False):
#         """Initialize ResourceDumpManifest."""
#         super(ResourceDumpManifest, self).__init__(
#             resources=resources, md=md, ln=ln, uri=uri, mapper=mapper,
#             spec_version=spec_version, add_lastmod=add_lastmod)
#         self.capability_name = 'resourcedump-manifest'


# Path: resync/dump.py
import logging
import os.path
from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
from resync.resource_dump_manifest import ResourceDumpManifest
            from warc import WARCFile, WARCHeader, WARCRecord

            dumpbase = "%s%05d" % (basename, n)
            dumpfile = "%s.%s" % (dumpbase, self.format)
            if (write_separate_manifests):
                manifest.write(basename=dumpbase + '.xml')
            if (self.format == 'zip'):
                self.write_zip(manifest.resources, dumpfile)
            elif (self.format == 'warc'):
                self.write_warc(manifest.resources, dumpfile)
            else:
                raise DumpError(
                    "Unknown dump format requested (%s)" %
                    (self.format))
            n += 1
        self.logger.info("Wrote %d dump files" % (n))
        return(n)

    def write_zip(self, resources=None, dumpfile=None):
        """Write a ZIP format dump file.

        Writes a ZIP file containing the resources in the iterable resources along with
        a manifest file manifest.xml (written first). No checks on the size of files
        or total size are performed, this is expected to have been done beforehand.
        """
        compression = (ZIP_DEFLATED if self.compress else ZIP_STORED)
        zf = ZipFile(
            dumpfile,
            mode="w",
            compression=compression,
            allowZip64=True)
        # Write resources first

        rdm = ResourceDumpManifest(resources=resources)