1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-02 14:04:22 +00:00

Detect content type after scanning and save to DB.

This commit is contained in:
King_DuckZ 2016-02-22 19:44:48 +01:00
parent 2e77e4dc0b
commit 22614432a9
9 changed files with 141 additions and 36 deletions

View file

@ -0,0 +1,62 @@
/* Copyright 2015, 2016, Michele Santullo
* This file is part of "dindexer".
*
* "dindexer" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "dindexer" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef id45CDD1DAEF4F42968E3C89F68FDDA9BC
#define id45CDD1DAEF4F42968E3C89F68FDDA9BC
#if defined(__GNUC__)
# if defined(__clang__)
# if !defined(__has_attribute)
//Fall back to version number comparing
# else
# if __has_attribute(flatten)
# define a_flatten __attribute__((flatten))
# else
# define a_flatten
# endif
# if __has_attribute(always_inline)
# define a_always_inline __attribute__((always_inline))
# else
# define a_always_inline
# endif
# if __has_attribute(pure)
# define a_pure __attribute__((pure))
# else
# define a_pure
# endif
# if __has_attribute(deprecated)
# define a_deprecated __attribute__((deprecated))
# else
# define a_deprecated
#endif
# endif
# else
//Fix here if you get warnings about unsupported attributes on your compiler
# define a_flatten __attribute__((flatten))
# define a_always_inline __attribute__((always_inline))
# define a_pure __attribute__((pure))
# define a_deprecated __attribute__((deprecated))
# endif
#else
# warning "Unsupported compiler, please fill this section or file a bug"
# define a_flatten
# define a_always_inline
# define a_pure
# define a_deprecated
#endif
#endif

View file

@ -18,6 +18,7 @@
#ifndef id700AFD0F33634ACC88079BB8853A9E13
#define id700AFD0F33634ACC88079BB8853A9E13
#include "dindexer-common/compatibility.h"
#include <string>
namespace dinlib {
@ -33,6 +34,7 @@ namespace dinlib {
};
const std::string& media_type_to_str ( MediaTypes parType );
MediaTypes char_to_media_type ( char parMType ) a_pure;
} //namespace dinlib
#endif

View file

@ -20,21 +20,27 @@
#include "dindexer-common/mediatypes.hpp"
#include "dindexer-machinery/recorddata.hpp"
#include "dindexer-common/compatibility.h"
#include <vector>
namespace mchlib {
enum ContentTypes {
ContentType_Generic,
ContentType_Backup,
ContentType_VideoDVD,
ContentType_VideoBD,
ContentType_VideoCD,
ContentType_Unknown
ContentType_Empty = 'E',
ContentType_Generic = 'G',
ContentType_Backup = 'A',
ContentType_VideoDVD = 'D',
ContentType_VideoBD = 'B',
ContentType_VideoCD = 'C',
ContentType_Unknown = 'U'
};
template <bool> class SetListingView;
ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const SetListingView<true>& parContent, std::size_t parEntriesCount=0 );
ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const std::vector<FileRecordData>& parContent );
char content_type_to_char ( ContentTypes parCType ) a_pure;
ContentTypes char_to_content_type ( char parCType ) a_pure;
} //namespace mchlib
#endif

View file

@ -73,15 +73,15 @@ namespace mchlib {
bool hash_valid;
};
struct SetRecordDataFull {
std::string name;
uint32_t disk_number;
struct SetRecordData {
boost::string_ref name;
char type;
char content_type;
};
struct SetRecordData {
const boost::string_ref name;
const char type;
struct SetRecordDataFull : public SetRecordData {
std::string name;
uint32_t disk_number;
};
} //namespace mchlib