1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-22 07:48:52 -05:00

* exclude hash algorithm information when writing .md5 files

This commit is contained in:
Reinhard Pointner 2009-04-06 20:58:27 +00:00
parent e6b785df63
commit 2793e1d454
2 changed files with 29 additions and 7 deletions

View File

@ -71,6 +71,19 @@ enum HashType {
public Hash newHash() {
return new MessageDigestHash("MD5");
}
@Override
public VerificationFileScanner newScanner(Scanner scanner) {
return new VerificationFileScanner(scanner);
}
@Override
public VerificationFilePrinter newPrinter(Formatter out) {
// e.g. 50e85fe18e17e3616774637a82968f4c *folder/file.txt
return new VerificationFilePrinter(out, null);
}
},
SHA1 {
@ -81,6 +94,19 @@ enum HashType {
}
@Override
public VerificationFileScanner newScanner(Scanner scanner) {
return new VerificationFileScanner(scanner);
}
@Override
public VerificationFilePrinter newPrinter(Formatter out) {
// e.g 1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt
return new VerificationFilePrinter(out, "SHA1");
}
@Override
public String toString() {
return "SHA-1";
@ -90,14 +116,10 @@ enum HashType {
public abstract Hash newHash();
public VerificationFileScanner newScanner(Scanner scanner) {
return new VerificationFileScanner(scanner);
}
public abstract VerificationFileScanner newScanner(Scanner scanner);
public VerificationFilePrinter newPrinter(Formatter out) {
return new VerificationFilePrinter(out, this.name());
}
public abstract VerificationFilePrinter newPrinter(Formatter out);
public String getExtension() {

View File

@ -30,7 +30,7 @@ class VerificationFilePrinter implements Closeable {
protected void print(String path, String hash) {
// e.g. 1a02a7c1e9ac91346d08829d5037b240f42ded07 ?SHA1*folder/file.txt
out.format("%s ?%s*%s", hash, algorithm.toUpperCase(), path);
out.format("%s %s*%s", hash, algorithm == null ? "" : '?' + algorithm.toUpperCase(), path);
}