2 Commits
1.3.0 ... 1.3.1

Author SHA1 Message Date
aa7ae6128d refactor: project file structure 2024-03-24 09:20:25 +08:00
wshon
ae08d4475c fix: exception when artist is empty (#16)
Co-authored-by: wshon <me@wshon.com>
2024-03-24 09:01:38 +08:00
12 changed files with 19 additions and 9 deletions

View File

@@ -14,9 +14,10 @@ if(MSVC)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
endif()
FILE(GLOB HEADERS ./*.h)
FILE(GLOB COMMON_SOURCES cJSON.cpp aes.cpp main.cpp ncmcrypt.cpp)
FILE(GLOB WIN_SOURCES win32_init.cpp)
FILE(GLOB HEADERS ./src/include/*.h)
FILE(GLOB COMMON_SOURCES ./src/*.cpp ./src/utils/*.cpp)
FILE(GLOB WIN_SOURCES ./src/platform/win32_init.cpp)
if(WIN32)
set(SOURCES ${COMMON_SOURCES} ${WIN_SOURCES})
@@ -27,6 +28,9 @@ add_executable(ncmdump
${HEADERS}
${SOURCES}
)
target_include_directories(ncmdump PRIVATE src/include)
target_link_libraries(ncmdump tag)
target_include_directories(ncmdump PRIVATE taglib)
target_include_directories(ncmdump PRIVATE taglib/taglib)

View File

@@ -77,7 +77,7 @@ int main(int argc, char **argv)
#define COMPARE_STR(s1, s2) (strcmp(s1, s2) == 0)
#define HELP_SHORT "-h"
#define HELP_LONG "--help"
#define FOLDER "-d"
#define PROCESS_FOLDER "-d"
for (int i = 1; i < argc; ++i)
{
if (COMPARE_STR(argv[i], HELP_SHORT) || COMPARE_STR(argv[i], HELP_LONG))
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
displayHelp();
return 0;
}
else if (COMPARE_STR(argv[i], FOLDER))
else if (COMPARE_STR(argv[i], PROCESS_FOLDER))
{
processFolders = true;
if (i + 1 < argc && argv[i + 1][0] != '-')

View File

@@ -94,12 +94,18 @@ NeteaseMusicMetadata::NeteaseMusicMetadata(cJSON *raw)
artistLen = cJSON_GetArraySize(swap);
i = 0;
for (i = 0; i < artistLen - 1; i++)
for (i = 0; i < artistLen; i++)
{
auto artist = cJSON_GetArrayItem(swap, i);
if (cJSON_GetArraySize(artist) > 0)
{
if (!mArtist.empty())
{
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(cJSON_GetArrayItem(swap, i), 0)));
mArtist += "/";
}
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(cJSON_GetArrayItem(swap, i), 0)));
mArtist += std::string(cJSON_GetStringValue(cJSON_GetArrayItem(artist, 0)));
}
}
}
swap = cJSON_GetObjectItem(raw, "bitrate");