mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-08-18 15:29:48 +00:00
Move mediatypes.hpp/cpp to machinery.
This was needed so that machinery wouldn't depend on common. Also moved compatibility.h to helpers include dir. Ideally mediatypes.hpp will be merged into mediatype.hpp, or there will be some kind of renaming because the two names are getting really confusing.
This commit is contained in:
parent
6ddf79fad9
commit
1956594c01
19 changed files with 48 additions and 53 deletions
|
@ -2,7 +2,6 @@ project(${bare_name}-common CXX C)
|
|||
|
||||
add_library(${PROJECT_NAME}
|
||||
commandline.cpp
|
||||
mediatypes.cpp
|
||||
settings.cpp
|
||||
validationerror.cpp
|
||||
common_info.cpp
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define idB6191389C4AD4EE5862CCF1591BE6CE5
|
||||
|
||||
#include "dindexer-common/validationerror.hpp"
|
||||
#include "dindexer-common/mediatypes.hpp"
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
namespace din {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define id1B7A42F6E46547A6AB0F914E2A91399F
|
||||
|
||||
#include "dindexer-common/validationerror.hpp"
|
||||
#include "dindexer-common/mediatypes.hpp"
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
namespace din {
|
||||
|
|
|
@ -11,6 +11,7 @@ add_library(${PROJECT_NAME} SHARED
|
|||
filesearcher.cpp
|
||||
discinfo.cpp
|
||||
mediatype.cpp
|
||||
mediatypes.cpp
|
||||
machinery_info.cpp
|
||||
guess_content_type.cpp
|
||||
set_listing.cpp
|
||||
|
@ -28,7 +29,6 @@ target_include_directories(${PROJECT_NAME}
|
|||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE ${bare_name}-if
|
||||
PRIVATE ${MAGIC_LIBRARIES}
|
||||
PUBLIC ${bare_name}-common
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace mchlib {
|
|||
};
|
||||
|
||||
struct EntryChecking {
|
||||
typedef bool(*CheckerFunction)(dinlib::MediaTypes, const ConstSetListingView&, const std::vector<const FileRecordData*>&);
|
||||
typedef bool(*CheckerFunction)(MediaTypes, const ConstSetListingView&, const std::vector<const FileRecordData*>&);
|
||||
|
||||
std::size_t max_total_entries;
|
||||
CheckerFunction checker_func;
|
||||
|
@ -87,8 +87,8 @@ namespace mchlib {
|
|||
return std::move(retval);
|
||||
}
|
||||
|
||||
bool identify_video_dvd (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector<const FileRecordData*>& parFlatContent ) {
|
||||
if (parMediaType != dinlib::MediaType_DVD and parMediaType != dinlib::MediaType_Directory)
|
||||
bool identify_video_dvd (MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector<const FileRecordData*>& parFlatContent ) {
|
||||
if (parMediaType != MediaType_DVD and parMediaType != MediaType_Directory)
|
||||
return false;
|
||||
|
||||
const auto items_count = count_listing_items(parContent);
|
||||
|
@ -103,8 +103,8 @@ namespace mchlib {
|
|||
return check_missing_content(parFlatContent, should_have).empty();
|
||||
}
|
||||
|
||||
bool identify_video_cd (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector<const FileRecordData*>& parFlatContent) {
|
||||
if (parMediaType != dinlib::MediaType_CDRom and parMediaType != dinlib::MediaType_Directory)
|
||||
bool identify_video_cd (MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector<const FileRecordData*>& parFlatContent) {
|
||||
if (parMediaType != MediaType_CDRom and parMediaType != MediaType_Directory)
|
||||
return false;
|
||||
|
||||
const auto items_count = count_listing_items(parContent);
|
||||
|
@ -121,7 +121,7 @@ namespace mchlib {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
ContentTypes guess_content_type (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, std::size_t parEntriesCount) {
|
||||
ContentTypes guess_content_type (MediaTypes parMediaType, const ConstSetListingView& parContent, std::size_t parEntriesCount) {
|
||||
if (boost::empty(parContent))
|
||||
return ContentType_Empty;
|
||||
|
||||
|
@ -145,7 +145,7 @@ namespace mchlib {
|
|||
return ContentType_Generic;
|
||||
}
|
||||
|
||||
ContentTypes guess_content_type (dinlib::MediaTypes parMediaType, const std::vector<FileRecordData>& parContent) {
|
||||
ContentTypes guess_content_type (MediaTypes parMediaType, const std::vector<FileRecordData>& parContent) {
|
||||
if (parContent.empty())
|
||||
return ContentType_Empty;
|
||||
|
||||
|
|
|
@ -40,23 +40,23 @@ namespace mchlib {
|
|||
{
|
||||
}
|
||||
|
||||
dinlib::MediaTypes guess_media_type (std::string&& parPath) {
|
||||
MediaTypes guess_media_type (std::string&& parPath) {
|
||||
DiscInfo info(std::move(parPath));
|
||||
const DriveTypes drive_type = info.drive_type();
|
||||
if (DriveType_HardDisk == drive_type) {
|
||||
if (info.mountpoint() == PathName(info.original_path()).path())
|
||||
return dinlib::MediaType_HardDisk;
|
||||
return MediaType_HardDisk;
|
||||
else
|
||||
return dinlib::MediaType_Directory;
|
||||
return MediaType_Directory;
|
||||
}
|
||||
else if (DriveType_Optical == drive_type) {
|
||||
switch (info.optical_type()) {
|
||||
case OpticalType_DVD:
|
||||
return dinlib::MediaType_DVD;
|
||||
return MediaType_DVD;
|
||||
case OpticalType_CDRom:
|
||||
return dinlib::MediaType_CDRom;
|
||||
return MediaType_CDRom;
|
||||
case OpticalType_BluRay:
|
||||
return dinlib::MediaType_BluRay;
|
||||
return MediaType_BluRay;
|
||||
default:
|
||||
throw UnknownMediaTypeException("Set autodetect failed because this media type is unknown, please specify the set type manually");
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dindexer-common/mediatypes.hpp"
|
||||
#include "dindexer-machinery/mediatypes.hpp"
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace dinlib {
|
||||
namespace mchlib {
|
||||
const std::string& media_type_to_str (MediaTypes parType) {
|
||||
static const std::map<MediaTypes, const std::string> types {
|
||||
{MediaType_CDRom, "CD-Rom"},
|
||||
|
@ -43,4 +43,4 @@ namespace dinlib {
|
|||
MediaTypes char_to_media_type (char parMType) {
|
||||
return static_cast<MediaTypes>(parMType);
|
||||
}
|
||||
} //namespace dinlib
|
||||
} //namespace mchlib
|
|
@ -25,7 +25,7 @@
|
|||
namespace mchlib {
|
||||
namespace scantask {
|
||||
MediaType::MediaType (char parDefault, bool parForce, std::string parSearchPath) :
|
||||
m_default(dinlib::char_to_media_type(parDefault))
|
||||
m_default(char_to_media_type(parDefault))
|
||||
#if defined(WITH_MEDIA_AUTODETECT)
|
||||
, m_search_path(std::move(parSearchPath))
|
||||
, m_force(parForce)
|
||||
|
@ -37,11 +37,11 @@ namespace mchlib {
|
|||
#endif
|
||||
}
|
||||
|
||||
void MediaType::on_data_destroy (dinlib::MediaTypes& parData) {
|
||||
parData = dinlib::MediaType_Other;
|
||||
void MediaType::on_data_destroy (MediaTypes& parData) {
|
||||
parData = MediaType_Other;
|
||||
}
|
||||
|
||||
void MediaType::on_data_create (dinlib::MediaTypes& parData) {
|
||||
void MediaType::on_data_create (MediaTypes& parData) {
|
||||
#if defined(WITH_MEDIA_AUTODETECT)
|
||||
if (m_force) {
|
||||
parData = m_default;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define id1B7A42F6E46547A6AB0F914E2A91399F
|
||||
|
||||
#include "dindexer-common/validationerror.hpp"
|
||||
#include "dindexer-common/mediatypes.hpp"
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
namespace din {
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#define id259FD7C96B5049ECB50386F25455FBB2
|
||||
|
||||
#include "dindexer-common/validationerror.hpp"
|
||||
#include "dindexer-common/mediatypes.hpp"
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
namespace din {
|
||||
|
|
|
@ -27,14 +27,14 @@ namespace po = boost::program_options;
|
|||
namespace din {
|
||||
namespace {
|
||||
const char g_allowed_types[] = {
|
||||
static_cast<char>(dinlib::MediaType_CDRom),
|
||||
static_cast<char>(dinlib::MediaType_Directory),
|
||||
static_cast<char>(dinlib::MediaType_DVD),
|
||||
static_cast<char>(dinlib::MediaType_BluRay),
|
||||
static_cast<char>(dinlib::MediaType_FloppyDisk),
|
||||
static_cast<char>(dinlib::MediaType_HardDisk),
|
||||
static_cast<char>(dinlib::MediaType_IomegaZip),
|
||||
static_cast<char>(dinlib::MediaType_Other)
|
||||
static_cast<char>(mchlib::MediaType_CDRom),
|
||||
static_cast<char>(mchlib::MediaType_Directory),
|
||||
static_cast<char>(mchlib::MediaType_DVD),
|
||||
static_cast<char>(mchlib::MediaType_BluRay),
|
||||
static_cast<char>(mchlib::MediaType_FloppyDisk),
|
||||
static_cast<char>(mchlib::MediaType_HardDisk),
|
||||
static_cast<char>(mchlib::MediaType_IomegaZip),
|
||||
static_cast<char>(mchlib::MediaType_Other)
|
||||
};
|
||||
} //unnamed namespace
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define id1B7A42F6E46547A6AB0F914E2A91399F
|
||||
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
#include "dindexer-machinery/mediatypes.hpp"
|
||||
#include "dindexer-machinery/mediatype.hpp"
|
||||
|
||||
namespace din {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue