ACSMDownloader

ACSMDownloader Commit Details

Date:2021-04-30 17:37:49 (2 months 27 days ago)
Author:Grégory Soutadé
Commit:ee28ed34ec9679694901773b78d507e607388c63
Parents: 0db25f5610f48ea6da847990053bc28f302338d0
Message:Fix some bugs about default files

Changes:
Msrc/main.cpp (6 diffs)

File differences

src/main.cpp
1414
1515
1616
17
18
19
20
21
22
17
18
19
20
21
22
23
24
25
26
2327
2428
2529
......
7579
7680
7781
78
82
7983
8084
8185
......
8993
9094
9195
92
96
9397
94
95
98
9699
97
98
99
100
101
102
103
100104
101
102
103
104
105
106
107
108
109
105
106
107
108
110109
111
112
110
111
113112
114113
115114
......
136135
137136
138137
139
138
140139
141
140
142141
143142
144
145143
146144
147145
......
198196
199197
200198
201
202
203
204
199
200
205201
206
202
207203
208204
209205
210206
211
207
208
212209
213
210
211
214212
215213
216214
217215
218216
219217
220
218
221219
222220
223221
......
235233
236234
237235
238
236
237
238
239
240
241
239242
int verbose = INFO;
static char* deviceFile = 0;
static char* activationFile = 0;
static char* devicekeyFile = 0;
static char* acsmFile = 0;
static char* outputFile = 0;
static char* outputDir = 0;
static const char* deviceFile = "device.xml";
static const char* activationFile = "activation.xml";
static const char* devicekeyFile = 0;
static const char* acsmFile = 0;
static const char* outputFile = 0;
static const char* outputDir = 0;
static const char* defaultDirs[] = {
"./adobe-digital-editions/",
"./.adobe-digital-editions/"
};
class ACSMDownloader
{
drmprocessor->initWorkflows(WORKFLOW_AUTH_SIGN_IN|WORKFLOW_FULFILLMENT|WORKFLOW_DOWNLOAD|WORKFLOW_NOTIFICATION, dp::Data(buffer, buffer_size));
LOG(DEBUG, "Start work");
int res = drmprocessor->startWorkflows(WORKFLOW_AUTH_SIGN_IN|WORKFLOW_FULFILLMENT|WORKFLOW_DOWNLOAD|WORKFLOW_NOTIFICATION);
drmprocessor->startWorkflows(WORKFLOW_AUTH_SIGN_IN|WORKFLOW_FULFILLMENT|WORKFLOW_DOWNLOAD|WORKFLOW_NOTIFICATION);
delete[] buffer;
LOG(DEBUG, "Bye bye");
QCoreApplication* app;
};
static QString findFile(char* filename)
static const char* findFile(const char* filename)
{
QFile file;
QString path = filename;
QFile file(filename);
file.setFileName(path);
if (!file.exists())
if (file.exists())
return strdup(filename);
for (int i=0; i<(int)ARRAY_SIZE(defaultDirs); i++)
{
path = QString("./adobe-digital-editions directory/") + filename;
file.setFileName(path);
if (!file.exists())
{
path = QString("./.adobe-digital-editions directory/") + filename;
file.setFileName(path);
if (!file.exists())
return QString("");
}
uft::String path = uft::String(defaultDirs[i]) + filename;
file.setFileName(path.c_str());
if (file.exists())
return strdup(path.c_str());
}
return path;
return 0;
}
static void usage(void)
int main(int argc, char** argv)
{
int c;
int c, ret = -1;
char** files[] = {&devicekeyFile, &acsmFile};
const char** files[] = {&devicekeyFile, &acsmFile};
while (1) {
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"device-file", required_argument, 0, 'd' },
return -1;
}
QString _deviceFile = findFile(deviceFile);
QString _activationFile = findFile(activationFile);
if (!_deviceFile.size())
deviceFile = findFile(deviceFile);
if (!deviceFile)
{
deviceFile = (deviceFile) ?: (char*)"device.xml";
deviceFile = (deviceFile)?:(char*)"device.xml";
LOG(ERROR, "Error : " << deviceFile << " not found");
return -1;
}
if (!_activationFile.size())
activationFile = findFile(activationFile);
if (!activationFile)
{
activationFile = (activationFile) ?: (char*)"activation.xml";
free((void*)deviceFile);
activationFile = (activationFile)?:(char*)"activation.xml";
LOG(ERROR, "Error : " << activationFile << " not found");
return -1;
}
QFile file;
int i;
for (i=0; i<ARRAY_SIZE(files); i++)
for (i=0; i<(int)ARRAY_SIZE(files); i++)
{
file.setFileName(*files[i]);
if (!file.exists())
pthread_t thread;
pthread_create(&thread, NULL, ACSMDownloader::run, (void*)&downloader);
return app.exec();
ret = app.exec();
free((void*)deviceFile);
free((void*)activationFile);
return ret;
}

Archive Download the corresponding diff file

Branches