mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
[tools] Add musicscan utility
This commit is contained in:
@@ -22,6 +22,9 @@ add_subdirectory( viewpages )
|
|||||||
# application
|
# application
|
||||||
add_subdirectory( tomahawk )
|
add_subdirectory( tomahawk )
|
||||||
|
|
||||||
|
# tools
|
||||||
|
add_subdirectory( tools )
|
||||||
|
|
||||||
if(WITH_CRASHREPORTER)
|
if(WITH_CRASHREPORTER)
|
||||||
add_subdirectory( crashreporter )
|
add_subdirectory( crashreporter )
|
||||||
endif()
|
endif()
|
||||||
|
1
src/tools/CMakeLists.txt
Normal file
1
src/tools/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
add_subdirectory( tomahawk-test-musicscan )
|
24
src/tools/tomahawk-test-musicscan/CMakeLists.txt
Normal file
24
src/tools/tomahawk-test-musicscan/CMakeLists.txt
Normal 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} )
|
47
src/tools/tomahawk-test-musicscan/main.cpp
Normal file
47
src/tools/tomahawk-test-musicscan/main.cpp
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in New Issue
Block a user