1
0
Fork 0
forked from blue/mlc
This commit is contained in:
Maksim Podoprelov 2024-11-08 13:41:16 +03:00
commit c4bd788bcc
11 changed files with 80 additions and 39 deletions

View file

@ -5,12 +5,12 @@
#
# Use # sign for comments
#
# All printed comented out values are default values
# All printed commented out values are default values
#
# You should have one of this files as ~/.config/mlc.conf,
# if you have started mlc at least once.
# This is going to be used every time you launch mlc,
# so, edit it if you wish to change default behaviour.
# so, edit it if you wish to change default behavior.
#
# Alternatively, you can launch `mlc -c customConfig.conf`
# if you wish to override ~/.config/mlc.conf file
@ -20,26 +20,26 @@
#level info
# Output type
# Allowed values are: [mp3] (more comming soon)
# Allowed values are: [mp3] (more coming soon)
#type mp3
# Source collection path
# This is a default path to your music collection source.
# It's usefull to set it when you always encode the same collection
# It's useful to set it when you always encode the same collection
# Leaving this empty (as it is by default) will make you always
# specify source in the command line
#source
# Destingation path
# Destination path
# This is a default path for your encoding destination
# It's usefull to set it when you often encode your collection
# It's useful to set it when you often encode your collection
# to the same output
# Leaving this empty (as it is by default) will make you always
# specify destination in the command line
#destination
# Parallel tasks
# Defines how many threads are going to be started in parralel
# Defines how many threads are going to be started in parallel
# Allowed values are [0, 1, 2, 3 ...] etc
# If it's set to 0 - amount of threads is going to be
# as high as your processor can effectively handle
@ -62,9 +62,9 @@
# Output quality
# Sets up output quality
# The higher quality the less information is lonst in compression
# The higher quality the less information is lost in compression
# 0 is the highest possible quality for selected mode and type and results in the biggest file
# 9 is the lowest quality but results in the smalest file
# 9 is the lowest quality but results in the smallest file
# Allowed values are [0, 1, 2, ... 9]
# For the constant bitrate modes (CBR) the following table is valid
# Quality | MP3 |
@ -94,5 +94,5 @@
# Switches on or off variable bitrate
# VBR files are usually smaller, but not supped to be worse
# in terms of quality. VBR files might be a bit more tricky for the player
# Allowedvalues are: [true, false]
# Allowed values are: [true, false]
#vbr true

View file

@ -20,23 +20,23 @@ Flags:
- sets action to help, and prints this page
Examples:
`mlc ~/Music comile/latest`
`mlc ~/Music compile/latest`
- reads config file from `~/.config/mlc.conf`
- if there was not - creates default that changes nothing
- creates directory `conpile` in the CURRENT directory if it was not created before
- create `latest` directory in `compile` dirrectory if it was not created before
- creates directory `compile` in the CURRENT directory if it was not created before
- create `latest` directory in `compile` directory if it was not created before
- searches for music in `~/Music` directory
- converts all music to `comile/latest` directory
- copies all other files found in `~/Music` to `comile/latest`
- any file name overlap will be overriden
- converts all music to `compile/latest` directory
- copies all other files found in `~/Music` to `compile/latest`
- any file name overlap will be overridden
`mlc config > myConfig.conf`
- prints default config to standard output
- unix operator `>` redirects output to a file `myConfig.conf`
`mlc rip -c myConfig.conf`
`mlc convert -c myConfig.conf`
- reads file `myConfig.conf` from current directory
- if `myConfig.conf` has a valid `source` entry - uses it and uses `rip` as destination
- if `myConfig.conf` has a valid `destination` entry - uses it and uses `rip` as source
- if both present (don't do this way) - it depends on the order, who comes first - defines behaviour
- if both present (don't do this way) - it depends on the order, who comes first - defines behavior
- the rest is the same from the first example apart from default config

View file

@ -4,7 +4,7 @@
#include <string_view>
#include <algorithm>
constexpr std::array<std::string_view, static_cast<int>(Logger::Severity::_sevetirySize)> levels({
constexpr std::array<std::string_view, static_cast<int>(Logger::Severity::_severitySize)> levels({
"debug",
"info",
"minor",
@ -46,8 +46,8 @@ void Logger::fatal(const std::string& comment, bool colored) const {
Logger::Severity Logger::stringToSeverity(const std::string& line) {
unsigned char dist = std::distance(levels.begin(), std::find(levels.begin(), levels.end(), line));
if (dist < static_cast<unsigned char>(Severity::_sevetirySize))
if (dist < static_cast<unsigned char>(Severity::_severitySize))
return static_cast<Severity>(dist);
return Severity::_sevetirySize;
return Severity::_severitySize;
}

View file

@ -13,7 +13,7 @@ public:
warning,
error,
fatal,
_sevetirySize
_severitySize
};
using Message = std::pair<Severity, std::string>;

View file

@ -4,7 +4,7 @@
#include <string_view>
#include <iostream>
constexpr const std::array<std::string_view, static_cast<int>(Logger::Severity::_sevetirySize)> logSettings({
constexpr const std::array<std::string_view, static_cast<int>(Logger::Severity::_severitySize)> logSettings({
/*debug*/ "\e[90m",
/*info*/ "\e[32m",
/*minor*/ "\e[34m",
@ -14,7 +14,7 @@ constexpr const std::array<std::string_view, static_cast<int>(Logger::Severity::
/*fatal*/ "\e[91m"
});
constexpr const std::array<std::string_view, static_cast<int>(Logger::Severity::_sevetirySize)> logHeaders({
constexpr const std::array<std::string_view, static_cast<int>(Logger::Severity::_severitySize)> logHeaders({
/*debug*/ "DEBUG: ",
/*info*/ "INFO: ",
/*minor*/ "MINOR: ",

View file

@ -203,14 +203,14 @@ unsigned char Settings::getOutputQuality() const {
if (outputQuality.has_value())
return outputQuality.value();
else
return minQuality; //actually, it means max possible quality
return minQuality; //it means max possible quality, min is for min enum value
}
unsigned char Settings::getEncodingQuality() const {
if (encodingQuality.has_value())
return encodingQuality.value();
else
return minQuality; //actually, it means max possible quality
return minQuality; //it means max possible quality, min is for min enum value
}
bool Settings::getVBR() const {
@ -269,7 +269,7 @@ void Settings::readConfigLine(const std::string& line) {
std::string lv;
if (!logLevel.has_value() && stream >> lv) {
Logger::Severity level = Logger::stringToSeverity(lv);
if (level < Logger::Severity::_sevetirySize)
if (level < Logger::Severity::_severitySize)
logLevel = level;
}
} break;