def next_filename(self, serial): """WARC filename is configurable with CLI parameter --warc-filename. Default: '{prefix}-{timestamp17}-{randomtoken}-{serialno}' Available variables are: prefix, timestamp14, timestamp17, serialno, randomtoken, hostname, shorthostname. Extension ``.warc`` or ``.warc.gz`` is appended automatically. """ hostname = socket.getfqdn() shorthostname = hostname.split('.')[0] fname = self.filename_template.format( prefix=self.prefix, timestamp14=warcprox.timestamp14(), timestamp17=warcprox.timestamp17(), serialno='{:05d}'.format(serial), randomtoken=self.randomtoken, hostname=hostname, shorthostname=shorthostname) if self.gzip: fname = fname + '.warc.gz' else: fname = fname + '.warc' return fname
def filename(self, serial): """WARC filename is configurable with CLI parameter --warc-filename. Default: '{prefix}-{timestamp17}-{randomtoken}-{serialno}' Available variables are: prefix, timestamp14, timestamp17, serialno, randomtoken, hostname, shorthostname. Extension ``.warc`` or ``.warc.gz`` is appended automatically. """ hostname = socket.getfqdn() shorthostname = hostname.split('.')[0] fname = self.filename_template.format( prefix=self.prefix, timestamp14=warcprox.timestamp14(), timestamp17=warcprox.timestamp17(), serialno='{:05d}'.format(serial), randomtoken=self.randomtoken, hostname=hostname, shorthostname=shorthostname) if self.gzip: fname = fname + '.warc.gz' else: fname = fname + '.warc' return fname