1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-18 23:17:59 +01:00

[tools] Add musicscan utility

This commit is contained in:
Uwe L. Korn 2014-09-19 18:29:17 +01:00
parent 7459472702
commit aefbe439d3
4 changed files with 75 additions and 0 deletions

View File

@ -22,6 +22,9 @@ add_subdirectory( viewpages )
# application
add_subdirectory( tomahawk )
# tools
add_subdirectory( tools )
if(WITH_CRASHREPORTER)
add_subdirectory( crashreporter )
endif()

1
src/tools/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory( tomahawk-test-musicscan )

View File

@ -0,0 +1,24 @@
set( tomahawk_test_musicscan_src
main.cpp
)
add_executable( tomahawk_test_musicscan_bin WIN32 MACOSX_BUNDLE
${tomahawk_test_musicscan_src} )
set_target_properties( tomahawk_test_musicscan_bin
PROPERTIES
AUTOMOC TRUE
RUNTIME_OUTPUT_NAME tomahawk-test-musicscan
)
target_link_libraries( tomahawk_test_musicscan_bin
# ${TOMAHAWK_WIDGETS_LIBRARIES}
# ${TOMAHAWK_PLAYDARAPI_LIBRARIES}
${TOMAHAWK_LIBRARIES}
# ${OS_SPECIFIC_LINK_LIBRARIES}
# ${QT_LIBRARIES}
# ${MAC_EXTRA_LIBS}
# ${ECHONEST_LIBRARIES}
# ${TAGLIB_LIBRARIES}
)
qt5_use_modules(tomahawk_test_musicscan_bin Core Gui Network Widgets)
install( TARGETS tomahawk_test_musicscan_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )

View File

@ -0,0 +1,47 @@
#include"filemetadata/MusicScanner.h"
#include <QCoreApplication>
#include <QFileInfo>
#include <iostream>
void
usage()
{
std::cout << "Usage:" << std::endl;
std::cout << "\ttomahawk-test-musicscan <path>" << std::endl;
std::cout << std::endl;
std::cout << "\tpath\tEither an audio file or a directory" << std::endl;
}
int
main( int argc, char* argv[] )
{
if ( argc != 2 )
{
usage();
}
QCoreApplication a( argc, argv );
QFileInfo pathInfo( argv[1] );
if ( !pathInfo.exists() )
{
std::cerr << "Given path does not exist" << std::endl;
exit(EXIT_FAILURE);
}
if ( pathInfo.isFile() )
{
qDebug() << MusicScanner::readTags( pathInfo );
}
else if ( pathInfo.isDir() )
{
// TODO: Run MusicScanner recursively
}
else
{
std::cerr << "Unknown path (type) given, cannot handle this." << std::endl;
}
}