2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2018-07-24 22:19:49 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This program is a command line interface to SongFilter::Parse().
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-08-02 13:45:43 +02:00
|
|
|
#include "song/Filter.hxx"
|
2018-07-24 22:19:49 +02:00
|
|
|
#include "util/PrintException.hxx"
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
try {
|
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "Usage: ParseSongFilter FILTER ...\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
SongFilter filter;
|
2022-07-04 18:21:44 +02:00
|
|
|
filter.Parse({argv + 1, std::size_t(argc - 1)});
|
2018-08-02 19:42:53 +02:00
|
|
|
filter.Optimize();
|
2018-07-24 22:19:49 +02:00
|
|
|
|
|
|
|
puts(filter.ToExpression().c_str());
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
} catch (...) {
|
|
|
|
PrintException(std::current_exception());
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|