ACSMDownloader

ACSMDownloader Commit Details

Date:2021-04-06 22:24:00 (3 months 21 days ago)
Author:Grégory Soutadé
Commit:34ea3269def008ee3784e1f2141c00dc03c1ff13
Parents: 850b3cafa8b9f4832de60c5047ba885afab6c31d
Message:Add usage

Changes:
Msrc/main.cpp (1 diff)

File differences

src/main.cpp
1
2
13
24
35
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
429
530
6
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
756
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
894
995
#include <unistd.h>
#include <getopt.h>
#include <iostream>
#include <dp_all.h>
static int verbose = 0;
static void usage(void)
{
std::cout << "Download EPUB file from ACSM request file" << std::endl;
std::cout << "Usage: ./acsmdownloader [(-d|--device-file) device.xml] [(-a|--activation-file) activation.xml] [(-o|--output-file) output.epub] [(-v|--verbose)] [(-h|--help)] (-k|--device-key-file) devkey.bin (-f|--acsm-file) file.acsm" << std::endl << std::endl;
std::cout << " " << "-d|--device-file" << "\t" << "device.xml file from ereader" << std::endl;
std::cout << " " << "-a|--activation-file" << "\t" << "activation.xml file from ereader" << std::endl;
std::cout << " " << "-k|--device-key-file" << "\t" << "device key file (eg devkey.bin) from ereader" << std::endl;
std::cout << " " << "-o|--output-file" << "\t" << "Optional output epub filename" << std::endl;
std::cout << " " << "-f|--acsm-file" << "\t" << "ACSM request file for epub download" << std::endl;
std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl;
std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl;
std::cout << std::endl;
std::cout << "Device file and activation file are optional. If not set, they are looked into :" << std::endl;
std::cout << " * Current directory" << std::endl;
std::cout << " * adobe-digital-editions directory" << std::endl;
std::cout << " * .adobe-digital-editions directory" << std::endl;
}
int main(int argc, char** argv)
{
std::cout << "RMSDK Version " << dp::getVersionInfo("hobbes").utf8() << std::endl ;
int c;
char* device_file = 0;
char* activation_file = 0;
char* device_key_file = 0;
char* acsm_file = 0;
char* output_file = 0;
while (1) {
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"device-file", required_argument, 0, 'd' },
{"activation-file", required_argument, 0, 'a' },
{"device-key-file", required_argument, 0, 'k' },
{"output-file", required_argument, 0, 'o' },
{"acsm-file", required_argument, 0, 'f' },
{"verbose", no_argument, 0, 'v' },
{"help", no_argument, 0, 'h' },
{0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "d:a:k:o:f:vh",
long_options, &option_index);
if (c == -1)
break;
switch (c) {
case 'd':
device_file = optarg;
break;
case 'a':
activation_file = optarg;
break;
case 'k':
device_key_file = optarg;
break;
case 'f':
acsm_file = optarg;
break;
case 'o':
output_file = optarg;
break;
case 'v':
verbose++;
break;
case 'h':
usage();
return 0;
break;
default:
usage();
return -1;
}
}
if (!device_key_file || !acsm_file)
{
usage();
return -1;
}
std::cout << "RMSDK Version " << dp::getVersionInfo("hobbes").utf8() << std::endl ;
return 0;
}

Archive Download the corresponding diff file

Branches