Add VERSION string to libgourou

This commit is contained in:
Grégory Soutadé 2021-07-05 20:22:47 +02:00
parent 6593171e22
commit 46a31b3fd9
4 changed files with 28 additions and 5 deletions

View File

@ -40,6 +40,8 @@
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif
#define LIBGOUROU_VERSION "0.1"
namespace gourou
{
/**
@ -49,6 +51,8 @@ namespace gourou
{
public:
static const std::string VERSION;
/**
* @brief Main constructor. To be used once all is configured (user has signedIn, device is activated)
*

View File

@ -35,7 +35,8 @@
namespace gourou
{
GOUROU_LOG_LEVEL logLevel = WARN;
const std::string DRMProcessor::VERSION = LIBGOUROU_VERSION;
DRMProcessor::DRMProcessor(DRMProcessorClient* client):client(client), device(0), user(0)
{
if (!client)

View File

@ -127,6 +127,11 @@ static const char* findFile(const char* filename, bool inDefaultDirs=true)
return 0;
}
static void version(void)
{
std::cout << "Current libgourou version : " << gourou::DRMProcessor::VERSION << std::endl ;
}
static void usage(const char* cmd)
{
std::cout << "Download EPUB file from ACSM request file" << std::endl;
@ -140,6 +145,7 @@ static void usage(const char* cmd)
std::cout << " " << "-o|--output-file" << "\t" << "Optional output epub filename (default <title.epub>)" << 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 << " " << "-V|--version" << "\t\t" << "Display libgourou version" << std::endl;
std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl;
std::cout << std::endl;
@ -167,11 +173,12 @@ int main(int argc, char** argv)
{"output-file", required_argument, 0, 'o' },
{"acsm-file", required_argument, 0, 'f' },
{"verbose", no_argument, 0, 'v' },
{"version", no_argument, 0, 'V' },
{"help", no_argument, 0, 'h' },
{0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "d:a:k:O:o:f:vh",
c = getopt_long(argc, argv, "d:a:k:O:o:f:vVh",
long_options, &option_index);
if (c == -1)
break;
@ -198,10 +205,12 @@ int main(int argc, char** argv)
case 'v':
verbose++;
break;
case 'V':
version();
return 0;
case 'h':
usage(argv[0]);
return 0;
break;
default:
usage(argv[0]);
return -1;

View File

@ -134,6 +134,11 @@ private:
QCoreApplication* app;
};
static void version(void)
{
std::cout << "Current libgourou version : " << gourou::DRMProcessor::VERSION << std::endl ;
}
static void usage(const char* cmd)
{
std::cout << "Create new device files used by ADEPT DRM" << std::endl;
@ -146,6 +151,7 @@ static void usage(const char* cmd)
std::cout << " " << "-H|--hobbes-version" << "\t"<< "Force RMSDK version to a specific value (default: version of current librmsdk)" << std::endl;
std::cout << " " << "-r|--random-serial" << "\t"<< "Generate a random device serial (if not set, it will be dependent of your current configuration)" << std::endl;
std::cout << " " << "-v|--verbose" << "\t\t" << "Increase verbosity, can be set multiple times" << std::endl;
std::cout << " " << "-V|--version" << "\t\t" << "Display libgourou version" << std::endl;
std::cout << " " << "-h|--help" << "\t\t" << "This help" << std::endl;
std::cout << std::endl;
@ -177,11 +183,12 @@ int main(int argc, char** argv)
{"hobbes-version",required_argument, 0, 'H' },
{"random-serial", no_argument, 0, 'r' },
{"verbose", no_argument, 0, 'v' },
{"version", no_argument, 0, 'V' },
{"help", no_argument, 0, 'h' },
{0, 0, 0, 0 }
};
c = getopt_long(argc, argv, "u:p:O:H:rvh",
c = getopt_long(argc, argv, "u:p:O:H:rvVh",
long_options, &option_index);
if (c == -1)
break;
@ -202,10 +209,12 @@ int main(int argc, char** argv)
case 'v':
verbose++;
break;
case 'V':
version();
return 0;
case 'h':
usage(argv[0]);
return 0;
break;
case 'r':
randomSerial = true;
break;