1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
| #pragma once
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#define _CRT_SECURE_NO_WARNINGS
// C :
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
// C++
#include <windows.h>
#include <cassert>
//#include <cstddef>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
//#include <stdio.h>
#include <locale>
#include <algorithm>
#include <codecvt>
#include <sstream>
//#include <tuple>
#include <regex>
#include <numeric>
#include <string_view>
#include <optional>
#include <filesystem> // C++17 standard header file name
extern const std::vector<std::wstring> Genre;
extern const std::vector<std::wstring> Sur;
extern const std::vector<std::wstring> Sous_Genre;
extern const std::vector<std::wstring> Nationalite;
struct DateRecord;
struct InfosVisionnage;
struct SequenceVisionnage;
struct Episode;
struct Saison;
class Serie;
struct InfosVisionnage
{
const Saison& m_saison;
InfosVisionnage(const Saison& saison, std::filesystem::path const& m_cheminFichier);
std::filesystem::path m_cheminFichier;
void Une_Fonction_De_La_Classe_InfosVisionnage(...);
std::vector<std::wstring>m_keyColor{ L"\x1b[94;1m", L"\x1b[38;2;0;255;0m" }; // keyColor[0] (bleu) et keyColor[1] (vert)
std::wstring m_valuesColor = L"\x1b[38;2;255;255;255m"; // Blanc
//unsigned short int m_NumeroSaison{};
//unsigned short int m_NumeroEpisode{};
long m_NumeroSaison{};
long m_NumeroEpisode{};
std::vector<DateRecord> m_DatesVisionnage{ 0 };
std::wstring m_streaming{ L"" };
std::vector<std::wstring> m_titres;
// unsigned short int m_numero{ 1 };
int m_numero{ -1 };
//long m_duree{ -1 };
//long m_duree{ 0 };
long m_duree_en_seconde{ 0 };
std::vector<std::wstring> m_resume;
private:
void initialiser_Duree(std::wstring& m);
};
struct SequenceVisionnage
{
SequenceVisionnage(const Episode& episode, const InfosVisionnage& info_vis) :
m_episode{ episode }, m_titres{ info_vis.m_titres }, m_streaming{ info_vis.m_streaming },
m_duree_en_seconde{ info_vis.m_duree_en_seconde }, m_resume{ info_vis.m_resume },
m_DatesVisionnage{ info_vis.m_DatesVisionnage }
{};
SequenceVisionnage(const Episode& episode, const SequenceVisionnage& src) :
m_episode{ episode }, m_titres{ src.m_titres }, m_streaming{ src.m_streaming },
m_duree_en_seconde{ src.m_duree_en_seconde }, m_resume{ src.m_resume },
m_DatesVisionnage{ src.m_DatesVisionnage }
{};
boolean operator==(const SequenceVisionnage& rhs) const { return this == &rhs; };
std::wstring calcul_Duree_affichage(int numero_sequence) const;
// uneFonctionQuiAfficheLaSequenceDeVisionnage
//std::wstring uneFonctionQuiAfficheLaSequenceDeVisionnage(bool) const;
//void uneFonctionQuiAfficheLaSequenceDeVisionnage(bool) const;
void Une_Fonction_De_La_Classe_SequenceVisionnage(...);
const void AffichagePersonnaliser(AffichagePersonnalisation perso);
//void Print(int numero_sequence) const;
void Print(std::vector<std::wstring>&titres, int numero_sequence) const;
std::wstring Print_Dates_de_visionnage() const;
long Print_Titre_chiffre(long episode) const;
std::wstring m_espace1;
std::wstring m_labelHeureSingulier;
std::wstring m_labelHeurePluriel;
std::wstring m_espace2;
std::wstring m_espace3;
std::wstring m_labelMinuteSingulier;
std::wstring m_labelMinutePluriel;
std::vector<std::wstring>m_keyColor;
std::wstring m_valuesColor;
//long m_NumeroSaison{1};
//long m_NumeroEpisode{1};
std::wstring m_streaming{ L"" };
std::vector<std::wstring> m_titres;
long m_duree_en_seconde{ -1 };
std::vector<std::wstring> m_resume{};
std::vector<DateRecord> m_DatesVisionnage{};
int m_numero{ -1 };
long m_duree { -1 };
bool affichage_duree_actif = true;// false;
private:
const Episode& m_episode;
};
struct Episode
{
const Saison& m_saison;
Episode(const InfosVisionnage& info_vis);
Episode(const Episode& src) :m_saison{ src.m_saison }
{
operator=(src);
}
Episode(Episode&& src) noexcept :m_saison { src.m_saison }// the expression "arg.member" is lvalue
{
operator=(std::move(src));
}
Episode(const Saison& saison, Episode&& src) :m_saison{ saison }{
operator=(std::move(src));
};
// Simple move assignment operator
private:
Episode& operator=(Episode&& src) noexcept
{
operator=(src);
return *this;
}
Episode& operator=(const Episode& src)
{
if (&src != this)
{
for (auto const& seq : src.m_liste_sequence_visionnages_ordonnee_chronologiquement)
{
m_liste_sequence_visionnages_ordonnee_chronologiquement.emplace_back(SequenceVisionnage{*this, seq });
}
m_espace1 = src.m_espace1;
m_labelHeureSingulier = src.m_labelHeureSingulier;
m_labelHeurePluriel = src.m_labelHeurePluriel;
m_espace2 = src.m_espace2;
m_espace3 = src.m_espace3;
m_labelMinuteSingulier = src.m_labelMinuteSingulier;
m_labelMinutePluriel = src.m_labelMinutePluriel;
m_keyColor = src.m_keyColor;
m_valuesColor = src.m_valuesColor;
m_episode = src.m_episode;
m_numero = src.m_numero;
m_duree = src.m_duree;
m_resume = src.m_resume;
lInfoQuiMInteresse = src.lInfoQuiMInteresse;
}
return *this;
}
public:
void ajouter_SequenceVisionnage(const InfosVisionnage& info_vis);
const void AffichagePersonnaliser(AffichagePersonnalisation perso);
long long GetNumeroSequenceVisionnage(const SequenceVisionnage& sev_vis) const;
void Une_Fonction_De_La_Classe_SequenceVisionnage_xxx(...);
void Print();
std::wstring m_espace1;
std::wstring m_labelHeureSingulier;
std::wstring m_labelHeurePluriel;
std::wstring m_espace2;
std::wstring m_espace3;
std::wstring m_labelMinuteSingulier;
std::wstring m_labelMinutePluriel;
std::vector<std::wstring>m_keyColor;
std::wstring m_valuesColor;
long m_episode{};
std::vector<SequenceVisionnage> m_liste_sequence_visionnages_ordonnee_chronologiquement{};
int m_numero{ -1 };
long m_duree{ -1 };
std::vector<std::wstring> m_resume;
int lInfoQuiMInteresse;
//long m_NumeroEpisode{1};
};
struct Saison
{
public:
const Serie& m_serie;
Saison(std::filesystem::path const& cheminFichier, const Serie& serie);
Saison(Saison&& src) noexcept : m_serie{ std::move(src.m_serie) }// the expression "arg.member" is lvalue
{
operator=(std::move(src));
}
// Simple move assignment operator
private:
Saison& operator=(Saison&& src) noexcept
{
if (&src != this)
{
for (auto const& [key, ep] : src.m_liste_episodes)
{
Episode tmp(*this, std::move(*ep));
m_liste_episodes.emplace( key, std::make_shared<Episode>(tmp) );
}
m_min = std::move(src.m_min);
m_espace1 = std::move(src.m_espace1);
m_labelHeureSingulier = std::move(src.m_labelHeureSingulier);
m_labelHeurePluriel = std::move(src.m_labelHeurePluriel);
m_espace2 = std::move(src.m_espace2);
m_espace3 = std::move(src.m_espace3);
m_labelMinuteSingulier = std::move(src.m_labelMinuteSingulier);
m_labelMinutePluriel = std::move(src.m_labelMinutePluriel);
m_keyColor = std::move(src.m_keyColor);
m_valuesColor = std::move(src.m_valuesColor);
m_audiodescription = std::move(src.m_audiodescription);
m_avec = std::move(src.m_avec);
m_date_diffusee_a_partir_de = std::move(src.m_date_diffusee_a_partir_de);
m_disney = std::move(src.m_disney);
m_f_anneesDiffusion = std::move(src.m_f_anneesDiffusion);
m_chaine = std::move(src.m_chaine);
m_hors_saison = std::move(src.m_hors_saison);
m_image = std::move(src.m_image);
m_netflix = std::move(src.m_netflix);
m_note = std::move(src.m_note);
m_titres = std::move(src.m_titres);
m_resume = std::move(src.m_resume);
m_numero = std::move(src.m_numero);
lInfoQuiMInteresse = std::move(src.lInfoQuiMInteresse);
affichage_audiodescription_actif = std::move(src.affichage_audiodescription_actif);
affichage_avec_actif = std::move(src.affichage_avec_actif);
affichage_chaine_actif = std::move(src.affichage_chaine_actif);
affichage_date_etc_actif = std::move(src.affichage_date_etc_actif);
affichage_image_actif = std::move(src.affichage_image_actif);
affichage_netflix_actif = std::move(src.affichage_netflix_actif);
affichage_note_actif = std::move(src.affichage_note_actif);
}
return *this;
}
public:
//void ajouter_InfosVisionnage(SequenceVisionnage const& seq_vis);
void initialiser_Fichier(std::filesystem::path const& cheminFichier);
void initialiser_Chaine(std::filesystem::path const& cheminFichier);
void initialiser_Hors_Saison(std::filesystem::path const& cheminFichier);
void initialiser_Netflix(std::filesystem::path const& cheminFichier);
void initialiser_Note(std::filesystem::path const& cheminFichier);
void initialiser_Resume(std::filesystem::path const& cheminFichier);
void initialiser_Titre(std::filesystem::path const& cheminFichier);
const void AffichagePersonnaliser(AffichagePersonnalisation perso);
void Print();
void Print_Avec();
void Print_Chaine();
const void Print_Date_etc();
void Print_Header();
void Print_Images();
void Print_Netflix();
void Print_Note();
std::wstring m_min = L"min";
std::wstring m_espace1;
std::wstring m_labelHeureSingulier;
std::wstring m_labelHeurePluriel;
std::wstring m_espace2;
std::wstring m_espace3;
std::wstring m_labelMinuteSingulier;
std::wstring m_labelMinutePluriel;
std::vector<std::wstring>m_keyColor;
std::wstring m_valuesColor;
std::wstring m_audiodescription;
std::vector<std::pair<std::wstring, std::wstring>> m_avec;
std::pair<std::tm, std::wstring>m_date_diffusee_a_partir_de;
bool m_disney{ false };
int m_f_anneesDiffusion{ 0 };
//std::pair<std::tm, std::wstring>m_dossier;
//std::vector<Episode> episodes;
//std::vector<InfosVisionnage>infosvisionnages;
std::wstring m_chaine;
bool m_hors_saison{ false };
//long m_hors_saison_duree{ -1 };
//std::vector<std::wstring> m_hors_saison_resume;
std::vector<std::wstring> m_image;
bool m_netflix{ false };
double m_note{ -1.0 };
//std::pair<unsigned short int, std::vector<std::wstring>>saison;
std::vector<std::wstring> m_titres;
std::vector<std::wstring> m_resume;
std::map<int, std::shared_ptr<Episode>> m_liste_episodes;
mutable int m_numero{ -1 };
int lInfoQuiMInteresse{};
bool affichage_audiodescription_actif = true;
bool affichage_avec_actif = true;
bool affichage_chaine_actif = true;
bool affichage_date_etc_actif = true;
bool affichage_image_actif = true;
bool affichage_netflix_actif = true;
bool affichage_note_actif = true;
};
class Serie
{
public:
Serie(std::filesystem::path racine);
void initialiser_Fichier(std::filesystem::path const& cheminFichier);
void initialiser_Chaine(std::filesystem::path const& cheminFichier);
void initialiser_Creee_par(std::filesystem::path const& cheminFichier);
void initialiser_En_relation_avec(std::filesystem::path const& cheminFichier);
void initialiser_Titre(std::filesystem::path const& cheminFichier);
const void AffichagePersonnaliser(AffichagePersonnalisation perso);
const void Print();
std::vector<Saison>saisons{};
std::filesystem::path getRacine() { return racine; };
std::filesystem::path getFileName() { return racine.filename(); };
std::vector<std::wstring> m_resume;
int lInfoQuiMInteresse{};
private:
std::pair<int, int> calculer_Annees_Diffusion() const;
std::wstring calcul_Duree_affichage() const;
std::wstring calcul_Note_Affichage() const;
std::wstring calcul_Signaletique_Jeunesse_affichage() const;
std::wstring calcul_Sur_Affichage() const;
std::wstring calcul_Titres_Affichage() const;
std::wstring calcul_X_Signaletique_Jeunesse_affichage(std::wstring& sur_str) const;
const void corriger_Annee_Debut();// const;
const void corriger_Annee_Fin();
std::wstring format_Annees() const;
std::wstring format_AnneesEtSur(std::wstring& annees_str, std::wstring& sur_str) const;
std::pair<std::optional<int>, std::optional<int>> m_f_anneesProduction;
const void Print_Saison(Saison saison);
void Print_Saisons();
void Print_Avec_etc();
const void Print_Chaine();
const void Print_Creee_par();
const void Print_En_relation_avec();
void Print_Header() const;
std::filesystem::path racine;
std::wstring m_espace1;
std::wstring m_labelHeureSingulier;
std::wstring m_labelHeurePluriel;
std::wstring m_espace2;
std::wstring m_espace3;
std::wstring m_labelMinuteSingulier;
std::wstring m_labelMinutePluriel;
std::vector<std::wstring>m_keyColor;
std::wstring m_valuesColor;
int m_annees{};
std::wstring m_audiodescription;
std::vector<std::wstring> m_catalogue;
std::wstring m_chaine;
std::vector<std::wstring> m_creee_par;
std::wstring m_disney_sj;
std::wstring m_en_relation_avec;
std::vector<std::wstring> m_genre;
std::vector<std::wstring> m_image;
std::vector<std::wstring> m_nationalite;
std::wstring m_netflix_sj;
double m_note{ 0.0 };
std::wstring m_sj;
std::wstring m_sous_genre;
std::wstring m_sur;
std::vector<std::wstring> m_titres;
long m_duree{ -1 };
std::vector<std::wstring> m_titres_originaux;
bool affichage_annees_actif = true;
bool affichage_audiodescription_actif = true;
bool affichage_avec_actif = true;
bool affichage_avec_etc_actif = true;
bool affichage_chaine_actif = true;
bool affichage_catalogue_actif = true;
bool affichage_creee_par_actif = true;
bool affichage_disney_sj_actif = true;
bool affichage_duree_actif = true;// false;
bool affichage_episode_titre_actif = true;
bool affichage_en_relation_avec_actif = true;
bool affichage_image_actif = true;
bool affichage_genres_actif = true;
bool affichage_nationalite_actif = true;
bool affichage_netflix_sj_actif = true;
bool affichage_note_actif = true;// false;
bool affichage_resume_actif = true;
//bool affichage_saison_actif = true;
bool affichage_saison_date_etc_actif = true;
bool affichage_saisons_actif = true;
bool affichage_serie_actif = true;
bool affichage_sj_actif = true;
bool affichage_sous_genre_actif = true;
bool affichage_sur_actif = true; //
bool affichage_titres_actif = true;
bool affichage_titres_originaux_actif = true;
bool affichage_x_sj_actif = true;
}; |
Partager