13 |
14 |
15 |
--------------------------------------------------------------------------------
/cmake/modules/FindStbImage.cmake:
--------------------------------------------------------------------------------
1 | find_path(STB_IMAGE_INCLUDE_DIR stb_image.h PATH_SUFFIXES stb)
2 |
3 | find_path(STB_IMAGE_RESIZE2_INCLUDE_DIR stb_image_resize2.h PATH_SUFFIXES stb)
4 | if(STB_IMAGE_RESIZE2_INCLUDE_DIR)
5 | set(STB_IMAGE_RESIZE_VERSION 2)
6 | else()
7 | find_path(STB_IMAGE_RESIZE_INCLUDE_DIR stb_image_resize.h PATH_SUFFIXES stb)
8 | if(STB_IMAGE_RESIZE_INCLUDE_DIR)
9 | set(STB_IMAGE_RESIZE_VERSION 1)
10 | endif()
11 | endif()
12 |
13 | include(FindPackageHandleStandardArgs)
14 |
15 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(
16 | StbImage
17 | REQUIRED_VARS STB_IMAGE_INCLUDE_DIR STB_IMAGE_RESIZE_VERSION
18 | )
19 |
--------------------------------------------------------------------------------
/conf/pam/lms:
--------------------------------------------------------------------------------
1 | account required pam_unix.so
2 | auth required pam_unix.so
3 | password required pam_deny.so
4 |
--------------------------------------------------------------------------------
/conf/systemd/default.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Lightweight Music Server
3 | After=network.target
4 |
5 | [Service]
6 | Type=simple
7 | Restart=on-failure
8 | RestartSec=1
9 | WorkingDirectory=/var/lms
10 | ExecStart=/usr/bin/lms
11 | User=lms
12 | Group=lms
13 | Environment=OMP_THREAD_LIMIT=1
14 |
15 | [Install]
16 | WantedBy=multi-user.target
17 |
18 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_compile_options(-Wall -Wextra -pedantic)
2 |
3 | add_subdirectory(libs)
4 | add_subdirectory(lms)
5 | add_subdirectory(tools)
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/libs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(av)
2 | add_subdirectory(core)
3 | add_subdirectory(database)
4 | add_subdirectory(image)
5 | add_subdirectory(metadata)
6 | add_subdirectory(services)
7 | add_subdirectory(som)
8 | add_subdirectory(subsonic)
9 |
--------------------------------------------------------------------------------
/src/libs/av/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | pkg_check_modules(LIBAV IMPORTED_TARGET libavcodec libavutil libavformat)
2 |
3 | add_library(lmsav STATIC
4 | impl/AudioFile.cpp
5 | impl/RawResourceHandlerCreator.cpp
6 | impl/Transcoder.cpp
7 | impl/TranscodingResourceHandler.cpp
8 | )
9 |
10 | target_include_directories(lmsav INTERFACE
11 | include
12 | )
13 |
14 | target_include_directories(lmsav PRIVATE
15 | include
16 | ${AVCODEC_INCLUDE_DIR}
17 | ${AVFORMAT_INCLUDE_DIR}
18 | ${AVUTIL_INCLUDE_DIR}
19 | )
20 |
21 | target_link_libraries(lmsav PUBLIC
22 | lmscore
23 | std::filesystem
24 | )
25 |
26 | target_link_libraries(lmsav PRIVATE
27 | PkgConfig::LIBAV
28 | )
29 |
--------------------------------------------------------------------------------
/src/libs/av/impl/RawResourceHandlerCreator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "av/RawResourceHandlerCreator.hpp"
21 |
22 | #include "av/IAudioFile.hpp"
23 | #include "core/FileResourceHandlerCreator.hpp"
24 |
25 | namespace lms::av
26 | {
27 | std::unique_ptr createRawResourceHandler(const std::filesystem::path& path)
28 | {
29 | std::string_view mimeType{ getMimeType(path.extension()) };
30 | return createFileResourceHandler(path, mimeType.empty() ? "application/octet-stream" : mimeType);
31 | }
32 | } // namespace lms::av
33 |
--------------------------------------------------------------------------------
/src/libs/av/include/av/RawResourceHandlerCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include "core/IResourceHandler.hpp"
26 |
27 | namespace lms::av
28 | {
29 | std::unique_ptr createRawResourceHandler(const std::filesystem::path& path);
30 | }
--------------------------------------------------------------------------------
/src/libs/av/include/av/TranscodingResourceHandlerCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "core/IResourceHandler.hpp"
25 |
26 | namespace lms::av::transcoding
27 | {
28 | struct InputParameters;
29 | struct OutputParameters;
30 |
31 | std::unique_ptr createResourceHandler(const InputParameters& inputParameters, const OutputParameters& outputParameters, bool estimateContentLength);
32 | } // namespace lms::av::transcoding
33 |
--------------------------------------------------------------------------------
/src/libs/av/include/av/Types.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/Exception.hpp"
23 |
24 | namespace lms::av
25 | {
26 | class Exception : public core::LmsException
27 | {
28 | public:
29 | using LmsException::LmsException;
30 | };
31 | } // namespace lms::av
32 |
--------------------------------------------------------------------------------
/src/libs/core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | pkg_check_modules(Config++ REQUIRED IMPORTED_TARGET libconfig++)
2 | pkg_check_modules(Archive REQUIRED IMPORTED_TARGET libarchive)
3 | pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
4 |
5 | add_library(lmscore STATIC
6 | impl/http/Client.cpp
7 | impl/http/SendQueue.cpp
8 | impl/ArchiveZipper.cpp
9 | impl/ChildProcess.cpp
10 | impl/ChildProcessManager.cpp
11 | impl/Config.cpp
12 | impl/FileResourceHandler.cpp
13 | impl/IOContextRunner.cpp
14 | impl/Logger.cpp
15 | impl/NetAddress.cpp
16 | impl/PartialDateTime.cpp
17 | impl/Path.cpp
18 | impl/Random.cpp
19 | impl/RecursiveSharedMutex.cpp
20 | impl/StreamLogger.cpp
21 | impl/String.cpp
22 | impl/TraceLogger.cpp
23 | impl/UUID.cpp
24 | impl/WtLogger.cpp
25 | impl/XxHash3.cpp
26 | )
27 |
28 | target_include_directories(lmscore INTERFACE
29 | include
30 | )
31 |
32 | target_include_directories(lmscore PRIVATE
33 | include
34 | )
35 |
36 | target_link_libraries(lmscore PRIVATE
37 | PkgConfig::Config++
38 | PkgConfig::Archive
39 | PkgConfig::XXHASH
40 | )
41 |
42 | target_link_libraries(lmscore PUBLIC
43 | Boost::system
44 | std::filesystem
45 | Wt::Wt
46 | )
47 |
48 | if(BUILD_TESTING)
49 | add_subdirectory(test)
50 | endif()
51 |
52 | if (BUILD_BENCHMARKS)
53 | add_subdirectory(bench)
54 | endif()
55 |
--------------------------------------------------------------------------------
/src/libs/core/bench/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(bench-core
3 | TraceLoggerBench.cpp
4 | )
5 |
6 | target_link_libraries(bench-core PRIVATE
7 | lmscore
8 | benchmark
9 | )
10 |
--------------------------------------------------------------------------------
/src/libs/core/impl/Random.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "core/Random.hpp"
21 |
22 | namespace lms::core::random
23 | {
24 |
25 | RandGenerator& getRandGenerator()
26 | {
27 | static thread_local std::random_device rd;
28 | static thread_local RandGenerator randGenerator(rd());
29 |
30 | return randGenerator;
31 | }
32 |
33 | RandGenerator createSeededGenerator(uint_fast32_t seed)
34 | {
35 | return RandGenerator{ seed };
36 | }
37 |
38 | } // namespace lms::core::random
--------------------------------------------------------------------------------
/src/libs/core/impl/StreamLogger.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 |
23 | #include "core/StreamLogger.hpp"
24 |
25 | namespace lms::core::logging
26 | {
27 | StreamLogger::StreamLogger(std::ostream& os, EnumSet severities)
28 | : _os{ os }
29 | , _severities{ severities }
30 | {
31 | }
32 |
33 | void StreamLogger::processLog(const Log& log)
34 | {
35 | assert(isSeverityActive(log.getSeverity()));
36 | _os << std::this_thread::get_id() << " [" << getSeverityName(log.getSeverity()) << "] [" << getModuleName(log.getModule()) << "] " << log.getMessage() << std::endl;
37 | }
38 | } // namespace lms::core::logging
--------------------------------------------------------------------------------
/src/libs/core/impl/XxHash3.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "core/XxHash3.hpp"
21 |
22 | #define XXH_INLINE_ALL
23 | #include
24 |
25 | namespace lms::core
26 | {
27 | std::uint64_t xxHash3_64(std::span buf)
28 | {
29 | return XXH3_64bits(buf.data(), buf.size());
30 | }
31 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/include/core/Crc32Calculator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include // for boost::crc_32_type
23 |
24 | namespace lms::core
25 | {
26 | class Crc32Calculator
27 | {
28 | public:
29 | void processBytes(const std::byte* _data, std::size_t dataSize)
30 | {
31 | _result.process_bytes(_data, dataSize);
32 | }
33 |
34 | std::uint32_t getResult() const
35 | {
36 | return _result.checksum();
37 | }
38 |
39 | private:
40 | using Crc32Type = boost::crc_32_type;
41 | Crc32Type _result;
42 | };
43 | } // namespace lms::core
44 |
--------------------------------------------------------------------------------
/src/libs/core/include/core/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace lms::core
27 | {
28 | // TODO, rename to Exception
29 | class LmsException : public std::runtime_error
30 | {
31 | public:
32 | LmsException(std::string_view error = "")
33 | : std::runtime_error{ std::string{ error } } {}
34 | };
35 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/include/core/FileResourceHandlerCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include "core/IResourceHandler.hpp"
27 |
28 | namespace lms
29 | {
30 | std::unique_ptr createFileResourceHandler(const std::filesystem::path& path, std::string_view mimeType);
31 | }
--------------------------------------------------------------------------------
/src/libs/core/include/core/IChildProcessManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 | #pragma once
20 |
21 | #include
22 | #include
23 |
24 | #include
25 |
26 | #include "IChildProcess.hpp"
27 |
28 | namespace lms::core
29 | {
30 | class IChildProcessManager
31 | {
32 | public:
33 | virtual ~IChildProcessManager() = default;
34 |
35 | virtual std::unique_ptr spawnChildProcess(const std::filesystem::path& path, const IChildProcess::Args& args) = 0;
36 | };
37 |
38 | std::unique_ptr createChildProcessManager(boost::asio::io_context& ioContext);
39 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/include/core/IResourceHandler.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | // TODO, move elsewhere
26 | namespace lms
27 | {
28 | // Helper class to serve a resource (must be saved as continuation data if not complete)
29 | class IResourceHandler
30 | {
31 | public:
32 | virtual ~IResourceHandler() = default;
33 |
34 | [[nodiscard]] virtual Wt::Http::ResponseContinuation* processRequest(const Wt::Http::Request& request, Wt::Http::Response& response) = 0;
35 | virtual void abort() = 0;
36 | };
37 | } // namespace lms
--------------------------------------------------------------------------------
/src/libs/core/include/core/NetAddress.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #ifndef BOOST_ASIO_HAS_STD_HASH
25 | #include
26 |
27 | namespace std
28 | {
29 | template<>
30 | struct hash
31 | {
32 | std::size_t operator()(const boost::asio::ip::address& ipAddr) const;
33 | };
34 |
35 | } // namespace std
36 |
37 | #endif // BOOST_ASIO_HAS_STD_HASH
38 |
--------------------------------------------------------------------------------
/src/libs/core/include/core/SystemPaths.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::core
25 | {
26 | static inline const std::filesystem::path sysconfDirectory{ "/etc" };
27 | }
--------------------------------------------------------------------------------
/src/libs/core/include/core/TaggedType.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace lms::core
23 | {
24 | template
25 | class TaggedType
26 | {
27 | public:
28 | using underlying_type = T;
29 |
30 | explicit constexpr TaggedType() = default;
31 | explicit constexpr TaggedType(T value)
32 | : _value{ value } {}
33 |
34 | constexpr T value() const { return _value; }
35 |
36 | auto operator<=>(const TaggedType&) const = default;
37 |
38 | private:
39 | T _value{};
40 | };
41 |
42 | template
43 | using TaggedBool = TaggedType;
44 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/include/core/WtLogger.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "core/ILogger.hpp"
25 |
26 | namespace lms::core::logging
27 | {
28 | class WtLogger final : public ILogger
29 | {
30 | public:
31 | WtLogger(Severity minSeverity);
32 |
33 | static std::string computeLogConfig(Severity minSeverity);
34 |
35 | private:
36 | bool isSeverityActive(Severity severity) const override;
37 | void processLog(const Log& log) override;
38 | const Severity _minSeverity;
39 | };
40 | } // namespace lms::core::logging
--------------------------------------------------------------------------------
/src/libs/core/include/core/XxHash3.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace lms::core
27 | {
28 | std::uint64_t xxHash3_64(std::span buf);
29 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/include/core/ZipperResourceHandlerCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "core/IResourceHandler.hpp"
25 | #include "core/IZipper.hpp"
26 |
27 | namespace lms::zip
28 | {
29 | std::unique_ptr createZipperResourceHandler(std::unique_ptr zipper);
30 | }
31 |
--------------------------------------------------------------------------------
/src/libs/core/include/core/http/IClient.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 |
26 | #include "core/http/ClientRequestParameters.hpp"
27 |
28 | namespace lms::core::http
29 | {
30 | class IClient
31 | {
32 | public:
33 | virtual ~IClient() = default;
34 |
35 | virtual void sendGETRequest(ClientGETRequestParameters&& request) = 0;
36 | virtual void sendPOSTRequest(ClientPOSTRequestParameters&& request) = 0;
37 | };
38 |
39 | std::unique_ptr createClient(boost::asio::io_context& ioContext, std::string_view baseUrl);
40 | } // namespace lms::core::http
--------------------------------------------------------------------------------
/src/libs/core/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GoogleTest)
2 |
3 | add_executable(test-core
4 | EnumSet.cpp
5 | LiteralString.cpp
6 | PartialDateTime.cpp
7 | Path.cpp
8 | RecursiveSharedMutex.cpp
9 | Service.cpp
10 | String.cpp
11 | TraceLogger.cpp
12 | Utils.cpp
13 | UUID.cpp
14 | XxHash3.cpp
15 | )
16 |
17 | target_link_libraries(test-core PRIVATE
18 | lmscore
19 | Threads::Threads
20 | GTest::GTest
21 | )
22 |
23 | if (NOT CMAKE_CROSSCOMPILING)
24 | gtest_discover_tests(test-core)
25 | endif()
26 |
27 |
--------------------------------------------------------------------------------
/src/libs/core/test/UUID.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 |
27 | #include "core/UUID.hpp"
28 |
29 | namespace lms::core
30 | {
31 | TEST(UUID, caseInsensitive)
32 | {
33 | const std::optional uuid1{ UUID::fromString("3f51c839-bee2-4e9d-a7b7-0693e45178fc") };
34 | const std::optional uuid2{ UUID::fromString("3f51C839-bEE2-4e9d-a7B7-0693e45178fC") };
35 |
36 | EXPECT_EQ(uuid1, uuid2);
37 | EXPECT_TRUE(uuid1 >= uuid2);
38 | EXPECT_TRUE(uuid1 <= uuid2);
39 | }
40 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/core/test/Utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 |
22 | int main(int argc, char** argv)
23 | {
24 | ::testing::InitGoogleTest(&argc, argv);
25 | return RUN_ALL_TESTS();
26 | }
27 |
--------------------------------------------------------------------------------
/src/libs/core/test/XxHash3.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "core/XxHash3.hpp"
23 |
24 | namespace lms::core
25 | {
26 | TEST(Xxhash3_64, basic)
27 | {
28 | std::vector buffer;
29 | buffer.resize(1024);
30 |
31 | for (std::size_t i{}; i < buffer.size(); ++i)
32 | buffer[i] = static_cast(i);
33 |
34 | const std::uint64_t hash{ xxHash3_64(buffer) };
35 | EXPECT_EQ(hash, 12137474952470826274ULL);
36 | }
37 | } // namespace lms::core
--------------------------------------------------------------------------------
/src/libs/database/impl/Types.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "database/Types.hpp"
21 |
22 | #include
23 |
24 | namespace lms::db
25 | {
26 | static const std::set allowedAudioBitrates{
27 | 64000,
28 | 96000,
29 | 128000,
30 | 192000,
31 | 320000,
32 | };
33 |
34 | void visitAllowedAudioBitrates(std::function func)
35 | {
36 | for (Bitrate bitrate : allowedAudioBitrates)
37 | func(bitrate);
38 | }
39 |
40 | bool isAudioBitrateAllowed(Bitrate bitrate)
41 | {
42 | return allowedAudioBitrates.find(bitrate) != std::cend(allowedAudioBitrates);
43 | }
44 | } // namespace lms::db
45 |
--------------------------------------------------------------------------------
/src/libs/database/impl/Utils.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "Utils.hpp"
21 |
22 | #include "core/String.hpp"
23 |
24 | namespace lms::db::utils
25 | {
26 | std::string escapeLikeKeyword(std::string_view keyword)
27 | {
28 | return core::stringUtils::escapeString(keyword, "%_", escapeChar);
29 | }
30 |
31 | Wt::WDateTime normalizeDateTime(const Wt::WDateTime& dateTime)
32 | {
33 | // force second resolution
34 | return Wt::WDateTime::fromTime_t(dateTime.toTime_t());
35 | }
36 | } // namespace lms::db::utils
37 |
--------------------------------------------------------------------------------
/src/libs/database/impl/traits/StringViewTraits.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 |
26 | namespace Wt::Dbo
27 | {
28 | template<>
29 | struct sql_value_traits
30 | {
31 | static void bind(std::string_view str, SqlStatement* statement, int column, int /* size */)
32 | {
33 | statement->bind(column, std::string{ str });
34 | }
35 | };
36 | } // namespace Wt::Dbo
37 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ArtistId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ArtistId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ArtistInfoId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ArtistInfoId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/AuthTokenId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(AuthTokenId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ClusterId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ClusterId)
25 | LMS_DECLARE_IDTYPE(ClusterTypeId)
26 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/CountryId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(CountryId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/DirectoryId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(DirectoryId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ImageId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ImageId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/LabelId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(LabelId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ListenId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ListenId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/MediaLibraryId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(MediaLibraryId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/RatedArtistId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(RatedArtistId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/RatedReleaseId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(RatedReleaseId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/RatedTrackId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(RatedTrackId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ReleaseId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ReleaseId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/ReleaseTypeId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(ReleaseTypeId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/StarredArtistId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(StarredArtistId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/StarredReleaseId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(StarredReleaseId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/StarredTrackId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(StarredTrackId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/TrackEmbeddedImageId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(TrackEmbeddedImageId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/TrackEmbeddedImageLinkId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(TrackEmbeddedImageLinkId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/TrackId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(TrackId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/TrackListId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(TrackListId)
25 | LMS_DECLARE_IDTYPE(TrackListEntryId)
26 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/UIStateId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(UIStateId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/include/database/UserId.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/IdType.hpp"
23 |
24 | LMS_DECLARE_IDTYPE(UserId)
25 |
--------------------------------------------------------------------------------
/src/libs/database/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(test-database
3 | Artist.cpp
4 | ArtistInfo.cpp
5 | AuthToken.cpp
6 | Cluster.cpp
7 | Common.cpp
8 | DatabaseTest.cpp
9 | Directory.cpp
10 | Image.cpp
11 | Listen.cpp
12 | Migration.cpp
13 | PlayListFile.cpp
14 | RatedArtist.cpp
15 | RatedRelease.cpp
16 | RatedTrack.cpp
17 | Release.cpp
18 | ScanSettings.cpp
19 | StarredArtist.cpp
20 | StarredRelease.cpp
21 | StarredTrack.cpp
22 | Track.cpp
23 | TrackArtistLink.cpp
24 | TrackBookmark.cpp
25 | TrackEmbeddedImage.cpp
26 | TrackFeatures.cpp
27 | TrackList.cpp
28 | TrackLyrics.cpp
29 | User.cpp
30 | )
31 |
32 | target_link_libraries(test-database PRIVATE
33 | lmsdatabase
34 | GTest::GTest
35 | )
36 |
37 | if (NOT CMAKE_CROSSCOMPILING)
38 | gtest_discover_tests(test-database)
39 | endif()
40 |
41 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/Exception.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "Exception.hpp"
21 |
22 | #include "StbImage.hpp"
23 |
24 | namespace lms::image
25 | {
26 | StbiException::StbiException(std::string_view desc)
27 | : Exception{ std::string{ desc } + ": " + getLastFailureReason() }
28 | {
29 | }
30 |
31 | std::string StbiException::getLastFailureReason()
32 | {
33 | const char* failureReason{ ::stbi_failure_reason() };
34 | return failureReason ? failureReason : "unknown reason";
35 | }
36 | } // namespace lms::image
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "image/Exception.hpp"
25 |
26 | namespace lms::image
27 | {
28 | class StbiException : public Exception
29 | {
30 | public:
31 | StbiException(std::string_view desc);
32 |
33 | private:
34 | static std::string getLastFailureReason();
35 | };
36 | } // namespace lms::image
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImage.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #define STB_IMAGE_IMPLEMENTATION
21 | #include "StbImage.hpp"
22 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImage.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 | #pragma once
20 |
21 | #define STBI_ONLY_JPEG
22 | #define STBI_ONLY_PNG
23 | #define STBI_ONLY_BMP
24 | #define STBI_FAILURE_USERMSG
25 |
26 | #include
27 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImageResize.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #define STB_IMAGE_RESIZE_IMPLEMENTATION
21 | #include "StbImageResize.hpp"
22 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImageResize.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #define STBIR_DEFAULT_FILTER_DOWNSAMPLE STBIR_FILTER_MITCHELL
23 | #define STBIR_DEFAULT_FILTER_UPSAMPLE STBIR_FILTER_CATMULLROM
24 |
25 | #if STB_IMAGE_RESIZE_VERSION == 1
26 | #include
27 | #elif STB_IMAGE_RESIZE_VERSION == 2
28 | #include
29 | #else
30 | #error "Unhandled STB image resize version"!
31 | #endif
32 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImageWrite.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #define STB_IMAGE_WRITE_IMPLEMENTATION
21 | #include "StbImageWrite.hpp"
22 |
--------------------------------------------------------------------------------
/src/libs/image/impl/stb/StbImageWrite.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 | #pragma once
20 |
21 | #include
--------------------------------------------------------------------------------
/src/libs/image/include/image/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/Exception.hpp"
23 |
24 | namespace lms::image
25 | {
26 | class Exception : public core::LmsException
27 | {
28 | public:
29 | using LmsException::LmsException;
30 | };
31 | } // namespace lms::image
32 |
--------------------------------------------------------------------------------
/src/libs/image/include/image/IEncodedImage.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace lms::image
27 | {
28 | using ImageSize = std::size_t;
29 |
30 | class IEncodedImage
31 | {
32 | public:
33 | virtual ~IEncodedImage() = default;
34 |
35 | virtual std::span getData() const = 0;
36 | virtual std::string_view getMimeType() const = 0;
37 | };
38 | } // namespace lms::image
--------------------------------------------------------------------------------
/src/libs/image/include/image/IRawImage.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "image/Types.hpp"
23 |
24 | namespace lms::image
25 | {
26 | class IRawImage
27 | {
28 | public:
29 | virtual ~IRawImage() = default;
30 |
31 | virtual ImageSize getWidth() const = 0;
32 | virtual ImageSize getHeight() const = 0;
33 |
34 | virtual void resize(ImageSize width) = 0;
35 | };
36 | } // namespace lms::image
37 |
--------------------------------------------------------------------------------
/src/libs/image/include/image/Types.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::image
25 | {
26 | using ImageSize = std::size_t;
27 |
28 | struct ImageProperties
29 | {
30 | ImageSize width{};
31 | ImageSize height{};
32 | };
33 | } // namespace lms::image
--------------------------------------------------------------------------------
/src/libs/metadata/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | pkg_check_modules(Taglib REQUIRED IMPORTED_TARGET taglib)
2 |
3 | if(BUILD_TESTING)
4 | add_subdirectory(test)
5 | endif()
6 |
7 | if (BUILD_BENCHMARKS)
8 | add_subdirectory(bench)
9 | endif()
10 |
11 | add_library(lmsmetadata STATIC
12 | impl/ArtistInfo.cpp
13 | impl/AudioFileParser.cpp
14 | impl/AvFormatImageReader.cpp
15 | impl/AvFormatTagReader.cpp
16 | impl/Lyrics.cpp
17 | impl/PlayList.cpp
18 | impl/TagLibImageReader.cpp
19 | impl/TagLibTagReader.cpp
20 | impl/Utils.cpp
21 | )
22 |
23 | target_include_directories(lmsmetadata INTERFACE
24 | include
25 | )
26 |
27 | target_include_directories(lmsmetadata PRIVATE
28 | include
29 | )
30 |
31 | target_link_libraries(lmsmetadata PRIVATE
32 | lmsav
33 | PkgConfig::Taglib
34 | )
35 |
36 | target_link_libraries(lmsmetadata PUBLIC
37 | lmscore
38 | std::filesystem
39 | )
40 |
--------------------------------------------------------------------------------
/src/libs/metadata/bench/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(bench-metadata
3 | LyricsBench.cpp
4 | Metadata.cpp
5 | )
6 |
7 | target_include_directories(bench-metadata PRIVATE
8 | ../impl
9 | ../test
10 | )
11 |
12 | target_link_libraries(bench-metadata PRIVATE
13 | lmsmetadata
14 | benchmark
15 | )
16 |
--------------------------------------------------------------------------------
/src/libs/metadata/impl/IImageReader.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "metadata/Types.hpp"
25 |
26 | namespace lms::metadata
27 | {
28 | class IImageReader
29 | {
30 | public:
31 | virtual ~IImageReader() = default;
32 |
33 | using ImageVisitor = std::function;
34 | virtual void visitImages(ImageVisitor visitor) const = 0;
35 | };
36 | } // namespace lms::metadata
37 |
--------------------------------------------------------------------------------
/src/libs/metadata/impl/TagLibDefs.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | // TAGLIB_HAS_MP4_ITEM_TYPE if version >= 2.0.1
25 | #if ((TAGLIB_MAJOR_VERSION > 2) || (TAGLIB_MAJOR_VERSION == 2 && TAGLIB_MINOR_VERSION > 0) || (TAGLIB_MAJOR_VERSION == 2 && TAGLIB_PATCH_VERSION >= 1))
26 | #define TAGLIB_HAS_MP4_ITEM_TYPE 1
27 | #endif
28 |
29 | // TAGLIB_HAS_APE_COMPLEX_PROPERTIES if version >= 2.0.2
30 | #if ((TAGLIB_MAJOR_VERSION > 2) || (TAGLIB_MAJOR_VERSION == 2 && TAGLIB_MINOR_VERSION > 0) || (TAGLIB_MAJOR_VERSION == 2 && TAGLIB_PATCH_VERSION >= 2))
31 | #define TAGLIB_HAS_APE_COMPLEX_PROPERTIES 1
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/libs/metadata/impl/TagLibImageReader.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2025 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "IImageReader.hpp"
23 |
24 | #include
25 |
26 | namespace lms::metadata
27 | {
28 | class TagLibImageReader : public IImageReader
29 | {
30 | public:
31 | TagLibImageReader(const std::filesystem::path& p);
32 |
33 | void visitImages(ImageVisitor visitor) const override;
34 |
35 | const TagLib::FileRef _file;
36 | };
37 | } // namespace lms::metadata
38 |
--------------------------------------------------------------------------------
/src/libs/metadata/include/metadata/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/Exception.hpp"
23 |
24 | namespace lms::metadata
25 | {
26 | class Exception : public core::LmsException
27 | {
28 | public:
29 | using LmsException::LmsException;
30 | };
31 |
32 | class ParseException : public Exception
33 | {
34 | public:
35 | using Exception::Exception;
36 | };
37 | } // namespace lms::metadata
--------------------------------------------------------------------------------
/src/libs/metadata/include/metadata/PlayList.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace lms::metadata
29 | {
30 | struct PlayList
31 | {
32 | std::string name;
33 | std::vector files;
34 | };
35 |
36 | std::span getSupportedPlayListFileExtensions();
37 | PlayList parsePlayList(std::istream& is);
38 | } // namespace lms::metadata
39 |
--------------------------------------------------------------------------------
/src/libs/metadata/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GoogleTest)
2 |
3 | add_executable(test-metadata
4 | ArtistInfo.cpp
5 | Lyrics.cpp
6 | Metadata.cpp
7 | AudioFileParser.cpp
8 | PlayList.cpp
9 | Utils.cpp
10 | )
11 |
12 | target_include_directories(test-metadata PRIVATE
13 | ../impl
14 | )
15 |
16 | target_link_libraries(test-metadata PRIVATE
17 | lmsmetadata
18 | GTest::GTest
19 | )
20 |
21 | if (NOT CMAKE_CROSSCOMPILING)
22 | gtest_discover_tests(test-metadata)
23 | endif()
24 |
25 |
--------------------------------------------------------------------------------
/src/libs/metadata/test/Metadata.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 |
22 | int main(int argc, char** argv)
23 | {
24 | ::testing::InitGoogleTest(&argc, argv);
25 | return RUN_ALL_TESTS();
26 | }
27 |
--------------------------------------------------------------------------------
/src/libs/services/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(artwork)
2 | add_subdirectory(auth)
3 | add_subdirectory(feedback)
4 | add_subdirectory(recommendation)
5 | add_subdirectory(scanner)
6 | add_subdirectory(scrobbling)
7 |
--------------------------------------------------------------------------------
/src/libs/services/artwork/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(lmsartwork STATIC
3 | impl/ImageCache.cpp
4 | impl/ArtworkService.cpp
5 | )
6 |
7 | target_include_directories(lmsartwork INTERFACE
8 | include
9 | )
10 |
11 | target_include_directories(lmsartwork PRIVATE
12 | include
13 | impl
14 | )
15 |
16 | target_link_libraries(lmsartwork PRIVATE
17 | lmsimage
18 | lmsmetadata
19 | )
20 |
21 | target_link_libraries(lmsartwork PUBLIC
22 | lmsdatabase
23 | lmsimage
24 | lmscore
25 | std::filesystem
26 | )
27 |
--------------------------------------------------------------------------------
/src/libs/services/auth/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(lmsauth STATIC
3 | impl/AuthTokenService.cpp
4 | impl/AuthServiceBase.cpp
5 | impl/EnvService.cpp
6 | impl/LoginThrottler.cpp
7 | impl/PasswordServiceBase.cpp
8 | impl/http-headers/HttpHeadersEnvService.cpp
9 | impl/internal/InternalPasswordService.cpp
10 | )
11 |
12 | target_include_directories(lmsauth INTERFACE
13 | include
14 | )
15 |
16 | target_include_directories(lmsauth PRIVATE
17 | include
18 | impl
19 | )
20 |
21 | target_link_libraries(lmsauth PRIVATE
22 | lmscore
23 | lmsdatabase
24 | )
25 |
26 | target_link_libraries(lmsauth PUBLIC
27 | Boost::system
28 | Wt::Wt
29 | )
30 |
31 | # PAM
32 | option(USE_PAM "Use the PAM backend authentication API" ON)
33 | if (USE_PAM)
34 | find_package(PAM QUIET)
35 | if (USE_PAM AND NOT PAM_FOUND)
36 | message(WARNING "PAM library not found: disabling")
37 | set(USE_PAM OFF)
38 | endif ()
39 | endif ()
40 |
41 | if (USE_PAM)
42 | message(STATUS "Using PAM authentication backend")
43 | else ()
44 | message(STATUS "NOT using PAM authentication backend")
45 | endif ()
46 |
47 | if (USE_PAM)
48 | target_compile_options(lmsauth PRIVATE "-DLMS_SUPPORT_PAM")
49 | target_sources(lmsauth PRIVATE impl/pam/PAMPasswordService.cpp)
50 | target_include_directories(lmsauth PRIVATE ${PAM_INCLUDE_DIR})
51 | target_link_libraries(lmsauth PRIVATE ${PAM_LIBRARIES})
52 | endif (USE_PAM)
53 |
--------------------------------------------------------------------------------
/src/libs/services/auth/impl/EnvService.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "services/auth/IEnvService.hpp"
21 |
22 | #include "services/auth/Types.hpp"
23 |
24 | #include "http-headers/HttpHeadersEnvService.hpp"
25 |
26 | namespace lms::auth
27 | {
28 | std::unique_ptr createEnvService(std::string_view backendName, db::Db& db)
29 | {
30 | if (backendName == "http-headers")
31 | return std::make_unique(db);
32 |
33 | throw Exception{ "Authentication backend '" + std::string{ backendName } + "' is not supported!" };
34 | }
35 | } // namespace lms::auth
36 |
--------------------------------------------------------------------------------
/src/libs/services/auth/impl/http-headers/HttpHeadersEnvService.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "services/auth/IEnvService.hpp"
23 |
24 | #include "AuthServiceBase.hpp"
25 |
26 | namespace lms::auth
27 | {
28 | class HttpHeadersEnvService : public IEnvService, public AuthServiceBase
29 | {
30 | public:
31 | HttpHeadersEnvService(db::Db& db);
32 |
33 | private:
34 | CheckResult processEnv(const Wt::WEnvironment& env) override;
35 | CheckResult processRequest(const Wt::Http::Request& request) override;
36 |
37 | std::string _fieldName;
38 | };
39 |
40 | } // namespace lms::auth
41 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(lmsfeedback STATIC
3 | impl/internal/InternalBackend.cpp
4 | impl/listenbrainz/FeedbacksParser.cpp
5 | impl/listenbrainz/FeedbacksSynchronizer.cpp
6 | impl/listenbrainz/FeedbackTypes.cpp
7 | impl/listenbrainz/ListenBrainzBackend.cpp
8 | impl/listenbrainz/Utils.cpp
9 | impl/FeedbackService.cpp
10 | )
11 |
12 | target_include_directories(lmsfeedback INTERFACE
13 | include
14 | )
15 |
16 | target_include_directories(lmsfeedback PRIVATE
17 | include
18 | impl
19 | )
20 |
21 | target_link_libraries(lmsfeedback PRIVATE
22 | lmscore
23 | )
24 |
25 | target_link_libraries(lmsfeedback PUBLIC
26 | lmsdatabase
27 | )
28 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/impl/listenbrainz/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "services/feedback/Exception.hpp"
23 |
24 | namespace lms::feedback::listenBrainz
25 | {
26 | class Exception : public feedback::Exception
27 | {
28 | public:
29 | using feedback::Exception::Exception;
30 | };
31 | } // namespace lms::feedback::listenBrainz
32 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/impl/listenbrainz/FeedbackTypes.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "FeedbackTypes.hpp"
21 |
22 | #include
23 |
24 | namespace lms::feedback::listenBrainz
25 | {
26 | std::ostream& operator<<(std::ostream& os, const Feedback& feedback)
27 | {
28 | os << "created = '" << feedback.created.toString() << "', recording MBID = '" << feedback.recordingMBID.getAsString() << "', score = " << static_cast(feedback.score);
29 | return os;
30 | }
31 | } // namespace lms::feedback::listenBrainz
32 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/impl/listenbrainz/FeedbacksParser.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "FeedbackTypes.hpp"
25 |
26 | namespace lms::feedback::listenBrainz
27 | {
28 | class FeedbacksParser
29 | {
30 | public:
31 | struct Result
32 | {
33 | std::size_t feedbackCount{}; // >= feedbacks.size()
34 | std::vector feedbacks;
35 | };
36 |
37 | static Result parse(std::string_view msgBody);
38 | };
39 |
40 | } // namespace lms::feedback::listenBrainz
41 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/impl/listenbrainz/Utils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/ILogger.hpp"
23 | #include "core/UUID.hpp"
24 | #include "database/UserId.hpp"
25 |
26 | #define LOG(sev, message) LMS_LOG(FEEDBACK, sev, "[listenbrainz] " << message)
27 |
28 | namespace lms::db
29 | {
30 | class Session;
31 | }
32 |
33 | namespace lms::feedback::listenBrainz::utils
34 | {
35 | std::optional getListenBrainzToken(db::Session& session, db::UserId userId);
36 | std::string parseValidateToken(std::string_view msgBody);
37 | } // namespace lms::feedback::listenBrainz::utils
38 |
--------------------------------------------------------------------------------
/src/libs/services/feedback/include/services/feedback/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/Exception.hpp"
23 |
24 | namespace lms::feedback
25 | {
26 | class Exception : public core::LmsException
27 | {
28 | public:
29 | using LmsException::LmsException;
30 | };
31 | } // namespace lms::feedback
32 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(lmsrecommendation STATIC
3 | impl/clusters/ClustersEngine.cpp
4 | impl/features/FeaturesEngineCache.cpp
5 | impl/features/FeaturesEngine.cpp
6 | impl/features/FeaturesDefs.cpp
7 | impl/playlist-constraints/ConsecutiveArtists.cpp
8 | impl/playlist-constraints/ConsecutiveReleases.cpp
9 | impl/playlist-constraints/DuplicateTracks.cpp
10 | impl/PlaylistGeneratorService.cpp
11 | impl/RecommendationService.cpp
12 | )
13 |
14 | target_include_directories(lmsrecommendation INTERFACE
15 | include
16 | )
17 |
18 | target_include_directories(lmsrecommendation PRIVATE
19 | impl
20 | include
21 | )
22 |
23 | target_link_libraries(lmsrecommendation PRIVATE
24 | lmsdatabase
25 | lmssom
26 | std::filesystem
27 | )
28 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/impl/ClustersEngineCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::db
25 | {
26 | class Db;
27 | }
28 |
29 | namespace lms::recommendation
30 | {
31 | class IEngine;
32 | std::unique_ptr createClustersEngine(db::Db& db);
33 | } // namespace lms::recommendation
34 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/impl/FeaturesEngineCreator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "IEngine.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Db;
29 | }
30 |
31 | namespace lms::recommendation
32 | {
33 | std::unique_ptr createFeaturesEngine(db::Db& db);
34 | }
35 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/impl/playlist-constraints/DuplicateTracks.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "DuplicateTracks.hpp"
21 |
22 | #include
23 |
24 | namespace lms::recommendation::PlaylistGeneratorConstraint
25 | {
26 | float DuplicateTracks::computeScore(const std::vector& trackIds, std::size_t trackIndex)
27 | {
28 | const auto count{ std::count(std::cbegin(trackIds), std::cend(trackIds), trackIds[trackIndex]) };
29 | return count == 1 ? 0 : 1'000;
30 | }
31 | } // namespace lms::recommendation::PlaylistGeneratorConstraint
32 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/impl/playlist-constraints/DuplicateTracks.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "IConstraint.hpp"
23 |
24 | namespace lms::recommendation::PlaylistGeneratorConstraint
25 | {
26 | class DuplicateTracks : public IConstraint
27 | {
28 | private:
29 | float computeScore(const std::vector& trackIds, std::size_t trackIndex) override;
30 | };
31 | } // namespace lms::recommendation::PlaylistGeneratorConstraint
32 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/impl/playlist-constraints/IConstraint.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "services/recommendation/Types.hpp"
23 |
24 | namespace lms::recommendation::PlaylistGeneratorConstraint
25 | {
26 | class IConstraint
27 | {
28 | public:
29 | virtual ~IConstraint() = default;
30 |
31 | // compute the score of the track at index trackIndex
32 | // 0: best
33 | // 1: worst
34 | // > 1 : violation
35 | virtual float computeScore(const TrackContainer& trackIds, std::size_t trackIndex) = 0;
36 | };
37 | } // namespace lms::recommendation::PlaylistGeneratorConstraint
38 |
--------------------------------------------------------------------------------
/src/libs/services/recommendation/include/services/recommendation/Types.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "database/ArtistId.hpp"
6 | #include "database/ReleaseId.hpp"
7 | #include "database/TrackId.hpp"
8 |
9 | namespace lms::recommendation
10 | {
11 | struct Progress
12 | {
13 | std::size_t totalElems{};
14 | std::size_t processedElems{};
15 | };
16 | using ProgressCallback = std::function;
17 |
18 | template
19 | using ResultContainer = std::vector;
20 |
21 | using ArtistContainer = ResultContainer;
22 | using ReleaseContainer = ResultContainer;
23 | using TrackContainer = ResultContainer;
24 |
25 | } // namespace lms::recommendation
26 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/MediaLibraryInfo.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "database/MediaLibraryId.hpp"
25 |
26 | namespace lms::scanner
27 | {
28 | struct MediaLibraryInfo
29 | {
30 | db::MediaLibraryId id;
31 | std::filesystem::path rootDirectory;
32 | bool firstScan{};
33 |
34 | auto operator<=>(const MediaLibraryInfo& other) const = default;
35 | };
36 | } // namespace lms::scanner
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/ScanContext.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "services/scanner/ScannerOptions.hpp"
23 | #include "services/scanner/ScannerStats.hpp"
24 |
25 | namespace lms::scanner
26 | {
27 | struct ScanContext
28 | {
29 | ScanOptions scanOptions;
30 | ScanStats stats;
31 | ScanStepStats currentStepStats;
32 | };
33 | } // namespace lms::scanner
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/scanners/FileToScan.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "MediaLibraryInfo.hpp"
25 |
26 | namespace lms::scanner
27 | {
28 | struct FileToScan
29 | {
30 | std::filesystem::path file;
31 | MediaLibraryInfo mediaLibrary;
32 | };
33 | } // namespace lms::scanner
34 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/scanners/IFileScanOperation.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "core/LiteralString.hpp"
25 |
26 | namespace lms::scanner
27 | {
28 | struct ScanContext;
29 |
30 | class IFileScanOperation
31 | {
32 | public:
33 | virtual ~IFileScanOperation() = default;
34 |
35 | virtual core::LiteralString getName() const = 0;
36 |
37 | virtual const std::filesystem::path& getFile() const = 0;
38 | virtual void scan() = 0;
39 | virtual void processResult(ScanContext& context) = 0;
40 | };
41 | } // namespace lms::scanner
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/IScanStep.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/LiteralString.hpp"
23 |
24 | #include "ScanContext.hpp"
25 |
26 | namespace lms::scanner
27 | {
28 | class IScanStep
29 | {
30 | public:
31 | virtual ~IScanStep() = default;
32 |
33 | virtual ScanStep getStep() const = 0;
34 | virtual core::LiteralString getStepName() const = 0;
35 | virtual bool needProcess(const ScanContext& context) const = 0;
36 | virtual void process(ScanContext& context) = 0;
37 | };
38 | } // namespace lms::scanner
39 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepBase.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "ScanStepBase.hpp"
21 |
22 | namespace lms::scanner
23 | {
24 | ScanStepBase::ScanStepBase(InitParams& initParams)
25 | : _settings{ initParams.settings }
26 | , _progressCallback{ initParams.progressCallback }
27 | , _abortScan{ initParams.abortScan }
28 | , _db{ initParams.db }
29 | , _fileScanners(std::cbegin(initParams.fileScanners), std::cend(initParams.fileScanners))
30 | , _lastScanSettings{ initParams.lastScanSettings }
31 | {
32 | }
33 |
34 | ScanStepBase::~ScanStepBase() = default;
35 | } // namespace lms::scanner
36 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepCompact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "ScanStepCompact.hpp"
21 |
22 | #include "database/Db.hpp"
23 | #include "database/Session.hpp"
24 |
25 | namespace lms::scanner
26 | {
27 | bool ScanStepCompact::needProcess(const ScanContext& context) const
28 | {
29 | // Don't auto compact as it may be too annoying to block the whole application for very large databases
30 | return context.scanOptions.compact;
31 | }
32 |
33 | void ScanStepCompact::process([[maybe_unused]] ScanContext& context)
34 | {
35 | _db.getTLSSession().vacuum();
36 | }
37 | } // namespace lms::scanner
38 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepCompact.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ScanStepBase.hpp"
23 |
24 | namespace lms::scanner
25 | {
26 | class ScanStepCompact : public ScanStepBase
27 | {
28 | public:
29 | using ScanStepBase::ScanStepBase;
30 |
31 | private:
32 | ScanStep getStep() const override { return ScanStep::Compact; }
33 | core::LiteralString getStepName() const override { return "Compact"; }
34 | bool needProcess(const ScanContext& context) const override;
35 | void process(ScanContext& context) override;
36 | };
37 | } // namespace lms::scanner
38 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepComputeClusterStats.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ScanStepBase.hpp"
23 |
24 | namespace lms::scanner
25 | {
26 | class ScanStepComputeClusterStats : public ScanStepBase
27 | {
28 | public:
29 | using ScanStepBase::ScanStepBase;
30 |
31 | private:
32 | ScanStep getStep() const override { return ScanStep::ComputeClusterStats; }
33 | core::LiteralString getStepName() const override { return "Compute cluster stats"; }
34 | bool needProcess(const ScanContext& context) const override;
35 | void process(ScanContext& context) override;
36 | };
37 | } // namespace lms::scanner
38 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepDiscoverFiles.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ScanStepBase.hpp"
23 |
24 | namespace lms::scanner
25 | {
26 | class ScanStepDiscoverFiles : public ScanStepBase
27 | {
28 | public:
29 | using ScanStepBase::ScanStepBase;
30 |
31 | private:
32 | ScanStep getStep() const override { return ScanStep::DiscoverFiles; }
33 | core::LiteralString getStepName() const override { return "Discover files"; }
34 | bool needProcess(const ScanContext& context) const override;
35 | void process(ScanContext& context) override;
36 | };
37 | } // namespace lms::scanner
38 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/impl/steps/ScanStepOptimize.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "ScanStepBase.hpp"
23 |
24 | namespace lms::scanner
25 | {
26 | class ScanStepOptimize : public ScanStepBase
27 | {
28 | public:
29 | using ScanStepBase::ScanStepBase;
30 |
31 | private:
32 | ScanStep getStep() const override { return ScanStep::Optimize; }
33 | core::LiteralString getStepName() const override { return "Optimize"; }
34 | bool needProcess(const ScanContext& context) const override;
35 | void process(ScanContext& context) override;
36 | };
37 | } // namespace lms::scanner
38 |
--------------------------------------------------------------------------------
/src/libs/services/scanner/include/services/scanner/ScannerOptions.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace lms::scanner
23 | {
24 | struct ScanOptions
25 | {
26 | bool fullScan{}; // scan files even if not changed
27 | bool forceOptimize{}; // force optimize database
28 | bool compact{}; // compact the database
29 | };
30 | } // namespace lms::scanner
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(lmsscrobbling STATIC
3 | impl/internal/InternalBackend.cpp
4 | impl/listenbrainz/ListenBrainzBackend.cpp
5 | impl/listenbrainz/ListenTypes.cpp
6 | impl/listenbrainz/ListensParser.cpp
7 | impl/listenbrainz/ListensSynchronizer.cpp
8 | impl/listenbrainz/Utils.cpp
9 | impl/ScrobblingService.cpp
10 | )
11 |
12 | target_include_directories(lmsscrobbling INTERFACE
13 | include
14 | )
15 |
16 | target_include_directories(lmsscrobbling PRIVATE
17 | include
18 | impl
19 | )
20 |
21 | target_link_libraries(lmsscrobbling PRIVATE
22 | lmscore
23 | )
24 |
25 | target_link_libraries(lmsscrobbling PUBLIC
26 | lmsdatabase
27 | )
28 |
29 | if(BUILD_TESTING)
30 | add_subdirectory(test)
31 | endif()
32 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/impl/listenbrainz/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "services/scrobbling/Exception.hpp"
23 |
24 | namespace lms::scrobbling::listenBrainz
25 | {
26 | class Exception : public scrobbling::Exception
27 | {
28 | public:
29 | using scrobbling::Exception::Exception;
30 | };
31 | } // namespace lms::scrobbling::listenBrainz
32 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/impl/listenbrainz/ListensParser.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "ListenTypes.hpp"
25 |
26 | namespace lms::scrobbling::listenBrainz
27 | {
28 | class ListensParser
29 | {
30 | public:
31 | struct Result
32 | {
33 | std::size_t listenCount{}; // may be > than listens.size()
34 | std::vector listens; // successfully parsed listens
35 | };
36 |
37 | static Result parse(std::string_view msgBody);
38 | };
39 | } // namespace lms::scrobbling::listenBrainz
40 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/impl/listenbrainz/Utils.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/ILogger.hpp"
23 | #include "core/UUID.hpp"
24 | #include "database/UserId.hpp"
25 |
26 | #define LOG(sev, message) LMS_LOG(SCROBBLING, sev, "[listenbrainz] " << message)
27 |
28 | namespace lms::db
29 | {
30 | class Session;
31 | }
32 |
33 | namespace lms::scrobbling::listenBrainz::utils
34 | {
35 | std::optional getListenBrainzToken(db::Session& session, db::UserId userId);
36 | std::string parseValidateToken(std::string_view msgBody);
37 | } // namespace lms::scrobbling::listenBrainz::utils
38 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/include/services/scrobbling/Exception.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/Exception.hpp"
23 |
24 | namespace lms::scrobbling
25 | {
26 | class Exception : public core::LmsException
27 | {
28 | public:
29 | using LmsException::LmsException;
30 | };
31 | } // namespace lms::scrobbling
32 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/include/services/scrobbling/Listen.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "database/TrackId.hpp"
25 | #include "database/UserId.hpp"
26 |
27 | namespace lms::scrobbling
28 | {
29 | struct Listen
30 | {
31 | db::UserId userId{};
32 | db::TrackId trackId{};
33 | };
34 |
35 | struct TimedListen : public Listen
36 | {
37 | Wt::WDateTime listenedAt;
38 | };
39 | } // namespace lms::scrobbling
40 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(test-scrobbling
3 | Listenbrainz.cpp
4 | Scrobbling.cpp
5 | )
6 |
7 | target_link_libraries(test-scrobbling PRIVATE
8 | lmscore
9 | lmsscrobbling
10 | GTest::GTest
11 | )
12 |
13 | target_include_directories(test-scrobbling PRIVATE
14 | ../impl
15 | )
16 |
17 | if (NOT CMAKE_CROSSCOMPILING)
18 | gtest_discover_tests(test-scrobbling)
19 | endif()
20 |
21 |
--------------------------------------------------------------------------------
/src/libs/services/scrobbling/test/Scrobbling.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "core/ILogger.hpp"
23 | #include "core/Service.hpp"
24 | #include "core/StreamLogger.hpp"
25 |
26 | int main(int argc, char** argv)
27 | {
28 | using namespace lms;
29 | // log to stdout
30 | core::Service logger{ std::make_unique(std::cout, core::EnumSet{ core::logging::Severity::FATAL, core::logging::Severity::ERROR }) };
31 |
32 | ::testing::InitGoogleTest(&argc, argv);
33 | return RUN_ALL_TESTS();
34 | }
35 |
--------------------------------------------------------------------------------
/src/libs/som/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(lmssom STATIC
2 | impl/DataNormalizer.cpp
3 | impl/Network.cpp
4 | )
5 |
6 | target_include_directories(lmssom INTERFACE
7 | include
8 | )
9 |
10 | target_include_directories(lmssom PRIVATE
11 | include
12 | )
13 |
14 | target_link_libraries(lmssom PUBLIC
15 | lmscore
16 | )
17 |
18 | set_property(TARGET lmssom PROPERTY POSITION_INDEPENDENT_CODE ON)
19 |
20 | if(BUILD_TESTING)
21 | add_subdirectory(test)
22 | endif()
23 |
24 | if (BUILD_BENCHMARKS)
25 | add_subdirectory(bench)
26 | endif()
27 |
--------------------------------------------------------------------------------
/src/libs/som/bench/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(bench-som
3 | SomBench.cpp
4 | )
5 |
6 | target_link_libraries(bench-som PRIVATE
7 | lmssom
8 | benchmark
9 | )
10 |
--------------------------------------------------------------------------------
/src/libs/som/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GoogleTest)
2 |
3 | add_executable(test-som
4 | SomTest.cpp
5 | )
6 |
7 | target_link_libraries(test-som PRIVATE
8 | lmssom
9 | GTest::GTest
10 | )
11 |
12 | if (NOT CMAKE_CROSSCOMPILING)
13 | gtest_discover_tests(test-som)
14 | endif()
15 |
16 |
--------------------------------------------------------------------------------
/src/libs/subsonic/bench/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(bench-subsonic
2 | SubsonicBench.cpp
3 | )
4 |
5 | target_include_directories(bench-subsonic PRIVATE
6 | ../impl
7 | )
8 |
9 | target_link_libraries(bench-subsonic PRIVATE
10 | lmscore
11 | lmsdatabase
12 | lmssubsonic
13 | benchmark
14 | )
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/ClientInfo.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "ProtocolVersion.hpp"
25 |
26 | namespace lms::api::subsonic
27 | {
28 | struct ClientInfo
29 | {
30 | std::string name;
31 | ProtocolVersion version;
32 | };
33 | } // namespace lms::api::subsonic
34 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/ResponseFormat.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "ResponseFormat.hpp"
21 |
22 | #include
23 |
24 | namespace lms::api::subsonic
25 | {
26 | std::string_view ResponseFormatToMimeType(ResponseFormat format)
27 | {
28 | switch (format)
29 | {
30 | case ResponseFormat::xml:
31 | return "text/xml";
32 | case ResponseFormat::json:
33 | return "application/json";
34 | }
35 |
36 | return "";
37 | }
38 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/ResponseFormat.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::api::subsonic
25 | {
26 | enum class ResponseFormat
27 | {
28 | xml,
29 | json,
30 | };
31 |
32 | std::string_view ResponseFormatToMimeType(ResponseFormat format);
33 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/AlbumSongLists.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleGetAlbumListRequest(RequestContext& context);
28 | Response handleGetAlbumList2Request(RequestContext& context);
29 | Response handleGetRandomSongsRequest(RequestContext& context);
30 | Response handleGetSongsByGenreRequest(RequestContext& context);
31 | Response handleGetStarredRequest(RequestContext& context);
32 | Response handleGetStarred2Request(RequestContext& context);
33 | } // namespace lms::api::subsonic
34 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/Bookmarks.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleGetBookmarks(RequestContext& context);
28 | Response handleCreateBookmark(RequestContext& context);
29 | Response handleDeleteBookmark(RequestContext& context);
30 | Response handleGetPlayQueue(RequestContext& context);
31 | Response handleSavePlayQueue(RequestContext& context);
32 | } // namespace lms::api::subsonic
33 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/MediaAnnotation.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleStarRequest(RequestContext& context);
28 | Response handleUnstarRequest(RequestContext& context);
29 | Response handleSetRating(RequestContext& context);
30 | Response handleScrobble(RequestContext& context);
31 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/MediaLibraryScanning.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic::Scan
26 | {
27 | Response handleGetScanStatus(RequestContext& context);
28 | Response handleStartScan(RequestContext& context);
29 | } // namespace lms::api::subsonic::Scan
30 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/Playlists.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleGetPlaylistsRequest(RequestContext& context);
28 | Response handleGetPlaylistRequest(RequestContext& context);
29 | Response handleCreatePlaylistRequest(RequestContext& context);
30 | Response handleUpdatePlaylistRequest(RequestContext& context);
31 | Response handleDeletePlaylistRequest(RequestContext& context);
32 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/Searching.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleSearch2Request(RequestContext& context);
28 | Response handleSearch3Request(RequestContext& context);
29 | } // namespace lms::api::subsonic
30 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/System.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handlePingRequest(RequestContext& context);
28 | Response handleGetLicenseRequest(RequestContext& context);
29 | Response handleGetOpenSubsonicExtensions(RequestContext& context);
30 | } // namespace lms::api::subsonic
31 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/endpoints/UserManagement.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "RequestContext.hpp"
23 | #include "SubsonicResponse.hpp"
24 |
25 | namespace lms::api::subsonic
26 | {
27 | Response handleGetUserRequest(RequestContext& context);
28 | Response handleGetUsersRequest(RequestContext& context);
29 | Response handleCreateUserRequest(RequestContext& context);
30 | Response handleUpdateUserRequest(RequestContext& context);
31 | Response handleDeleteUserRequest(RequestContext& context);
32 | Response handleChangePassword(RequestContext& context);
33 | } // namespace lms::api::subsonic
34 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Album.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Directory;
29 | class Release;
30 | class User;
31 | class Session;
32 | } // namespace lms::db
33 |
34 | namespace lms::api::subsonic
35 | {
36 | struct RequestContext;
37 |
38 | Response::Node createAlbumNode(RequestContext& context, const db::ObjectPtr& release, bool id3, const db::ObjectPtr& directory = {});
39 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/AlbumInfo.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Release;
29 | } // namespace lms::db
30 |
31 | namespace lms::api::subsonic
32 | {
33 | struct RequestContext;
34 |
35 | Response::Node createAlbumInfoNode(RequestContext& context, const db::ObjectPtr& release);
36 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Bookmark.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class TrackBookmark;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | Response::Node createBookmarkNode(const db::ObjectPtr& bookmark);
34 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Contributor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Artist;
29 | class TrackArtistLink;
30 | } // namespace lms::db
31 |
32 | namespace lms::api::subsonic
33 | {
34 | Response::Node createContributorNode(const db::ObjectPtr& trackArtistLink, const db::ObjectPtr& artist);
35 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/DiscTitle.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "responses/DiscTitle.hpp"
21 |
22 | namespace lms::api::subsonic
23 | {
24 | Response::Node createDiscTitle(const db::DiscInfo& discInfo)
25 | {
26 | Response::Node discTitleNode;
27 |
28 | discTitleNode.setAttribute("disc", discInfo.position);
29 | discTitleNode.setAttribute("title", discInfo.name);
30 |
31 | return discTitleNode;
32 | }
33 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/DiscTitle.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Types.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::api::subsonic
27 | {
28 | Response::Node createDiscTitle(const db::DiscInfo& discInfo);
29 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Genre.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Cluster;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | struct RequestContext;
34 |
35 | Response::Node createGenreNode(RequestContext& context, const db::ObjectPtr& cluster);
36 | } // namespace lms::api::subsonic
37 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/ItemDate.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "core/PartialDateTime.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::api::subsonic
27 | {
28 | Response::Node createItemDateNode(const core::PartialDateTime& date);
29 | }
30 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/ItemGenre.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "responses/ItemGenre.hpp"
21 |
22 | #include "database/Cluster.hpp"
23 |
24 | namespace lms::api::subsonic
25 | {
26 | Response::Node createItemGenreNode(std::string_view name)
27 | {
28 | Response::Node genreNode;
29 |
30 | genreNode.setAttribute("name", name);
31 |
32 | return genreNode;
33 | }
34 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/ItemGenre.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Cluster;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | Response::Node createItemGenreNode(std::string_view name);
34 | }
35 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Lyrics.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class TrackLyrics;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | struct RequestContext;
34 |
35 | Response::Node createLyricsNode(RequestContext& context, const db::ObjectPtr& lyrics);
36 | Response::Node createStructuredLyricsNode(RequestContext& context, const db::ObjectPtr& lyrics);
37 | } // namespace lms::api::subsonic
38 |
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Playlist.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class TrackList;
29 | class Session;
30 | } // namespace lms::db
31 |
32 | namespace lms::api::subsonic
33 | {
34 | Response::Node createPlaylistNode(const db::ObjectPtr& tracklist, db::Session& session);
35 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/RecordLabel.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "responses/RecordLabel.hpp"
21 |
22 | #include "database/Release.hpp"
23 |
24 | namespace lms::api::subsonic
25 | {
26 | Response::Node createRecordLabel(const db::ObjectPtr& label)
27 | {
28 | Response::Node recordLabelNode;
29 |
30 | recordLabelNode.setAttribute("name", label->getName());
31 |
32 | return recordLabelNode;
33 | }
34 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/RecordLabel.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Label;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | Response::Node createRecordLabel(const db::ObjectPtr& label);
34 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/ReplayGain.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Track;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | Response::Node createReplayGainNode(const db::ObjectPtr& track);
34 | }
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/Song.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class Track;
29 | class User;
30 | class Session;
31 | } // namespace lms::db
32 |
33 | namespace lms::api::subsonic
34 | {
35 | struct RequestContext;
36 |
37 | Response::Node createSongNode(RequestContext& context, const db::ObjectPtr& track, bool id3);
38 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/impl/responses/User.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include "database/Object.hpp"
23 |
24 | #include "SubsonicResponse.hpp"
25 |
26 | namespace lms::db
27 | {
28 | class User;
29 | }
30 |
31 | namespace lms::api::subsonic
32 | {
33 | struct RequestContext;
34 |
35 | Response::Node createUserNode(RequestContext& context, const db::ObjectPtr& user);
36 | } // namespace lms::api::subsonic
--------------------------------------------------------------------------------
/src/libs/subsonic/include/subsonic/SubsonicResource.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 | #pragma once
20 |
21 | #include
22 |
23 | #include
24 |
25 | namespace lms::db
26 | {
27 | class Db;
28 | }
29 |
30 | namespace lms::api::subsonic
31 | {
32 | std::unique_ptr createSubsonicResource(db::Db& db);
33 | } // namespace lms::api::subsonic
34 |
--------------------------------------------------------------------------------
/src/lms/ui/Auth.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "database/UserId.hpp"
25 |
26 | namespace lms::auth
27 | {
28 | class IPasswordService;
29 | }
30 |
31 | namespace lms::ui
32 | {
33 | enum class AuthenticationBackend
34 | {
35 | Internal,
36 | Env,
37 | PAM,
38 | };
39 |
40 | db::UserId processAuthToken(const Wt::WEnvironment& env);
41 |
42 | class PasswordAuth : public Wt::WTemplateFormView
43 | {
44 | public:
45 | PasswordAuth(auth::IPasswordService& passwordService);
46 |
47 | Wt::Signal userLoggedIn;
48 | };
49 | } // namespace lms::ui
50 |
--------------------------------------------------------------------------------
/src/lms/ui/LmsInitApplication.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 |
23 | #include "LmsInitApplication.hpp"
24 |
25 | namespace lms::ui
26 | {
27 | LmsInitApplication::LmsInitApplication(const Wt::WEnvironment& env)
28 | : Wt::WApplication{ env }
29 | {
30 | enableUpdates(true);
31 | root()->addNew("LMS is initializing. This may take a while, please wait...");
32 | }
33 |
34 | std::unique_ptr LmsInitApplication::create(const Wt::WEnvironment& env)
35 | {
36 | return std::make_unique(env);
37 | }
38 | } // namespace lms::ui
--------------------------------------------------------------------------------
/src/lms/ui/LmsInitApplication.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | class LmsInitApplication : public Wt::WApplication
27 | {
28 | public:
29 | LmsInitApplication(const Wt::WEnvironment& env);
30 |
31 | static std::unique_ptr create(const Wt::WEnvironment& env);
32 | };
33 | } // namespace lms::ui
--------------------------------------------------------------------------------
/src/lms/ui/ModalManager.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace lms::ui
27 | {
28 | class ModalManager : public Wt::WContainerWidget
29 | {
30 | public:
31 | ModalManager();
32 |
33 | // should handle only one modal at a time
34 | // Widget must contain a "modal" element
35 | void show(std::unique_ptr modalWidget);
36 | void dispose(Wt::WWidget* modalWidget);
37 |
38 | private:
39 | Wt::JSignal _closed;
40 | };
41 | } // namespace lms::ui
42 |
--------------------------------------------------------------------------------
/src/lms/ui/Notification.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace lms::ui::Notification
23 | {
24 | enum class Type
25 | {
26 | Info,
27 | Warning,
28 | Danger,
29 | };
30 | } // namespace lms::ui::Notification
31 |
--------------------------------------------------------------------------------
/src/lms/ui/NotificationContainer.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 | #include
26 |
27 | #include "Notification.hpp"
28 |
29 | namespace lms::ui
30 | {
31 | class NotificationContainer : public Wt::WContainerWidget
32 | {
33 | public:
34 | void add(Notification::Type type, const Wt::WString& category, const Wt::WString& message, std::chrono::milliseconds duration);
35 |
36 | private:
37 | };
38 | } // namespace lms::ui
39 |
--------------------------------------------------------------------------------
/src/lms/ui/SettingsView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 |
27 | class SettingsView : public Wt::WContainerWidget
28 | {
29 | public:
30 | SettingsView();
31 |
32 | private:
33 | void refreshView();
34 | };
35 |
36 | } // namespace lms::ui
37 |
--------------------------------------------------------------------------------
/src/lms/ui/Tooltip.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | namespace Wt
23 | {
24 | class WWebWidget;
25 | }
26 |
27 | namespace lms::ui
28 | {
29 | void initTooltipsForWidgetTree(Wt::WWebWidget& widget);
30 | }
--------------------------------------------------------------------------------
/src/lms/ui/admin/InitWizardView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::auth
25 | {
26 | class IPasswordService;
27 | }
28 |
29 | namespace lms::ui
30 | {
31 | class InitWizardView : public Wt::WTemplateFormView
32 | {
33 | public:
34 | InitWizardView(auth::IPasswordService& passwordService);
35 | };
36 |
37 | } // namespace lms::ui
38 |
--------------------------------------------------------------------------------
/src/lms/ui/admin/MediaLibraryModal.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | #include "database/MediaLibraryId.hpp"
26 |
27 | namespace lms::ui
28 | {
29 | class MediaLibraryModal : public Wt::WTemplateFormView
30 | {
31 | public:
32 | MediaLibraryModal(db::MediaLibraryId mediaLibaryId);
33 |
34 | Wt::Signal& saved() { return _saved; };
35 | Wt::Signal<>& cancelled() { return _cancelled; }
36 |
37 | private:
38 | Wt::Signal _saved;
39 | Wt::Signal<> _cancelled;
40 | };
41 | } // namespace lms::ui
--------------------------------------------------------------------------------
/src/lms/ui/admin/ScanSettingsView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | class ScanSettingsView : public Wt::WContainerWidget
27 | {
28 | public:
29 | ScanSettingsView();
30 |
31 | private:
32 | void refreshView();
33 | };
34 | } // namespace lms::ui
35 |
--------------------------------------------------------------------------------
/src/lms/ui/admin/TracingView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | class TracingView : public Wt::WTemplate
27 | {
28 | public:
29 | TracingView();
30 | };
31 | } // namespace lms::ui
32 |
--------------------------------------------------------------------------------
/src/lms/ui/admin/UserView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 |
27 | class UserView : public Wt::WContainerWidget
28 | {
29 | public:
30 | UserView();
31 |
32 | private:
33 | void refreshView();
34 | };
35 |
36 | } // namespace lms::ui
37 |
--------------------------------------------------------------------------------
/src/lms/ui/admin/UsersView.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 | #include
24 |
25 | namespace lms::ui
26 | {
27 |
28 | class UsersView : public Wt::WTemplate
29 | {
30 | public:
31 | UsersView();
32 |
33 | private:
34 | void refreshView();
35 |
36 | Wt::WContainerWidget* _container;
37 | };
38 |
39 | } // namespace lms::ui
40 |
--------------------------------------------------------------------------------
/src/lms/ui/common/DoubleValidator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "DoubleValidator.hpp"
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | class DoubleValidator : public Wt::WDoubleValidator
27 | {
28 | public:
29 | using Wt::WDoubleValidator::WDoubleValidator;
30 |
31 | private:
32 | std::string javaScriptValidate() const override { return {}; }
33 | };
34 |
35 | std::unique_ptr createDoubleValidator(double min, double max)
36 | {
37 | auto validator{ std::make_unique(min, max) };
38 | return validator;
39 | }
40 | } // namespace lms::ui
41 |
--------------------------------------------------------------------------------
/src/lms/ui/common/DoubleValidator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createDoubleValidator(double min, double max);
27 | } // namespace lms::ui
28 |
--------------------------------------------------------------------------------
/src/lms/ui/common/LoadingIndicator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "LoadingIndicator.hpp"
21 |
22 | namespace lms::ui
23 | {
24 | std::unique_ptr createLoadingIndicator()
25 | {
26 | auto res{ std::make_unique(Wt::WString::tr("Lms.LoadingIndicator.template")) };
27 |
28 | res->addFunction("tr", &Wt::WTemplate::Functions::tr);
29 | res->setScrollVisibilityEnabled(true);
30 | res->setScrollVisibilityMargin(200);
31 |
32 | return res;
33 | }
34 | } // namespace lms::ui
35 |
--------------------------------------------------------------------------------
/src/lms/ui/common/LoadingIndicator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createLoadingIndicator();
27 | }
28 |
--------------------------------------------------------------------------------
/src/lms/ui/common/LoginNameValidator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createLoginNameValidator();
27 | } // namespace lms::ui
28 |
--------------------------------------------------------------------------------
/src/lms/ui/common/MandatoryValidator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #include "MandatoryValidator.hpp"
21 |
22 | namespace lms::ui
23 | {
24 | class MandatoryValidator : public Wt::WValidator
25 | {
26 | private:
27 | std::string javaScriptValidate() const override { return {}; }
28 | };
29 |
30 | std::unique_ptr
31 | createMandatoryValidator()
32 | {
33 | auto v{ std::make_unique() };
34 | v->setMandatory(true);
35 | return v;
36 | }
37 | } // namespace lms::ui
38 |
--------------------------------------------------------------------------------
/src/lms/ui/common/MandatoryValidator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createMandatoryValidator();
27 | } // namespace lms::ui
28 |
--------------------------------------------------------------------------------
/src/lms/ui/common/Template.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | class Template : public Wt::WTemplate
27 | {
28 | public:
29 | using Wt::WTemplate::WTemplate;
30 |
31 | private:
32 | void applyArguments(Wt::WWidget* w, const std::vector& args) override;
33 | };
34 | } // namespace lms::ui
35 |
--------------------------------------------------------------------------------
/src/lms/ui/common/UUIDValidator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createUUIDValidator();
27 | } // namespace lms::ui
28 |
--------------------------------------------------------------------------------
/src/lms/ui/common/UppercaseValidator.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | namespace lms::ui
25 | {
26 | std::unique_ptr createUppercaseValidator();
27 | } // namespace lms::ui
28 |
--------------------------------------------------------------------------------
/src/lms/ui/explore/ArtistListHelpers.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include
25 |
26 | #include "common/ValueStringModel.hpp"
27 | #include "database/Object.hpp"
28 | #include "database/Types.hpp"
29 |
30 | namespace lms::db
31 | {
32 | class Artist;
33 | }
34 |
35 | namespace lms::ui
36 | {
37 | using ArtistLinkTypesModel = ValueStringModel>;
38 |
39 | namespace ArtistListHelpers
40 | {
41 | std::unique_ptr createEntry(const db::ObjectPtr& artist);
42 | }
43 | } // namespace lms::ui
44 |
--------------------------------------------------------------------------------
/src/lms/ui/explore/Explore.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "PlayQueueController.hpp"
25 |
26 | namespace lms::ui
27 | {
28 | class Filters;
29 | class SearchView;
30 | class PlayQueue;
31 |
32 | class Explore : public Wt::WTemplate
33 | {
34 | public:
35 | Explore(Filters& filters, PlayQueue& playQueue);
36 |
37 | PlayQueueController& getPlayQueueController() { return _playQueueController; }
38 |
39 | private:
40 | PlayQueueController _playQueueController;
41 | };
42 | } // namespace lms::ui
43 |
--------------------------------------------------------------------------------
/src/lms/ui/resource/AudioFileResource.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2020 Emeric Poupon
3 | *
4 | * This file is part of LMS.
5 | *
6 | * LMS is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * LMS is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with LMS. If not, see .
18 | */
19 |
20 | #pragma once
21 |
22 | #include
23 |
24 | #include "database/TrackId.hpp"
25 |
26 | namespace lms::ui
27 | {
28 | class AudioFileResource : public Wt::WResource
29 | {
30 | public:
31 | ~AudioFileResource() override;
32 |
33 | std::string getUrl(db::TrackId trackId) const;
34 |
35 | private:
36 | void handleRequest(const Wt::Http::Request& request,
37 | Wt::Http::Response& response) override;
38 | };
39 | } // namespace lms::ui
40 |
--------------------------------------------------------------------------------
/src/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(db-generator)
2 | add_subdirectory(metadata)
3 | add_subdirectory(recommendation)
4 |
--------------------------------------------------------------------------------
/src/tools/db-generator/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(lms-db-generator
3 | LmsDbGenerator.cpp
4 | )
5 |
6 | target_link_libraries(lms-db-generator PRIVATE
7 | lmsdatabase
8 | lmscore
9 | Boost::program_options
10 | )
11 |
--------------------------------------------------------------------------------
/src/tools/metadata/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(lms-metadata
3 | LmsMetadata.cpp
4 | )
5 |
6 | target_link_libraries(lms-metadata PRIVATE
7 | lmsmetadata
8 | lmscore
9 | Boost::program_options
10 | )
11 |
12 | install(TARGETS lms-metadata DESTINATION bin)
13 |
--------------------------------------------------------------------------------
/src/tools/recommendation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_executable(lms-recommendation
3 | LmsRecommendation.cpp
4 | )
5 |
6 | target_link_libraries(lms-recommendation PRIVATE
7 | lmsdatabase
8 | lmsrecommendation
9 | Boost::program_options
10 | )
11 |
--------------------------------------------------------------------------------