mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

Our old Python code was also skipping numbers when it encountered a directory, leading to a colpkg that couldn't be imported with our new code.
57 lines
1.4 KiB
Protocol Buffer
57 lines
1.4 KiB
Protocol Buffer
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
syntax = "proto3";
|
|
|
|
package anki.import_export;
|
|
|
|
import "anki/generic.proto";
|
|
|
|
service ImportExportService {
|
|
rpc ImportCollectionPackage(ImportCollectionPackageRequest)
|
|
returns (generic.Empty);
|
|
rpc ExportCollectionPackage(ExportCollectionPackageRequest)
|
|
returns (generic.Empty);
|
|
}
|
|
|
|
message ImportCollectionPackageRequest {
|
|
string col_path = 1;
|
|
string backup_path = 2;
|
|
string media_folder = 3;
|
|
}
|
|
|
|
message ExportCollectionPackageRequest {
|
|
string out_path = 1;
|
|
bool include_media = 2;
|
|
bool legacy = 3;
|
|
}
|
|
|
|
message PackageMetadata {
|
|
enum Version {
|
|
VERSION_UNKNOWN = 0;
|
|
// When `meta` missing, and collection.anki2 file present.
|
|
VERSION_LEGACY_1 = 1;
|
|
// When `meta` missing, and collection.anki21 file present.
|
|
VERSION_LEGACY_2 = 2;
|
|
// Implies MediaEntry media map, and zstd compression.
|
|
// collection.21b file
|
|
VERSION_LATEST = 3;
|
|
}
|
|
|
|
Version version = 1;
|
|
}
|
|
|
|
message MediaEntries {
|
|
message MediaEntry {
|
|
string name = 1;
|
|
uint32 size = 2;
|
|
bytes sha1 = 3;
|
|
|
|
/// Legacy media maps may include gaps in the media list, so the original
|
|
/// file index is recorded when importing from a HashMap. This field is not
|
|
/// set when exporting.
|
|
optional uint32 legacy_zip_filename = 255;
|
|
}
|
|
|
|
repeated MediaEntry entries = 1;
|
|
}
|