| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2024 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include <config.h> |
| 14 | #include <freac.h> |
| 15 | |
| 16 | #include <jobs/engine/convert.h> |
| 17 | |
| 18 | #include <boca.h> |
| 19 | |
| 20 | using namespace BoCA; |
| 21 | |
| 22 | freac::Config *freac::Config::instance = NIL; |
| 23 | |
| 24 | const String freac::Config::CategorySettingsID = "Settings"; |
| 25 | const String freac::Config::CategoryDialogsID = "Dialogs"; |
| 26 | const String freac::Config::CategoryResourcesID = "Resources"; |
| 27 | const String freac::Config::CategoryJoblistID = "Joblist"; |
| 28 | const String freac::Config::CategorySplitterID = "Splitter"; |
| 29 | const String freac::Config::CategoryRipperID = "Ripper"; |
| 30 | const String freac::Config::CategoryPlaylistID = "Playlist"; |
| 31 | const String freac::Config::CategoryTagsID = "Tags"; |
| 32 | const String freac::Config::CategoryFreedbID = "freedb"; |
| 33 | const String freac::Config::CategoryVerificationID = "Verification"; |
| 34 | const String freac::Config::CategoryProcessingID = "Processing"; |
| 35 | const String freac::Config::CategoryLoggingID = "Logging"; |
| 36 | const String freac::Config::CategoryInternalID = "Internal"; |
| 37 | |
| 38 | /* Category Settings |
| 39 | */ |
| 40 | const String freac::Config::SettingsStartCountID = "StartCount"; |
| 41 | const Int freac::Config::SettingsStartCountDefault = 0; |
| 42 | |
| 43 | const String freac::Config::SettingsEnableConsoleID = "EnableConsole"; |
| 44 | const Bool freac::Config::SettingsEnableConsoleDefault = False; |
| 45 | |
| 46 | const String freac::Config::SettingsWindowPosXID = "WindowPosX"; |
| 47 | const Int freac::Config::SettingsWindowPosXDefault = 100; |
| 48 | |
| 49 | const String freac::Config::SettingsWindowPosYID = "WindowPosY"; |
| 50 | const Int freac::Config::SettingsWindowPosYDefault = 100; |
| 51 | |
| 52 | const String freac::Config::SettingsWindowSizeXID = "WindowSizeX"; |
| 53 | const Int freac::Config::SettingsWindowSizeXDefault = 740; |
| 54 | |
| 55 | const String freac::Config::SettingsWindowSizeYID = "WindowSizeY"; |
| 56 | const Int freac::Config::SettingsWindowSizeYDefault = 550; |
| 57 | |
| 58 | const String freac::Config::SettingsWindowMaximizedID = "WindowMaximized"; |
| 59 | const Bool freac::Config::SettingsWindowMaximizedDefault = False; |
| 60 | |
| 61 | const String freac::Config::SettingsLanguageID = "Language"; |
| 62 | const String freac::Config::SettingsLanguageDefault = NIL; |
| 63 | |
| 64 | const String freac::Config::SettingsShowTitleInfoID = "ShowTitleInfo"; |
| 65 | const Bool freac::Config::SettingsShowTitleInfoDefault = True; |
| 66 | |
| 67 | const String freac::Config::SettingsShowTooltipsID = "ShowTooltips"; |
| 68 | const Bool freac::Config::SettingsShowTooltipsDefault = True; |
| 69 | |
| 70 | const String freac::Config::SettingsShowTipsID = "ShowTips"; |
| 71 | const Bool freac::Config::SettingsShowTipsDefault = True; |
| 72 | |
| 73 | const String freac::Config::SettingsNextTipID = "NextTip"; |
| 74 | const Int freac::Config::SettingsNextTipDefault = 0; |
| 75 | |
| 76 | const String freac::Config::SettingsDisplayErrorsID = "DisplayErrors"; |
| 77 | const Bool freac::Config::SettingsDisplayErrorsDefault = True; |
| 78 | |
| 79 | const String freac::Config::SettingsCheckForUpdatesID = "CheckUpdatesAtStartup"; |
| 80 | const Bool freac::Config::SettingsCheckForUpdatesDefault = True; |
| 81 | |
| 82 | const String freac::Config::SettingsUpdatesCheckedID = "UpdatesChecked"; |
| 83 | const Bool freac::Config::SettingsUpdatesCheckedDefault = False; |
| 84 | |
| 85 | const String freac::Config::SettingsLastUsedGenreID = "LastUsedGenre"; |
| 86 | |
| 87 | const String freac::Config::SettingsLastOutputDirectoryID = "LastOutputDirectory"; |
| 88 | const String freac::Config::SettingsLastFilePatternID = "LastFilePattern"; |
| 89 | |
| 90 | const String freac::Config::SettingsLastAddedDirID = "LastAddedDir"; |
| 91 | const String freac::Config::SettingsLastAddedDirDefault = NIL; |
| 92 | |
| 93 | const String freac::Config::SettingsLastAddedPatternID = "LastAddedPattern"; |
| 94 | const String freac::Config::SettingsLastAddedPatternDefault = NIL; |
| 95 | |
| 96 | const String freac::Config::SettingsLastSearchSubFoldersID = "SearchSubFolders"; |
| 97 | const Bool freac::Config::SettingsLastSearchSubFoldersDefault = False; |
| 98 | |
| 99 | const String freac::Config::SettingsEncodeOnTheFlyID = "EncodeOnTheFly"; |
| 100 | const Bool freac::Config::SettingsEncodeOnTheFlyDefault = True; |
| 101 | |
| 102 | const String freac::Config::SettingsKeepWaveFilesID = "KeepWaveFiles"; |
| 103 | const Bool freac::Config::SettingsKeepWaveFilesDefault = False; |
| 104 | |
| 105 | const String freac::Config::SettingsEncodeToSingleFileID = "EncodeToSingleFile"; |
| 106 | const Bool freac::Config::SettingsEncodeToSingleFileDefault = False; |
| 107 | |
| 108 | const String freac::Config::SettingsSingleFilenameID = "SingleFilename"; |
| 109 | const String freac::Config::SettingsSingleFilenameDefault = NIL; |
| 110 | |
| 111 | const String freac::Config::SettingsRemoveTracksID = "RemoveTracks"; |
| 112 | const Bool freac::Config::SettingsRemoveTracksDefault = True; |
| 113 | |
| 114 | const String freac::Config::SettingsAddEncodedTracksID = "AddEncodedTracks"; |
| 115 | const Bool freac::Config::SettingsAddEncodedTracksDefault = False; |
| 116 | |
| 117 | const String freac::Config::SettingsWriteToInputDirectoryID = "WriteToInputDirectory"; |
| 118 | const Bool freac::Config::SettingsWriteToInputDirectoryDefault = False; |
| 119 | |
| 120 | const String freac::Config::SettingsAllowOverwriteSourceID = "AllowOverwriteSource"; |
| 121 | const Bool freac::Config::SettingsAllowOverwriteSourceDefault = False; |
| 122 | |
| 123 | const String freac::Config::SettingsFilenamesAllowUnicodeID = "UseUnicodeFilenames"; |
| 124 | const Bool freac::Config::SettingsFilenamesAllowUnicodeDefault = True; |
| 125 | |
| 126 | const String freac::Config::SettingsFilenamesReplaceSpacesID = "FilenamesReplaceSpaces"; |
| 127 | const Bool freac::Config::SettingsFilenamesReplaceSpacesDefault = False; |
| 128 | |
| 129 | const String freac::Config::SettingsFilenamesKeepTimeStampsID = "FilenamesKeepTimeStamps"; |
| 130 | const Bool freac::Config::SettingsFilenamesKeepTimeStampsDefault = False; |
| 131 | |
| 132 | const String freac::Config::SettingsFilenamesAddSequentialNumbersID = "FilenamesAddSequentialNumbers"; |
| 133 | const Bool freac::Config::SettingsFilenamesAddSequentialNumbersDefault = False; |
| 134 | |
| 135 | const String freac::Config::SettingsFilenamesUseFallbackID = "UseFilenameFallback"; |
| 136 | const Bool freac::Config::SettingsFilenamesUseFallbackDefault = True; |
| 137 | |
| 138 | const String freac::Config::SettingsEncoderID = "Encoder"; |
| 139 | const String freac::Config::SettingsEncoderDefault = "lame-enc"; |
| 140 | |
| 141 | const String freac::Config::SettingsEncoderOutputDirectoryID = "EncoderOutDir"; |
| 142 | String freac::Config::SettingsEncoderOutputDirectoryDefault = NIL; |
| 143 | |
| 144 | const String freac::Config::SettingsEncoderFilenamePatternID = "EncoderFilenamePattern"; |
| 145 | const String freac::Config::SettingsEncoderFilenamePatternDefault = String("<albumartist> - <album>").Append(Directory::GetDirectoryDelimiter()).Append("<track> - <artist> - <title>"); |
| 146 | |
| 147 | const String freac::Config::SettingsLastCustomCharsetID = "LastCustomCharset"; |
| 148 | const String freac::Config::SettingsLastCustomCharsetDefault = NIL; |
| 149 | |
| 150 | const String freac::Config::SettingsShowJobsTabID = "ShowJobsTab"; |
| 151 | const Bool freac::Config::SettingsShowJobsTabDefault = False; |
| 152 | |
| 153 | const String freac::Config::SettingsWarnLossyToLosslessID = "WarnLossyToLossless"; |
| 154 | const Bool freac::Config::SettingsWarnLossyToLosslessDefault = True; |
| 155 | |
| 156 | const String freac::Config::SettingsExcludeExtensionsID = "ExcludeExtensions"; |
| 157 | const String freac::Config::SettingsExcludeExtensionsDefault = String(".jpg|.jpeg|.gif|.png|.bmp|") // pictures |
| 158 | .Append(".txt|.asc|.log|.nfo|.url|") // plain text |
| 159 | .Append(".crc|.md5|.sha1|.sha256|.sha512|.sfv|") // checksums |
| 160 | .Append(".m3u|.m3u8|.pls|.vclt|.wpl|.xspf|") // playlists |
| 161 | .Append(".exe|.dll|") // executables |
| 162 | .Append(".zip|.rar|.gz|.bz2|.xz|.7z|") // archives |
| 163 | .Append(".ini|.plist|") // configuration |
| 164 | .Append(".htm|.html|.svg|.xml|") // HTML/SVG/XML |
| 165 | .Append(".pdf|.ps|.xps|") // PDF etc. |
| 166 | .Append(".doc|.docx|.odt|") // text documents |
| 167 | .Append(".ppt|.pptx|.odp|") // presentations |
| 168 | .Append(".xls|.xlsx|.ods|.odc|") // spreadsheets |
| 169 | .Append(".itdb|.musicdb|") // iTunes database |
| 170 | .Append(".torrent|thumbs.db|.DS_Store"); // other files |
| 171 | |
| 172 | const String freac::Config::SettingsLastSelectedOpenDirID = "LastSelectedOpenDir"; |
| 173 | |
| 174 | const String freac::Config::SettingsLastSelectedSaveDirID = "LastSelectedSaveDir"; |
| 175 | |
| 176 | const String freac::Config::SettingsLastSelectedJoblistDirID = "LastSelectedJoblistDir"; |
| 177 | |
| 178 | const String freac::Config::SettingsDeleteAfterEncodingID = "DeleteAfterEncoding"; |
| 179 | const Bool freac::Config::SettingsDeleteAfterEncodingDefault = False; |
| 180 | |
| 181 | /* Category Dialogs |
| 182 | */ |
| 183 | const String freac::Config::DialogsCDDBSubmitSizeXID = "CDDBSubmitSizeX"; |
| 184 | const Int freac::Config::DialogsCDDBSubmitSizeXDefault = 510; |
| 185 | |
| 186 | const String freac::Config::DialogsCDDBSubmitSizeYID = "CDDBSubmitSizeY"; |
| 187 | const Int freac::Config::DialogsCDDBSubmitSizeYDefault = 461; |
| 188 | |
| 189 | const String freac::Config::DialogsCDDBMultiMatchSizeXID = "CDDBMultiMatchSizeX"; |
| 190 | const Int freac::Config::DialogsCDDBMultiMatchSizeXDefault = 360; |
| 191 | |
| 192 | const String freac::Config::DialogsCDDBMultiMatchSizeYID = "CDDBMultiMatchSizeY"; |
| 193 | const Int freac::Config::DialogsCDDBMultiMatchSizeYDefault = 369; |
| 194 | |
| 195 | const String freac::Config::DialogsCDDBManageQueriesSizeXID = "CDDBManageQueriesSizeX"; |
| 196 | const Int freac::Config::DialogsCDDBManageQueriesSizeXDefault = 500; |
| 197 | |
| 198 | const String freac::Config::DialogsCDDBManageQueriesSizeYID = "CDDBManageQueriesSizeY"; |
| 199 | const Int freac::Config::DialogsCDDBManageQueriesSizeYDefault = 250; |
| 200 | |
| 201 | const String freac::Config::DialogsCDDBManageSubmitsSizeXID = "CDDBManageSubmitsSizeX"; |
| 202 | const Int freac::Config::DialogsCDDBManageSubmitsSizeXDefault = 560; |
| 203 | |
| 204 | const String freac::Config::DialogsCDDBManageSubmitsSizeYID = "CDDBManageSubmitsSizeY"; |
| 205 | const Int freac::Config::DialogsCDDBManageSubmitsSizeYDefault = 360; |
| 206 | |
| 207 | const String freac::Config::DialogsCDDBManageCacheSizeXID = "CDDBManageCacheSizeX"; |
| 208 | const Int freac::Config::DialogsCDDBManageCacheSizeXDefault = 560; |
| 209 | |
| 210 | const String freac::Config::DialogsCDDBManageCacheSizeYID = "CDDBManageCacheSizeY"; |
| 211 | const Int freac::Config::DialogsCDDBManageCacheSizeYDefault = 360; |
| 212 | |
| 213 | /* Category Processing |
| 214 | */ |
| 215 | const String freac::Config::ProcessingEnableProcessingID = "EnableProcessing"; |
| 216 | const Int freac::Config::ProcessingEnableProcessingDefault = 1; |
| 217 | |
| 218 | const String freac::Config::ProcessingProcessPlaybackID = "ProcessPlayback"; |
| 219 | const Int freac::Config::ProcessingProcessPlaybackDefault = 1; |
| 220 | |
| 221 | const String freac::Config::ProcessingComponentsID = "ProcessingComponents"; |
| 222 | const String freac::Config::ProcessingComponentsDefault = NIL; |
| 223 | |
| 224 | const String freac::Config::ProcessingSingleFileModeID = "SingleFileMode"; |
| 225 | const Int freac::Config::ProcessingSingleFileModeDefault = 1; |
| 226 | |
| 227 | /* Category Verification |
| 228 | */ |
| 229 | const String freac::Config::VerificationVerifyInputID = "VerifyInput"; |
| 230 | const Bool freac::Config::VerificationVerifyInputDefault = True; |
| 231 | |
| 232 | const String freac::Config::VerificationVerifyOutputID = "VerifyOutput"; |
| 233 | const Bool freac::Config::VerificationVerifyOutputDefault = False; |
| 234 | |
| 235 | /* Category Resources |
| 236 | */ |
| 237 | const String freac::Config::ResourcesEnableParallelConversionsID = "EnableParallelConversions"; |
| 238 | const Bool freac::Config::ResourcesEnableParallelConversionsDefault = True; |
| 239 | |
| 240 | const String freac::Config::ResourcesEnableSuperFastModeID = "EnableSuperFastMode"; |
| 241 | const Bool freac::Config::ResourcesEnableSuperFastModeDefault = True; |
| 242 | |
| 243 | const String freac::Config::ResourcesNumberOfConversionThreadsID = "NumberOfConversionThreads"; |
| 244 | const Int freac::Config::ResourcesNumberOfConversionThreadsDefault = 0; |
| 245 | |
| 246 | const String freac::Config::ResourcesPriorityID = "Priority"; |
| 247 | const Int freac::Config::ResourcesPriorityDefault = 0; |
| 248 | |
| 249 | /* Category Joblist |
| 250 | */ |
| 251 | const String freac::Config::JoblistFieldsID = "Fields"; |
| 252 | const String freac::Config::JoblistFieldsDefault = "<artist>,<title>,<track>,<time>,<bytes>"; |
| 253 | |
| 254 | const String freac::Config::JoblistFieldSizesID = "FieldSizes"; |
| 255 | const String freac::Config::JoblistFieldSizesDefault = "120,*,50,80,100"; |
| 256 | |
| 257 | /* Category Splitter |
| 258 | */ |
| 259 | const String freac::Config::SplitterSplitModeID = "SplitMode"; |
| 260 | const Int freac::Config::SplitterSplitModeDefault = 0; |
| 261 | |
| 262 | const String freac::Config::SplitterSplitAtTracksID = "SplitAtTracks"; |
| 263 | const Bool freac::Config::SplitterSplitAtTracksDefault = True; |
| 264 | |
| 265 | const String freac::Config::SplitterPartDurationModeID = "PartDurationMode"; |
| 266 | const Int freac::Config::SplitterPartDurationModeDefault = 1; |
| 267 | |
| 268 | const String freac::Config::SplitterPartDurationID = "PartDuration"; |
| 269 | const Int freac::Config::SplitterPartDurationDefault = 15; |
| 270 | |
| 271 | const String freac::Config::SplitterPartDurationUnitID = "PartDurationUnit"; |
| 272 | const Int freac::Config::SplitterPartDurationUnitDefault = 1; |
| 273 | |
| 274 | const String freac::Config::SplitterNumberOfPartsID = "NumberOfParts"; |
| 275 | const Int freac::Config::SplitterNumberOfPartsDefault = 4; |
| 276 | |
| 277 | const String freac::Config::SplitterMetadataStringID = "MetadataString"; |
| 278 | const String freac::Config::SplitterMetadataStringDefault = "<albumartist>,<album>"; |
| 279 | |
| 280 | const String freac::Config::SplitterFileNamePatternID = "FileNamePattern"; |
| 281 | const String freac::Config::SplitterFileNamePatternDefault = "<albumartist> - <album>"; |
| 282 | |
| 283 | const String freac::Config::SplitterRepeatEndID = "RepeatEnd"; |
| 284 | const Bool freac::Config::SplitterRepeatEndDefault = False; |
| 285 | |
| 286 | const String freac::Config::SplitterRepeatSecondsID = "RepeatSeconds"; |
| 287 | const Int freac::Config::SplitterRepeatSecondsDefault = 10; |
| 288 | |
| 289 | const String freac::Config::SplitterWindowPosXID = "WindowPosX"; |
| 290 | |
| 291 | const String freac::Config::SplitterWindowPosYID = "WindowPosY"; |
| 292 | |
| 293 | const String freac::Config::SplitterWindowSizeXID = "WindowSizeX"; |
| 294 | const Int freac::Config::SplitterWindowSizeXDefault = 750; |
| 295 | |
| 296 | const String freac::Config::SplitterWindowSizeYID = "WindowSizeY"; |
| 297 | const Int freac::Config::SplitterWindowSizeYDefault = 500; |
| 298 | |
| 299 | /* Category Ripper |
| 300 | */ |
| 301 | const String freac::Config::RipperActiveDriveID = "ActiveDrive"; |
| 302 | const Int freac::Config::RipperActiveDriveDefault = 0; |
| 303 | |
| 304 | const String freac::Config::RipperEjectAfterRippingID = "EjectAfterRipping"; |
| 305 | const Bool freac::Config::RipperEjectAfterRippingDefault = False; |
| 306 | |
| 307 | const String freac::Config::RipperAutoReadContentsID = "AutoReadContents"; |
| 308 | const Bool freac::Config::RipperAutoReadContentsDefault = True; |
| 309 | |
| 310 | const String freac::Config::RipperAutoRipID = "AutoRip"; |
| 311 | const Bool freac::Config::RipperAutoRipDefault = False; |
| 312 | |
| 313 | const String freac::Config::RipperTimeoutID = "Timeout"; |
| 314 | const Int freac::Config::RipperTimeoutDefault = 0; |
| 315 | |
| 316 | /* Category Playlist |
| 317 | */ |
| 318 | const String freac::Config::PlaylistCreatePlaylistID = "CreatePlaylist"; |
| 319 | const Bool freac::Config::PlaylistCreatePlaylistDefault = False; |
| 320 | |
| 321 | const String freac::Config::PlaylistCreateCueSheetID = "CreateCueSheet"; |
| 322 | const Bool freac::Config::PlaylistCreateCueSheetDefault = False; |
| 323 | |
| 324 | const String freac::Config::PlaylistFormatID = "PlaylistFormat"; |
| 325 | const String freac::Config::PlaylistFormatDefault = "m3u-playlist-m3u8"; |
| 326 | |
| 327 | const String freac::Config::PlaylistUseEncoderOutputDirID = "UseEncoderOutputDir"; |
| 328 | const Bool freac::Config::PlaylistUseEncoderOutputDirDefault = True; |
| 329 | |
| 330 | const String freac::Config::PlaylistOutputDirID = "OutputDir"; |
| 331 | |
| 332 | const String freac::Config::PlaylistFilenamePatternID = "FilenamePattern"; |
| 333 | const String freac::Config::PlaylistFilenamePatternDefault = String("<albumartist> - <album>").Append(Directory::GetDirectoryDelimiter()).Append("<albumartist> - <album>"); |
| 334 | |
| 335 | const String freac::Config::PlaylistCreateSingleFileID = "SinglePlaylistFile"; |
| 336 | const Bool freac::Config::PlaylistCreateSingleFileDefault = False; |
| 337 | |
| 338 | const String freac::Config::PlaylistFilenameID = "PlaylistFilename"; |
| 339 | const String freac::Config::PlaylistFilenameDefault = NIL; |
| 340 | |
| 341 | const String freac::Config::PlaylistCueSheetID = "CueSheetFilename"; |
| 342 | const String freac::Config::PlaylistCueSheetDefault = NIL; |
| 343 | |
| 344 | /* Category Tags |
| 345 | */ |
| 346 | const String freac::Config::TagsAlbumArtReadFromTagsID = "CoverArtReadFromTags"; |
| 347 | const Bool freac::Config::TagsAlbumArtReadFromTagsDefault = True; |
| 348 | |
| 349 | const String freac::Config::TagsAlbumArtReadFromFilesID = "CoverArtReadFromFiles"; |
| 350 | const Bool freac::Config::TagsAlbumArtReadFromFilesDefault = True; |
| 351 | |
| 352 | const String freac::Config::TagsAlbumArtUsePatternsID = "CoverArtRestrictFilenames"; |
| 353 | const Bool freac::Config::TagsAlbumArtUsePatternsDefault = True; |
| 354 | |
| 355 | const String freac::Config::TagsAlbumArtPatternsID = "CoverArtFilenames"; |
| 356 | const String freac::Config::TagsAlbumArtPatternsDefault = "folder;*cover*;*albumart*;*front*;*back*;*inside*;*cd*;*disc*;*booklet*"; |
| 357 | |
| 358 | const String freac::Config::TagsAlbumArtMaxFileSizeID = "CoverArtMaxFileSize"; |
| 359 | const Int freac::Config::TagsAlbumArtMaxFileSizeDefault = 250; |
| 360 | |
| 361 | const String freac::Config::TagsAlbumArtWriteToTagsID = "CoverArtWriteToTags"; |
| 362 | const Bool freac::Config::TagsAlbumArtWriteToTagsDefault = True; |
| 363 | |
| 364 | const String freac::Config::TagsAlbumArtWriteToFilesID = "CoverArtWriteToFiles"; |
| 365 | const Bool freac::Config::TagsAlbumArtWriteToFilesDefault = False; |
| 366 | |
| 367 | const String freac::Config::TagsAlbumArtWriteToFilesWithReferenceID = "CoverArtWriteToFilesWithReference"; |
| 368 | const Bool freac::Config::TagsAlbumArtWriteToFilesWithReferenceDefault = False; |
| 369 | |
| 370 | const String freac::Config::TagsAlbumArtFilenamePatternID = "CoverArtFilenamePattern"; |
| 371 | const String freac::Config::TagsAlbumArtFilenamePatternDefault = String("<albumartist> - <album>").Append(Directory::GetDirectoryDelimiter()).Append("<type>"); |
| 372 | |
| 373 | const String freac::Config::TagsReadEmbeddedCueSheetsID = "ReadEmbeddedCueSheets"; |
| 374 | const Int freac::Config::TagsReadEmbeddedCueSheetsDefault = True; |
| 375 | |
| 376 | const String freac::Config::TagsPreferCueSheetsToChaptersID = "PreferCueSheetsToChapters"; |
| 377 | const Int freac::Config::TagsPreferCueSheetsToChaptersDefault = True; |
| 378 | |
| 379 | const String freac::Config::TagsReadChaptersID = "ReadChapters"; |
| 380 | const Bool freac::Config::TagsReadChaptersDefault = True; |
| 381 | |
| 382 | const String freac::Config::TagsWriteChaptersID = "WriteChapters"; |
| 383 | const Bool freac::Config::TagsWriteChaptersDefault = True; |
| 384 | |
| 385 | const String freac::Config::TagsWriteMCDIID = "WriteMCDI"; |
| 386 | const Bool freac::Config::TagsWriteMCDIDefault = True; |
| 387 | |
| 388 | const String freac::Config::TagsPreserveReplayGainID = "PreserveReplayGain"; |
| 389 | const Bool freac::Config::TagsPreserveReplayGainDefault = True; |
| 390 | |
| 391 | const String freac::Config::TagsExtractFromFileNamesID = "ExtractFromFileNames"; |
| 392 | const Bool freac::Config::TagsExtractFromFileNamesDefault = True; |
| 393 | |
| 394 | const String freac::Config::TagsReplaceExistingCommentsID = "ReplaceExistingComments"; |
| 395 | const Bool freac::Config::TagsReplaceExistingCommentsDefault = False; |
| 396 | |
| 397 | const String freac::Config::TagsDefaultCommentID = "DefaultComment"; |
| 398 | |
| 399 | /* Category freedb |
| 400 | */ |
| 401 | const String freac::Config::FreedbDirectoryID = "Directory"; |
| 402 | const String freac::Config::FreedbDirectoryDefault = String("freedb").Append(Directory::GetDirectoryDelimiter()); |
| 403 | |
| 404 | const String freac::Config::FreedbServerID = "Server"; |
| 405 | const String freac::Config::FreedbServerDefault = "gnudb.gnudb.org"; |
| 406 | |
| 407 | const String freac::Config::FreedbModeID = "Mode"; |
| 408 | const Int freac::Config::FreedbModeDefault = 0; |
| 409 | |
| 410 | const String freac::Config::FreedbHTTPPortID = "HTTPPort"; |
| 411 | const Int freac::Config::FreedbHTTPPortDefault = 80; |
| 412 | |
| 413 | const String freac::Config::FreedbCDDBPPortID = "CDDBPPort"; |
| 414 | const Int freac::Config::FreedbCDDBPPortDefault = 8880; |
| 415 | |
| 416 | const String freac::Config::FreedbQueryPathID = "QueryPath"; |
| 417 | const String freac::Config::FreedbQueryPathDefault = "/~cddb/cddb.cgi"; |
| 418 | |
| 419 | const String freac::Config::FreedbSubmitPathID = "SubmitPath"; |
| 420 | const String freac::Config::FreedbSubmitPathDefault = "/~cddb/submit.cgi"; |
| 421 | |
| 422 | const String freac::Config::FreedbEmailID = "eMail"; |
| 423 | const String freac::Config::FreedbEmailDefault = "[email protected]"; |
| 424 | |
| 425 | const String freac::Config::FreedbProxyID = "Proxy"; |
| 426 | const String freac::Config::FreedbProxyDefault = "localhost"; |
| 427 | |
| 428 | const String freac::Config::FreedbProxyUserID = "ProxyUserName"; |
| 429 | const String freac::Config::FreedbProxyUserDefault = NIL; |
| 430 | |
| 431 | const String freac::Config::FreedbProxyPasswordID = "ProxyPassword"; |
| 432 | const String freac::Config::FreedbProxyPasswordDefault = NIL; |
| 433 | |
| 434 | const String freac::Config::FreedbProxyModeID = "ProxyMode"; |
| 435 | const Int freac::Config::FreedbProxyModeDefault = 0; |
| 436 | |
| 437 | const String freac::Config::FreedbProxyPortID = "ProxyPort"; |
| 438 | const Int freac::Config::FreedbProxyPortDefault = 1080; |
| 439 | |
| 440 | const String freac::Config::FreedbEnableLocalID = "EnableLocalCDDB"; |
| 441 | const Bool freac::Config::FreedbEnableLocalDefault = False; |
| 442 | |
| 443 | const String freac::Config::FreedbEnableRemoteID = "EnableRemoteCDDB"; |
| 444 | const Bool freac::Config::FreedbEnableRemoteDefault = True; |
| 445 | |
| 446 | const String freac::Config::FreedbAutoQueryID = "AutoCDDBQueries"; |
| 447 | const Bool freac::Config::FreedbAutoQueryDefault = True; |
| 448 | |
| 449 | const String freac::Config::FreedbAutoSelectID = "AutoSelectFirstEntry"; |
| 450 | const Bool freac::Config::FreedbAutoSelectDefault = False; |
| 451 | |
| 452 | const String freac::Config::FreedbEnableCacheID = "EnableCDDBCache"; |
| 453 | const Bool freac::Config::FreedbEnableCacheDefault = True; |
| 454 | |
| 455 | const String freac::Config::FreedbOverwriteCDTextID = "OverwriteCDText"; |
| 456 | const Bool freac::Config::FreedbOverwriteCDTextDefault = True; |
| 457 | |
| 458 | const String freac::Config::FreedbUpdateJoblistID = "UpdateJoblistOnSubmit"; |
| 459 | const Bool freac::Config::FreedbUpdateJoblistDefault = True; |
| 460 | |
| 461 | const String freac::Config::FreedbDisplayNotFoundID = "DisplayNotFoundNote"; |
| 462 | const Bool freac::Config::FreedbDisplayNotFoundDefault = True; |
| 463 | |
| 464 | /* Category Logging |
| 465 | */ |
| 466 | const String freac::Config::LoggingLogCompletePathsID = "LogCompletePaths"; |
| 467 | const Bool freac::Config::LoggingLogCompletePathsDefault = False; |
| 468 | |
| 469 | /* Category Internal |
| 470 | */ |
| 471 | const String freac::Config::InternalNotificationAvailableID = "NotificationAvailable"; |
| 472 | |
| 473 | const String freac::Config::InternalDeleteAfterEncodingID = "DeleteAfterEncoding"; |
| 474 | const String freac::Config::InternalShutdownAfterEncodingID = "ShutdownAfterEncoding"; |
| 475 | |
| 476 | freac::Config::Config() |
| 477 | { |
| 478 | BoCA::Config *config = BoCA::Config::Get(); |
| 479 | |
| 480 | /* Set default settings. |
| 481 | */ |
| 482 | config->SetIntValue(CategoryInternalID, InternalDeleteAfterEncodingID, config->GetIntValue(CategorySettingsID, SettingsDeleteAfterEncodingID, SettingsDeleteAfterEncodingDefault)); |
| 483 | config->SetIntValue(CategoryInternalID, InternalShutdownAfterEncodingID, False); |
| 484 | |
| 485 | enable_eUpdate = False; |
| 486 | |
| 487 | /* Set resource paths. |
| 488 | */ |
| 489 | resourcesPath = GUI::Application::GetApplicationDirectory(); |
| 490 | documentationPath = GUI::Application::GetApplicationDirectory(); |
| 491 | |
| 492 | #ifndef __WIN32__ |
| 493 | if (Directory(S::System::System::GetResourcesDirectory().Append("freac")).Exists()) |
| 494 | { |
| 495 | resourcesPath = S::System::System::GetResourcesDirectory().Append("freac").Append(Directory::GetDirectoryDelimiter()); |
| 496 | documentationPath = S::System::System::GetResourcesDirectory().Append("doc").Append(Directory::GetDirectoryDelimiter()).Append("freac").Append(Directory::GetDirectoryDelimiter()); |
| 497 | } |
| 498 | #endif |
| 499 | |
| 500 | /* Set default output folder. |
| 501 | */ |
| 502 | Config::SettingsEncoderOutputDirectoryDefault = S::System::System::GetPersonalFilesDirectory(S::System::PersonalFilesMusic); |
| 503 | |
| 504 | /* Append directory delimiter to output paths. |
| 505 | */ |
| 506 | String encoderOutputDir = config->GetStringValue(CategorySettingsID, SettingsEncoderOutputDirectoryID, SettingsEncoderOutputDirectoryDefault); |
| 507 | String playlistOutputDir = config->GetStringValue(CategoryPlaylistID, PlaylistOutputDirID, encoderOutputDir); |
| 508 | String freedbDir = config->GetStringValue(CategoryFreedbID, FreedbDirectoryID, FreedbDirectoryDefault); |
| 509 | |
| 510 | if (!encoderOutputDir.EndsWith(Directory::GetDirectoryDelimiter())) config->SetStringValue(CategorySettingsID, SettingsEncoderOutputDirectoryID, encoderOutputDir.Append(Directory::GetDirectoryDelimiter())); |
| 511 | if (!playlistOutputDir.EndsWith(Directory::GetDirectoryDelimiter())) config->SetStringValue(CategoryPlaylistID, PlaylistOutputDirID, playlistOutputDir.Append(Directory::GetDirectoryDelimiter())); |
| 512 | if (!freedbDir.EndsWith(Directory::GetDirectoryDelimiter())) config->SetStringValue(CategoryFreedbID, FreedbDirectoryID, freedbDir.Append(Directory::GetDirectoryDelimiter())); |
| 513 | |
| 514 | /* Reset last output folder if it does not exist. |
| 515 | */ |
| 516 | if (config->GetStringValue(Config::CategorySettingsID, String(Config::SettingsLastOutputDirectoryID).Append(String::FromInt(1)), NIL) == NIL) config->SetStringValue(Config::CategorySettingsID, String(Config::SettingsLastOutputDirectoryID).Append(String::FromInt(1)), config->GetStringValue(CategorySettingsID, SettingsEncoderOutputDirectoryID, SettingsEncoderOutputDirectoryDefault)); |
| 517 | |
| 518 | /* Change freedb server after 31st March 2020. |
| 519 | */ |
| 520 | DateTime currentDate = DateTime::Current(); |
| 521 | |
| 522 | if ((currentDate.GetYear() > 2020 ) || |
| 523 | (currentDate.GetYear() == 2020 && currentDate.GetMonth() > 3)) |
| 524 | { |
| 525 | if (config->GetStringValue(Config::CategoryFreedbID, Config::FreedbServerID, Config::FreedbServerDefault) == "freedb.freedb.org" || |
| 526 | config->GetStringValue(Config::CategoryFreedbID, Config::FreedbServerID, Config::FreedbServerDefault) == "freedb.freac.org") config->SetStringValue(Config::CategoryFreedbID, Config::FreedbServerID, Config::FreedbServerDefault); |
| 527 | } |
| 528 | |
| 529 | /* Translate fre:ac 1.0.x encoder indices to encoder IDs. |
| 530 | */ |
| 531 | String encoderID = config->GetStringValue(Config::CategorySettingsID, Config::SettingsEncoderID, Config::SettingsEncoderDefault); |
| 532 | |
| 533 | if (encoderID.Length() == 1) |
| 534 | { |
| 535 | switch (encoderID.ToInt()) |
| 536 | { |
| 537 | default: encoderID = "lame-enc"; break; |
| 538 | case 1: encoderID = "faac-enc"; break; |
| 539 | case 2: encoderID = "flac-enc"; break; |
| 540 | case 3: encoderID = "lame-enc"; break; |
| 541 | case 4: encoderID = "vorbis-enc"; break; |
| 542 | case 5: encoderID = "wma-enc"; break; |
| 543 | case 6: encoderID = "sndfile-wave-enc"; break; |
| 544 | } |
| 545 | |
| 546 | config->SetStringValue(Config::CategorySettingsID, Config::SettingsEncoderID, encoderID); |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | freac::Config::~Config() |
| 551 | { |
| 552 | } |
| 553 | |
| 554 | freac::Config *freac::Config::Get() |
| 555 | { |
| 556 | if (instance == NIL) |
| 557 | { |
| 558 | instance = new Config(); |
| 559 | } |
| 560 | |
| 561 | return instance; |
| 562 | } |
| 563 | |
| 564 | Void freac::Config::Free() |
| 565 | { |
| 566 | if (instance != NIL) |
| 567 | { |
| 568 | delete instance; |
| 569 | |
| 570 | instance = NIL; |
| 571 | } |
| 572 | } |