├── .clang-format ├── .clang-tidy ├── .dockerignore ├── .github ├── FUNDING.yml └── workflows │ ├── build-alpine.yml │ ├── build-arch-all.yml │ ├── build-arch-basic.yml │ ├── clang-format-check.yml │ └── codeql.yml ├── .gitignore ├── CMakeLists.txt ├── COPYING ├── Dockerfile-build-alpine ├── Dockerfile-build-arch ├── Dockerfile-release ├── INSTALL.md ├── README.md ├── SUBSONIC.md ├── approot ├── admin-initwizard.xml ├── admin-medialibraries.xml ├── admin-medialibrary.xml ├── admin-scannercontroller.xml ├── admin-scansettings.xml ├── admin-tracing.xml ├── admin-user.xml ├── admin-users.xml ├── artist.xml ├── artists.xml ├── error.xml ├── explore.xml ├── images │ ├── unknown-artist.svg │ └── unknown-cover.svg ├── login.xml ├── main.xml ├── mediaplayer.xml ├── messages.xml ├── messages_en-US.xml ├── messages_es.xml ├── messages_fr.xml ├── messages_it.xml ├── messages_pl.xml ├── messages_zh.xml ├── misc.xml ├── notifications.xml ├── playqueue.xml ├── release.xml ├── releases.xml ├── settings.xml ├── tracklist.xml ├── tracklists.xml └── tracks.xml ├── cmake └── modules │ ├── FindFilesystem.cmake │ ├── FindPAM.cmake │ └── FindStbImage.cmake ├── conf ├── lms.conf ├── pam │ └── lms └── systemd │ └── default.service ├── docroot ├── css │ ├── bootstrap.solar.min.css │ └── lms.css └── js │ ├── bootstrap.bundle.min.js │ └── mediaplayer.js └── src ├── CMakeLists.txt ├── libs ├── CMakeLists.txt ├── av │ ├── CMakeLists.txt │ ├── impl │ │ ├── AudioFile.cpp │ │ ├── AudioFile.hpp │ │ ├── RawResourceHandlerCreator.cpp │ │ ├── Transcoder.cpp │ │ ├── Transcoder.hpp │ │ ├── TranscodingResourceHandler.cpp │ │ └── TranscodingResourceHandler.hpp │ └── include │ │ └── av │ │ ├── IAudioFile.hpp │ │ ├── RawResourceHandlerCreator.hpp │ │ ├── TranscodingParameters.hpp │ │ ├── TranscodingResourceHandlerCreator.hpp │ │ └── Types.hpp ├── core │ ├── CMakeLists.txt │ ├── bench │ │ ├── CMakeLists.txt │ │ └── TraceLoggerBench.cpp │ ├── impl │ │ ├── ArchiveZipper.cpp │ │ ├── ArchiveZipper.hpp │ │ ├── ChildProcess.cpp │ │ ├── ChildProcess.hpp │ │ ├── ChildProcessManager.cpp │ │ ├── ChildProcessManager.hpp │ │ ├── Config.cpp │ │ ├── Config.hpp │ │ ├── FileResourceHandler.cpp │ │ ├── FileResourceHandler.hpp │ │ ├── IOContextRunner.cpp │ │ ├── Logger.cpp │ │ ├── NetAddress.cpp │ │ ├── PartialDateTime.cpp │ │ ├── Path.cpp │ │ ├── Random.cpp │ │ ├── RecursiveSharedMutex.cpp │ │ ├── StreamLogger.cpp │ │ ├── String.cpp │ │ ├── TraceLogger.cpp │ │ ├── TraceLogger.hpp │ │ ├── UUID.cpp │ │ ├── WtLogger.cpp │ │ ├── XxHash3.cpp │ │ └── http │ │ │ ├── Client.cpp │ │ │ ├── Client.hpp │ │ │ ├── ClientRequest.hpp │ │ │ ├── SendQueue.cpp │ │ │ └── SendQueue.hpp │ ├── include │ │ └── core │ │ │ ├── Crc32Calculator.hpp │ │ │ ├── EnumSet.hpp │ │ │ ├── Exception.hpp │ │ │ ├── FileResourceHandlerCreator.hpp │ │ │ ├── IChildProcess.hpp │ │ │ ├── IChildProcessManager.hpp │ │ │ ├── IConfig.hpp │ │ │ ├── ILogger.hpp │ │ │ ├── IOContextRunner.hpp │ │ │ ├── IResourceHandler.hpp │ │ │ ├── ITraceLogger.hpp │ │ │ ├── IZipper.hpp │ │ │ ├── LiteralString.hpp │ │ │ ├── NetAddress.hpp │ │ │ ├── PartialDateTime.hpp │ │ │ ├── Path.hpp │ │ │ ├── Random.hpp │ │ │ ├── RecursiveSharedMutex.hpp │ │ │ ├── Service.hpp │ │ │ ├── StreamLogger.hpp │ │ │ ├── String.hpp │ │ │ ├── SystemPaths.hpp │ │ │ ├── TaggedType.hpp │ │ │ ├── Tuple.hpp │ │ │ ├── UUID.hpp │ │ │ ├── Utils.hpp │ │ │ ├── WtLogger.hpp │ │ │ ├── XxHash3.hpp │ │ │ ├── ZipperResourceHandlerCreator.hpp │ │ │ └── http │ │ │ ├── ClientRequestParameters.hpp │ │ │ └── IClient.hpp │ └── test │ │ ├── CMakeLists.txt │ │ ├── EnumSet.cpp │ │ ├── LiteralString.cpp │ │ ├── PartialDateTime.cpp │ │ ├── Path.cpp │ │ ├── RecursiveSharedMutex.cpp │ │ ├── Service.cpp │ │ ├── String.cpp │ │ ├── TraceLogger.cpp │ │ ├── UUID.cpp │ │ ├── Utils.cpp │ │ └── XxHash3.cpp ├── database │ ├── CMakeLists.txt │ ├── impl │ │ ├── Artist.cpp │ │ ├── ArtistInfo.cpp │ │ ├── AuthToken.cpp │ │ ├── Cluster.cpp │ │ ├── Db.cpp │ │ ├── Directory.cpp │ │ ├── IdType.cpp │ │ ├── Image.cpp │ │ ├── Listen.cpp │ │ ├── MediaLibrary.cpp │ │ ├── Migration.cpp │ │ ├── Migration.hpp │ │ ├── PlayListFile.cpp │ │ ├── PlayQueue.cpp │ │ ├── RatedArtist.cpp │ │ ├── RatedRelease.cpp │ │ ├── RatedTrack.cpp │ │ ├── Release.cpp │ │ ├── ScanSettings.cpp │ │ ├── Session.cpp │ │ ├── SqlQuery.cpp │ │ ├── SqlQuery.hpp │ │ ├── StarredArtist.cpp │ │ ├── StarredRelease.cpp │ │ ├── StarredTrack.cpp │ │ ├── Track.cpp │ │ ├── TrackArtistLink.cpp │ │ ├── TrackBookmark.cpp │ │ ├── TrackEmbeddedImage.cpp │ │ ├── TrackEmbeddedImageLink.cpp │ │ ├── TrackFeatures.cpp │ │ ├── TrackList.cpp │ │ ├── TrackLyrics.cpp │ │ ├── TransactionChecker.cpp │ │ ├── Types.cpp │ │ ├── UIState.cpp │ │ ├── User.cpp │ │ ├── Utils.cpp │ │ ├── Utils.hpp │ │ └── traits │ │ │ ├── EnumSetTraits.hpp │ │ │ ├── IdTypeTraits.hpp │ │ │ ├── ImageHashTypeTraits.hpp │ │ │ ├── PartialDateTimeTraits.hpp │ │ │ ├── PathTraits.hpp │ │ │ └── StringViewTraits.hpp │ ├── include │ │ └── database │ │ │ ├── Artist.hpp │ │ │ ├── ArtistId.hpp │ │ │ ├── ArtistInfo.hpp │ │ │ ├── ArtistInfoId.hpp │ │ │ ├── AuthToken.hpp │ │ │ ├── AuthTokenId.hpp │ │ │ ├── Cluster.hpp │ │ │ ├── ClusterId.hpp │ │ │ ├── CountryId.hpp │ │ │ ├── Db.hpp │ │ │ ├── Directory.hpp │ │ │ ├── DirectoryId.hpp │ │ │ ├── Filters.hpp │ │ │ ├── IdType.hpp │ │ │ ├── Image.hpp │ │ │ ├── ImageId.hpp │ │ │ ├── LabelId.hpp │ │ │ ├── Listen.hpp │ │ │ ├── ListenId.hpp │ │ │ ├── MediaLibrary.hpp │ │ │ ├── MediaLibraryId.hpp │ │ │ ├── Object.hpp │ │ │ ├── PlayListFile.hpp │ │ │ ├── PlayQueue.hpp │ │ │ ├── RatedArtist.hpp │ │ │ ├── RatedArtistId.hpp │ │ │ ├── RatedRelease.hpp │ │ │ ├── RatedReleaseId.hpp │ │ │ ├── RatedTrack.hpp │ │ │ ├── RatedTrackId.hpp │ │ │ ├── Release.hpp │ │ │ ├── ReleaseId.hpp │ │ │ ├── ReleaseTypeId.hpp │ │ │ ├── ScanSettings.hpp │ │ │ ├── Session.hpp │ │ │ ├── StarredArtist.hpp │ │ │ ├── StarredArtistId.hpp │ │ │ ├── StarredRelease.hpp │ │ │ ├── StarredReleaseId.hpp │ │ │ ├── StarredTrack.hpp │ │ │ ├── StarredTrackId.hpp │ │ │ ├── Track.hpp │ │ │ ├── TrackArtistLink.hpp │ │ │ ├── TrackBookmark.hpp │ │ │ ├── TrackEmbeddedImage.hpp │ │ │ ├── TrackEmbeddedImageId.hpp │ │ │ ├── TrackEmbeddedImageLink.hpp │ │ │ ├── TrackEmbeddedImageLinkId.hpp │ │ │ ├── TrackFeatures.hpp │ │ │ ├── TrackId.hpp │ │ │ ├── TrackList.hpp │ │ │ ├── TrackListId.hpp │ │ │ ├── TrackLyrics.hpp │ │ │ ├── TransactionChecker.hpp │ │ │ ├── Types.hpp │ │ │ ├── UIState.hpp │ │ │ ├── UIStateId.hpp │ │ │ ├── User.hpp │ │ │ └── UserId.hpp │ └── test │ │ ├── Artist.cpp │ │ ├── ArtistInfo.cpp │ │ ├── AuthToken.cpp │ │ ├── CMakeLists.txt │ │ ├── Cluster.cpp │ │ ├── Common.cpp │ │ ├── Common.hpp │ │ ├── DatabaseTest.cpp │ │ ├── Directory.cpp │ │ ├── Image.cpp │ │ ├── Listen.cpp │ │ ├── Migration.cpp │ │ ├── PlayListFile.cpp │ │ ├── RatedArtist.cpp │ │ ├── RatedRelease.cpp │ │ ├── RatedTrack.cpp │ │ ├── Release.cpp │ │ ├── ScanSettings.cpp │ │ ├── StarredArtist.cpp │ │ ├── StarredRelease.cpp │ │ ├── StarredTrack.cpp │ │ ├── Track.cpp │ │ ├── TrackArtistLink.cpp │ │ ├── TrackBookmark.cpp │ │ ├── TrackEmbeddedImage.cpp │ │ ├── TrackFeatures.cpp │ │ ├── TrackList.cpp │ │ ├── TrackLyrics.cpp │ │ └── User.cpp ├── image │ ├── CMakeLists.txt │ ├── impl │ │ ├── EncodedImage.cpp │ │ ├── EncodedImage.hpp │ │ ├── graphicsmagick │ │ │ ├── Image.cpp │ │ │ ├── RawImage.cpp │ │ │ └── RawImage.hpp │ │ └── stb │ │ │ ├── Exception.cpp │ │ │ ├── Exception.hpp │ │ │ ├── Image.cpp │ │ │ ├── RawImage.cpp │ │ │ ├── RawImage.hpp │ │ │ ├── StbImage.cpp │ │ │ ├── StbImage.hpp │ │ │ ├── StbImageResize.cpp │ │ │ ├── StbImageResize.hpp │ │ │ ├── StbImageWrite.cpp │ │ │ └── StbImageWrite.hpp │ └── include │ │ └── image │ │ ├── Exception.hpp │ │ ├── IEncodedImage.hpp │ │ ├── IRawImage.hpp │ │ ├── Image.hpp │ │ └── Types.hpp ├── metadata │ ├── CMakeLists.txt │ ├── bench │ │ ├── CMakeLists.txt │ │ ├── LyricsBench.cpp │ │ └── Metadata.cpp │ ├── impl │ │ ├── ArtistInfo.cpp │ │ ├── AudioFileParser.cpp │ │ ├── AudioFileParser.hpp │ │ ├── AvFormatImageReader.cpp │ │ ├── AvFormatImageReader.hpp │ │ ├── AvFormatTagReader.cpp │ │ ├── AvFormatTagReader.hpp │ │ ├── IImageReader.hpp │ │ ├── ITagReader.hpp │ │ ├── Lyrics.cpp │ │ ├── PlayList.cpp │ │ ├── TagLibDefs.hpp │ │ ├── TagLibImageReader.cpp │ │ ├── TagLibImageReader.hpp │ │ ├── TagLibTagReader.cpp │ │ ├── TagLibTagReader.hpp │ │ ├── Utils.cpp │ │ └── Utils.hpp │ ├── include │ │ └── metadata │ │ │ ├── ArtistInfo.hpp │ │ │ ├── Exception.hpp │ │ │ ├── IAudioFileParser.hpp │ │ │ ├── Lyrics.hpp │ │ │ ├── PlayList.hpp │ │ │ └── Types.hpp │ └── test │ │ ├── ArtistInfo.cpp │ │ ├── AudioFileParser.cpp │ │ ├── CMakeLists.txt │ │ ├── Lyrics.cpp │ │ ├── Metadata.cpp │ │ ├── PlayList.cpp │ │ ├── TestTagReader.hpp │ │ └── Utils.cpp ├── services │ ├── CMakeLists.txt │ ├── artwork │ │ ├── CMakeLists.txt │ │ ├── impl │ │ │ ├── ArtworkService.cpp │ │ │ ├── ArtworkService.hpp │ │ │ ├── ImageCache.cpp │ │ │ └── ImageCache.hpp │ │ └── include │ │ │ └── services │ │ │ └── artwork │ │ │ └── IArtworkService.hpp │ ├── auth │ │ ├── CMakeLists.txt │ │ ├── impl │ │ │ ├── AuthServiceBase.cpp │ │ │ ├── AuthServiceBase.hpp │ │ │ ├── AuthTokenService.cpp │ │ │ ├── AuthTokenService.hpp │ │ │ ├── EnvService.cpp │ │ │ ├── LoginThrottler.cpp │ │ │ ├── LoginThrottler.hpp │ │ │ ├── PasswordServiceBase.cpp │ │ │ ├── PasswordServiceBase.hpp │ │ │ ├── http-headers │ │ │ │ ├── HttpHeadersEnvService.cpp │ │ │ │ └── HttpHeadersEnvService.hpp │ │ │ ├── internal │ │ │ │ ├── InternalPasswordService.cpp │ │ │ │ └── InternalPasswordService.hpp │ │ │ └── pam │ │ │ │ ├── PAMPasswordService.cpp │ │ │ │ └── PAMPasswordService.hpp │ │ └── include │ │ │ └── services │ │ │ └── auth │ │ │ ├── IAuthTokenService.hpp │ │ │ ├── IEnvService.hpp │ │ │ ├── IPasswordService.hpp │ │ │ └── Types.hpp │ ├── feedback │ │ ├── CMakeLists.txt │ │ ├── impl │ │ │ ├── FeedbackService.cpp │ │ │ ├── FeedbackService.hpp │ │ │ ├── FeedbackService.impl.hpp │ │ │ ├── IFeedbackBackend.hpp │ │ │ ├── internal │ │ │ │ ├── InternalBackend.cpp │ │ │ │ └── InternalBackend.hpp │ │ │ └── listenbrainz │ │ │ │ ├── Exception.hpp │ │ │ │ ├── FeedbackTypes.cpp │ │ │ │ ├── FeedbackTypes.hpp │ │ │ │ ├── FeedbacksParser.cpp │ │ │ │ ├── FeedbacksParser.hpp │ │ │ │ ├── FeedbacksSynchronizer.cpp │ │ │ │ ├── FeedbacksSynchronizer.hpp │ │ │ │ ├── ListenBrainzBackend.cpp │ │ │ │ ├── ListenBrainzBackend.hpp │ │ │ │ ├── Utils.cpp │ │ │ │ └── Utils.hpp │ │ └── include │ │ │ └── services │ │ │ └── feedback │ │ │ ├── Exception.hpp │ │ │ └── IFeedbackService.hpp │ ├── recommendation │ │ ├── CMakeLists.txt │ │ ├── impl │ │ │ ├── ClustersEngineCreator.hpp │ │ │ ├── FeaturesEngineCreator.hpp │ │ │ ├── IEngine.hpp │ │ │ ├── PlaylistGeneratorService.cpp │ │ │ ├── PlaylistGeneratorService.hpp │ │ │ ├── RecommendationService.cpp │ │ │ ├── RecommendationService.hpp │ │ │ ├── clusters │ │ │ │ ├── ClustersEngine.cpp │ │ │ │ └── ClustersEngine.hpp │ │ │ ├── features │ │ │ │ ├── FeaturesDefs.cpp │ │ │ │ ├── FeaturesDefs.hpp │ │ │ │ ├── FeaturesEngine.cpp │ │ │ │ ├── FeaturesEngine.hpp │ │ │ │ ├── FeaturesEngineCache.cpp │ │ │ │ └── FeaturesEngineCache.hpp │ │ │ └── playlist-constraints │ │ │ │ ├── ConsecutiveArtists.cpp │ │ │ │ ├── ConsecutiveArtists.hpp │ │ │ │ ├── ConsecutiveReleases.cpp │ │ │ │ ├── ConsecutiveReleases.hpp │ │ │ │ ├── DuplicateTracks.cpp │ │ │ │ ├── DuplicateTracks.hpp │ │ │ │ └── IConstraint.hpp │ │ └── include │ │ │ └── services │ │ │ └── recommendation │ │ │ ├── IPlaylistGeneratorService.hpp │ │ │ ├── IRecommendationService.hpp │ │ │ └── Types.hpp │ ├── scanner │ │ ├── CMakeLists.txt │ │ ├── impl │ │ │ ├── MediaLibraryInfo.hpp │ │ │ ├── ScanContext.hpp │ │ │ ├── ScannerService.cpp │ │ │ ├── ScannerService.hpp │ │ │ ├── ScannerSettings.hpp │ │ │ ├── ScannerStats.cpp │ │ │ ├── helpers │ │ │ │ ├── ArtistHelpers.cpp │ │ │ │ └── ArtistHelpers.hpp │ │ │ ├── scanners │ │ │ │ ├── ArtistInfoFileScanner.cpp │ │ │ │ ├── ArtistInfoFileScanner.hpp │ │ │ │ ├── AudioFileScanOperation.cpp │ │ │ │ ├── AudioFileScanOperation.hpp │ │ │ │ ├── AudioFileScanner.cpp │ │ │ │ ├── AudioFileScanner.hpp │ │ │ │ ├── FileToScan.hpp │ │ │ │ ├── IFileScanOperation.hpp │ │ │ │ ├── IFileScanner.hpp │ │ │ │ ├── ImageFileScanner.cpp │ │ │ │ ├── ImageFileScanner.hpp │ │ │ │ ├── LyricsFileScanner.cpp │ │ │ │ ├── LyricsFileScanner.hpp │ │ │ │ ├── PlayListFileScanner.cpp │ │ │ │ ├── PlayListFileScanner.hpp │ │ │ │ ├── Utils.cpp │ │ │ │ └── Utils.hpp │ │ │ └── steps │ │ │ │ ├── FileScanQueue.cpp │ │ │ │ ├── FileScanQueue.hpp │ │ │ │ ├── IScanStep.hpp │ │ │ │ ├── ScanStepArtistReconciliation.cpp │ │ │ │ ├── ScanStepArtistReconciliation.hpp │ │ │ │ ├── ScanStepAssociateArtistImages.cpp │ │ │ │ ├── ScanStepAssociateArtistImages.hpp │ │ │ │ ├── ScanStepAssociateExternalLyrics.cpp │ │ │ │ ├── ScanStepAssociateExternalLyrics.hpp │ │ │ │ ├── ScanStepAssociatePlayListTracks.cpp │ │ │ │ ├── ScanStepAssociatePlayListTracks.hpp │ │ │ │ ├── ScanStepAssociateReleaseImages.cpp │ │ │ │ ├── ScanStepAssociateReleaseImages.hpp │ │ │ │ ├── ScanStepBase.cpp │ │ │ │ ├── ScanStepBase.hpp │ │ │ │ ├── ScanStepCheckForDuplicatedFiles.cpp │ │ │ │ ├── ScanStepCheckForDuplicatedFiles.hpp │ │ │ │ ├── ScanStepCheckForRemovedFiles.cpp │ │ │ │ ├── ScanStepCheckForRemovedFiles.hpp │ │ │ │ ├── ScanStepCompact.cpp │ │ │ │ ├── ScanStepCompact.hpp │ │ │ │ ├── ScanStepComputeClusterStats.cpp │ │ │ │ ├── ScanStepComputeClusterStats.hpp │ │ │ │ ├── ScanStepDiscoverFiles.cpp │ │ │ │ ├── ScanStepDiscoverFiles.hpp │ │ │ │ ├── ScanStepOptimize.cpp │ │ │ │ ├── ScanStepOptimize.hpp │ │ │ │ ├── ScanStepRemoveOrphanedDbEntries.cpp │ │ │ │ ├── ScanStepRemoveOrphanedDbEntries.hpp │ │ │ │ ├── ScanStepScanFiles.cpp │ │ │ │ ├── ScanStepScanFiles.hpp │ │ │ │ ├── ScanStepUpdateLibraryFields.cpp │ │ │ │ └── ScanStepUpdateLibraryFields.hpp │ │ └── include │ │ │ └── services │ │ │ └── scanner │ │ │ ├── IScannerService.hpp │ │ │ ├── ScannerEvents.hpp │ │ │ ├── ScannerOptions.hpp │ │ │ └── ScannerStats.hpp │ └── scrobbling │ │ ├── CMakeLists.txt │ │ ├── impl │ │ ├── IScrobblingBackend.hpp │ │ ├── ScrobblingService.cpp │ │ ├── ScrobblingService.hpp │ │ ├── internal │ │ │ ├── InternalBackend.cpp │ │ │ └── InternalBackend.hpp │ │ └── listenbrainz │ │ │ ├── Exception.hpp │ │ │ ├── ListenBrainzBackend.cpp │ │ │ ├── ListenBrainzBackend.hpp │ │ │ ├── ListenTypes.cpp │ │ │ ├── ListenTypes.hpp │ │ │ ├── ListensParser.cpp │ │ │ ├── ListensParser.hpp │ │ │ ├── ListensSynchronizer.cpp │ │ │ ├── ListensSynchronizer.hpp │ │ │ ├── Utils.cpp │ │ │ └── Utils.hpp │ │ ├── include │ │ └── services │ │ │ └── scrobbling │ │ │ ├── Exception.hpp │ │ │ ├── IScrobblingService.hpp │ │ │ └── Listen.hpp │ │ └── test │ │ ├── CMakeLists.txt │ │ ├── Listenbrainz.cpp │ │ └── Scrobbling.cpp ├── som │ ├── CMakeLists.txt │ ├── bench │ │ ├── CMakeLists.txt │ │ └── SomBench.cpp │ ├── impl │ │ ├── DataNormalizer.cpp │ │ └── Network.cpp │ ├── include │ │ └── som │ │ │ ├── DataNormalizer.hpp │ │ │ ├── InputVector.hpp │ │ │ ├── Matrix.hpp │ │ │ └── Network.hpp │ └── test │ │ ├── CMakeLists.txt │ │ └── SomTest.cpp └── subsonic │ ├── CMakeLists.txt │ ├── bench │ ├── CMakeLists.txt │ └── SubsonicBench.cpp │ ├── impl │ ├── ClientInfo.hpp │ ├── CoverArtId.cpp │ ├── CoverArtId.hpp │ ├── ParameterParsing.cpp │ ├── ParameterParsing.hpp │ ├── ProtocolVersion.cpp │ ├── ProtocolVersion.hpp │ ├── RequestContext.hpp │ ├── ResponseFormat.cpp │ ├── ResponseFormat.hpp │ ├── SubsonicId.cpp │ ├── SubsonicId.hpp │ ├── SubsonicResource.cpp │ ├── SubsonicResource.hpp │ ├── SubsonicResponse.cpp │ ├── SubsonicResponse.hpp │ ├── SubsonicResponseAllocator.hpp │ ├── TLSMonotonicMemoryResource.hpp │ ├── endpoints │ │ ├── AlbumSongLists.cpp │ │ ├── AlbumSongLists.hpp │ │ ├── Bookmarks.cpp │ │ ├── Bookmarks.hpp │ │ ├── Browsing.cpp │ │ ├── Browsing.hpp │ │ ├── MediaAnnotation.cpp │ │ ├── MediaAnnotation.hpp │ │ ├── MediaLibraryScanning.cpp │ │ ├── MediaLibraryScanning.hpp │ │ ├── MediaRetrieval.cpp │ │ ├── MediaRetrieval.hpp │ │ ├── Playlists.cpp │ │ ├── Playlists.hpp │ │ ├── Searching.cpp │ │ ├── Searching.hpp │ │ ├── System.cpp │ │ ├── System.hpp │ │ ├── UserManagement.cpp │ │ └── UserManagement.hpp │ └── responses │ │ ├── Album.cpp │ │ ├── Album.hpp │ │ ├── AlbumInfo.cpp │ │ ├── AlbumInfo.hpp │ │ ├── Artist.cpp │ │ ├── Artist.hpp │ │ ├── Bookmark.cpp │ │ ├── Bookmark.hpp │ │ ├── Contributor.cpp │ │ ├── Contributor.hpp │ │ ├── DiscTitle.cpp │ │ ├── DiscTitle.hpp │ │ ├── Genre.cpp │ │ ├── Genre.hpp │ │ ├── ItemDate.cpp │ │ ├── ItemDate.hpp │ │ ├── ItemGenre.cpp │ │ ├── ItemGenre.hpp │ │ ├── Lyrics.cpp │ │ ├── Lyrics.hpp │ │ ├── Playlist.cpp │ │ ├── Playlist.hpp │ │ ├── RecordLabel.cpp │ │ ├── RecordLabel.hpp │ │ ├── ReplayGain.cpp │ │ ├── ReplayGain.hpp │ │ ├── Song.cpp │ │ ├── Song.hpp │ │ ├── User.cpp │ │ └── User.hpp │ └── include │ └── subsonic │ └── SubsonicResource.hpp ├── lms ├── CMakeLists.txt ├── main.cpp └── ui │ ├── Auth.cpp │ ├── Auth.hpp │ ├── LmsApplication.cpp │ ├── LmsApplication.hpp │ ├── LmsApplicationException.hpp │ ├── LmsApplicationManager.cpp │ ├── LmsApplicationManager.hpp │ ├── LmsInitApplication.cpp │ ├── LmsInitApplication.hpp │ ├── LmsTheme.cpp │ ├── LmsTheme.hpp │ ├── MediaPlayer.cpp │ ├── MediaPlayer.hpp │ ├── ModalManager.cpp │ ├── ModalManager.hpp │ ├── Notification.hpp │ ├── NotificationContainer.cpp │ ├── NotificationContainer.hpp │ ├── PlayQueue.cpp │ ├── PlayQueue.hpp │ ├── SettingsView.cpp │ ├── SettingsView.hpp │ ├── State.cpp │ ├── State.hpp │ ├── Tooltip.cpp │ ├── Tooltip.hpp │ ├── Utils.cpp │ ├── Utils.hpp │ ├── admin │ ├── InitWizardView.cpp │ ├── InitWizardView.hpp │ ├── MediaLibrariesView.cpp │ ├── MediaLibrariesView.hpp │ ├── MediaLibraryModal.cpp │ ├── MediaLibraryModal.hpp │ ├── ScanSettingsView.cpp │ ├── ScanSettingsView.hpp │ ├── ScannerController.cpp │ ├── ScannerController.hpp │ ├── TracingView.cpp │ ├── TracingView.hpp │ ├── UserView.cpp │ ├── UserView.hpp │ ├── UsersView.cpp │ └── UsersView.hpp │ ├── common │ ├── DoubleValidator.cpp │ ├── DoubleValidator.hpp │ ├── InfiniteScrollingContainer.cpp │ ├── InfiniteScrollingContainer.hpp │ ├── LoadingIndicator.cpp │ ├── LoadingIndicator.hpp │ ├── LoginNameValidator.cpp │ ├── LoginNameValidator.hpp │ ├── MandatoryValidator.cpp │ ├── MandatoryValidator.hpp │ ├── PasswordValidator.cpp │ ├── PasswordValidator.hpp │ ├── Template.cpp │ ├── Template.hpp │ ├── UUIDValidator.cpp │ ├── UUIDValidator.hpp │ ├── UppercaseValidator.cpp │ ├── UppercaseValidator.hpp │ └── ValueStringModel.hpp │ ├── explore │ ├── ArtistCollector.cpp │ ├── ArtistCollector.hpp │ ├── ArtistListHelpers.cpp │ ├── ArtistListHelpers.hpp │ ├── ArtistView.cpp │ ├── ArtistView.hpp │ ├── ArtistsView.cpp │ ├── ArtistsView.hpp │ ├── DatabaseCollectorBase.cpp │ ├── DatabaseCollectorBase.hpp │ ├── DropDownMenuSelector.hpp │ ├── Explore.cpp │ ├── Explore.hpp │ ├── Filters.cpp │ ├── Filters.hpp │ ├── PlayQueueController.cpp │ ├── PlayQueueController.hpp │ ├── ReleaseCollector.cpp │ ├── ReleaseCollector.hpp │ ├── ReleaseHelpers.cpp │ ├── ReleaseHelpers.hpp │ ├── ReleaseTypes.cpp │ ├── ReleaseTypes.hpp │ ├── ReleaseView.cpp │ ├── ReleaseView.hpp │ ├── ReleasesView.cpp │ ├── ReleasesView.hpp │ ├── SortModeSelector.hpp │ ├── TrackArtistLinkTypeSelector.hpp │ ├── TrackCollector.cpp │ ├── TrackCollector.hpp │ ├── TrackListHelpers.cpp │ ├── TrackListHelpers.hpp │ ├── TrackListView.cpp │ ├── TrackListView.hpp │ ├── TrackListsView.cpp │ ├── TrackListsView.hpp │ ├── TracksView.cpp │ └── TracksView.hpp │ └── resource │ ├── ArtworkResource.cpp │ ├── ArtworkResource.hpp │ ├── AudioFileResource.cpp │ ├── AudioFileResource.hpp │ ├── AudioTranscodingResource.cpp │ ├── AudioTranscodingResource.hpp │ ├── DownloadResource.cpp │ └── DownloadResource.hpp └── tools ├── CMakeLists.txt ├── db-generator ├── CMakeLists.txt └── LmsDbGenerator.cpp ├── metadata ├── CMakeLists.txt └── LmsMetadata.cpp ├── recommendation ├── CMakeLists.txt └── LmsRecommendation.cpp ├── similarity-parameters ├── GeneticAlgorithm.hpp ├── LmsSimilarityParameters.cpp └── ParallelFor.hpp └── subsonic-api-bench └── search3.sh /.clang-format: -------------------------------------------------------------------------------- 1 | Language: Cpp 2 | BasedOnStyle: Microsoft 3 | Standard: c++20 4 | AccessModifierOffset: -4 5 | AlignAfterOpenBracket: DontAlign 6 | AlignConsecutiveAssignments: false 7 | AlignConsecutiveDeclarations: false 8 | AlignOperands: AlignAfterOperator 9 | AlignTrailingComments: true 10 | AllowAllConstructorInitializersOnNextLine: false 11 | AllowAllParametersOfDeclarationOnNextLine: false 12 | AllowShortFunctionsOnASingleLine: InlineOnly 13 | AllowShortIfStatementsOnASingleLine: true 14 | AlwaysBreakTemplateDeclarations: Yes 15 | BraceWrapping: 16 | AfterUnion: true 17 | BreakBeforeBinaryOperators: All 18 | BreakBeforeTernaryOperators: false 19 | BreakConstructorInitializers: BeforeComma 20 | ColumnLimit: 0 21 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 22 | Cpp11BracedListStyle: false 23 | IndentCaseBlocks: true 24 | IndentPPDirectives: BeforeHash 25 | KeepEmptyLinesAtTheStartOfBlocks: false 26 | MaxEmptyLinesToKeep: 1 27 | NamespaceIndentation: All 28 | PointerAlignment: Left 29 | SortIncludes: true 30 | SpaceAfterTemplateKeyword: false -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | --- 2 | Checks: '-*,bugprone-*,concurrency-*,cppcoreguidelines-*,misc-*,-misc-include-cleaner,-misc-no-recursion,performance*,portability-*,readability-*,-readability-braces-around-statements,-readability-identifier-length,-readability-implicit-bool-conversion' 3 | WarningsAsErrors: '' 4 | HeaderFilterRegex: '' 5 | FormatStyle: none 6 | User: '' 7 | CheckOptions: 8 | - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic 9 | value: '1' 10 | - key: readability-identifier-naming.IgnoreClassesWithAllMemberVariablesBeingPublic 11 | value: '1' 12 | - key: cppcoreguidelines-avoid-do-while.IgnoreMacros 13 | value: '1' 14 | - key: performance-unnecessary-value-param.AllowedTypes 15 | value: "shared_ptr;ObjectPtr;.*::pointer" 16 | - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctionsWhenCopyIsDeleted 17 | value: '1' 18 | - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor 19 | value: '1' 20 | ... 21 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: epoupon 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/build-alpine.yml: -------------------------------------------------------------------------------- 1 | name: Multi-platform Builds (Alpine) 2 | on: [pull_request] 3 | jobs: 4 | Build: 5 | strategy: 6 | matrix: 7 | BUILD_TYPE: [Release, Debug] 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Check Out Repo 11 | uses: actions/checkout@v3 12 | 13 | - name: Cache Docker layers 14 | uses: actions/cache@v3 15 | with: 16 | path: /tmp/.buildx-cache 17 | key: ${{ runner.os }}-buildx-${{ github.sha }} 18 | restore-keys: | 19 | ${{ runner.os }}-buildx- 20 | 21 | - name: Set up Docker Buildx 22 | id: buildx 23 | uses: docker/setup-buildx-action@v3 24 | 25 | - name: Build 26 | uses: docker/build-push-action@v3 27 | with: 28 | context: ./ 29 | file: ./Dockerfile-build-alpine 30 | builder: ${{ steps.buildx.outputs.name }} 31 | build-args: LMS_BUILD_TYPE=${{ matrix.BUILD_TYPE }} 32 | push: false 33 | cache-from: type=local,src=/tmp/.buildx-cache 34 | cache-to: type=local,dest=/tmp/.buildx-cache 35 | platforms: linux/amd64,linux/arm64,linux/arm/v6 36 | -------------------------------------------------------------------------------- /.github/workflows/build-arch-all.yml: -------------------------------------------------------------------------------- 1 | name: All-option Builds (Arch) 2 | on: [pull_request] 3 | jobs: 4 | Build: 5 | strategy: 6 | matrix: 7 | LMS_BUILD_TYPE: [Release, Debug] 8 | LMS_UNITY_BUILD: [ON, OFF] 9 | LMS_IMAGE_BACKEND: [stb, graphicsmagick] 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check Out Repo 13 | uses: actions/checkout@v3 14 | 15 | - name: Cache Docker layers 16 | uses: actions/cache@v3 17 | with: 18 | path: /tmp/.buildx-cache 19 | key: ${{ runner.os }}-buildx-${{ github.sha }} 20 | restore-keys: | 21 | ${{ runner.os }}-buildx- 22 | 23 | - name: Set up Docker Buildx 24 | id: buildx 25 | uses: docker/setup-buildx-action@v3 26 | 27 | - name: Build 28 | uses: docker/build-push-action@v3 29 | with: 30 | context: ./ 31 | file: ./Dockerfile-build-arch 32 | builder: ${{ steps.buildx.outputs.name }} 33 | build-args: | 34 | LMS_BUILD_TYPE=${{ matrix.LMS_BUILD_TYPE }} 35 | LMS_UNITY_BUILD=${{ matrix.LMS_UNITY_BUILD }} 36 | LMS_IMAGE_BACKEND=${{ matrix.LMS_IMAGE_BACKEND }} 37 | push: false 38 | cache-from: type=local,src=/tmp/.buildx-cache 39 | cache-to: type=local,dest=/tmp/.buildx-cache 40 | -------------------------------------------------------------------------------- /.github/workflows/build-arch-basic.yml: -------------------------------------------------------------------------------- 1 | name: Basic Build (Arch) 2 | on: [push] 3 | jobs: 4 | Build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Check Out Repo 8 | uses: actions/checkout@v3 9 | 10 | - name: Cache Docker layers 11 | uses: actions/cache@v3 12 | with: 13 | path: /tmp/.buildx-cache 14 | key: ${{ runner.os }}-buildx-${{ github.sha }} 15 | restore-keys: | 16 | ${{ runner.os }}-buildx- 17 | 18 | - name: Set up Docker Buildx 19 | id: buildx 20 | uses: docker/setup-buildx-action@v3 21 | 22 | - name: Build 23 | uses: docker/build-push-action@v3 24 | with: 25 | context: ./ 26 | file: ./Dockerfile-build-arch 27 | builder: ${{ steps.buildx.outputs.name }} 28 | build-args: | 29 | LMS_BUILD_TYPE=Release 30 | LMS_UNITY_BUILD=ON 31 | LMS_IMAGE_BACKEND=stb 32 | push: false 33 | cache-from: type=local,src=/tmp/.buildx-cache 34 | cache-to: type=local,dest=/tmp/.buildx-cache 35 | -------------------------------------------------------------------------------- /.github/workflows/clang-format-check.yml: -------------------------------------------------------------------------------- 1 | name: clang-format Check 2 | on: [push, pull_request] 3 | jobs: 4 | formatting-check: 5 | name: Formatting Check 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - name: Run clang-format style check 10 | uses: jidicula/clang-format-action@v4.13.0 11 | with: 12 | clang-format-version: '13' 13 | check-path: 'src' -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sw? 2 | *.*~ 3 | CMakeCache.txt 4 | CMakeFiles/ 5 | build/ 6 | .cache/ 7 | .vscode/ 8 | -------------------------------------------------------------------------------- /Dockerfile-build-alpine: -------------------------------------------------------------------------------- 1 | FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx 2 | FROM --platform=$BUILDPLATFORM alpine:3.21 3 | 4 | ARG BUILD_PACKAGES="\ 5 | clang \ 6 | make \ 7 | cmake \ 8 | lld \ 9 | curl \ 10 | pkgconfig" 11 | 12 | RUN apk add --no-cache ${BUILD_PACKAGES} 13 | 14 | ARG LMS_BUILD_PACKAGES=" \ 15 | gcc \ 16 | g++ \ 17 | musl-dev \ 18 | benchmark-dev \ 19 | boost-dev \ 20 | ffmpeg-dev \ 21 | libarchive-dev \ 22 | libconfig-dev \ 23 | taglib-dev \ 24 | stb \ 25 | wt-dev \ 26 | gtest-dev \ 27 | xxhash-dev" 28 | 29 | COPY --from=xx / / 30 | 31 | ARG TARGETPLATFORM 32 | RUN xx-apk add --no-scripts --no-cache ${LMS_BUILD_PACKAGES} 33 | 34 | # LMS 35 | COPY . /tmp/lms/ 36 | ARG LMS_BUILD_TYPE="Release" 37 | RUN \ 38 | DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \ 39 | xx-info is-cross && export BUILD_TESTS=OFF || export BUILD_TESTS=ON && \ 40 | PKG_CONFIG_PATH=/$(xx-info)/usr/lib/pkgconfig cmake /tmp/lms/ -DCMAKE_INCLUDE_PATH=/$(xx-info)/usr/include -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} $(xx-clang --print-cmake-defines) -DCMAKE_PREFIX_PATH=/$(xx-info)/usr/lib/cmake -DBUILD_TESTING=${BUILD_TESTS} -DBUILD_BENCHMARKS=ON && \ 41 | VERBOSE=1 make -j$(nproc) && \ 42 | xx-verify src/lms/lms && \ 43 | (xx-info is-cross || make test) 44 | -------------------------------------------------------------------------------- /Dockerfile-build-arch: -------------------------------------------------------------------------------- 1 | FROM archlinux:latest 2 | 3 | ARG BUILD_PACKAGES="\ 4 | benchmark \ 5 | clang \ 6 | cmake \ 7 | boost \ 8 | ffmpeg \ 9 | gtest \ 10 | graphicsmagick \ 11 | libarchive \ 12 | libconfig \ 13 | make \ 14 | pkgconfig \ 15 | stb \ 16 | taglib \ 17 | wt \ 18 | xxhash" 19 | 20 | RUN pacman -Syu --noconfirm ${BUILD_PACKAGES} && \ 21 | pacman -Scc --noconfirm && \ 22 | rm -rf /var/cache/pacman/pkg/* 23 | 24 | # LMS 25 | COPY . /tmp/lms/ 26 | RUN mkdir -p /tmp/lms/build 27 | WORKDIR /tmp/lms/build 28 | 29 | ARG LMS_BUILD_TYPE=Release 30 | ARG LMS_UNITY_BUILD=ON 31 | ARG LMS_IMAGE_BACKEND=stb 32 | RUN cmake .. -DCMAKE_BUILD_TYPE=${LMS_BUILD_TYPE} -DCMAKE_UNITY_BUILD=${LMS_UNITY_BUILD} -DLMS_IMAGE_BACKEND=${LMS_IMAGE_BACKEND} -DBUILD_BENCHMARKS=ON 33 | RUN VERBOSE=1 make -j$(nproc) 34 | RUN make test 35 | -------------------------------------------------------------------------------- /approot/admin-tracing.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | ${tr:Lms.Admin.Tracing.tracing} 7 |
8 |
9 | ${export-btn class="btn btn-primary"} 10 |
11 |
12 |
13 |
14 | 15 |
16 | -------------------------------------------------------------------------------- /approot/error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 9 |

${error}

10 | ${btn-go-home class="btn btn-primary"} 11 |
12 |
13 | 14 |
15 | -------------------------------------------------------------------------------- /approot/images/unknown-artist.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /approot/login.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 |
9 |
10 |

${tr:Lms.Auth.welcome}

11 |
12 | 15 | ${login-name class="form-control"} 16 |
17 | ${login-name-info} 18 |
19 |
20 |
21 | 24 | ${password class="form-control"} 25 |
26 | ${password-info} 27 |
28 |
29 |
30 |
31 | ${remember-me class="form-check-input"} 32 | 35 |
36 |
37 |
38 | ${login-btn class="btn btn-primary"} 39 |
40 |
41 |
42 |
43 |
44 |
45 | 46 |
47 | -------------------------------------------------------------------------------- /approot/messages_en-US.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | . 7 | , 8 | MM/dd/yyyy 9 | hh:mm:ss a 10 | MM/dd/yyyy hh:mm:ss a 11 | 12 | -------------------------------------------------------------------------------- /approot/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 | ${tr:Lms.loading} 8 |
9 |
10 |
11 | 12 | 13 | ${elements} 14 | ${loading-indicator} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /approot/notifications.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 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 | --------------------------------------------------------------------------------