tv_rename/functions.hpp
2019-06-04 21:54:00 +02:00

82 lines
2.0 KiB
C++

#ifndef TV_FUNCTIONS_H
#define TV_FUNCTIONS_H
#include <iostream>
#include <map>
#include <set>
#include <string>
#ifdef GUI
#include <vector>
#endif
#include "network.hpp"
#ifdef _WIN32
using string = std::wstring;
using char_t = wchar_t;
std::wstring utf8_to_wstring( const std::string &utf8 );
#else
using string = std::string;
using char_t = char;
#endif
#ifndef GUI
// CLI functions
string getDefUrl( string &show, const string &language, Curl &c );
void findSeason( std::set< string > &files, int season, const string &path );
void findSeasons( std::map< int, std::set< string > > &seasons,
const string &path, const std::set< int > &season_numbers );
void printHelp();
bool searchSpecificSeason( const char_t *const path, const string &number );
bool searchSeason( const char_t *const path, size_t &season_pos );
bool searchSeason( const char_t *const path );
void parseSeasonNumbers( std::set< int > &seasons_num, const char_t *argument );
void printLangs();
bool findLanguage( const char_t *language );
string encodeUrl( const string &url );
#else
// GUI functions
std::vector< std::pair< string, string > >
getPossibleShows( string show, const string &language, Curl &c );
#endif // GUI
string userHome();
#ifndef GUI
void prepareDB();
void addToDB( string &show, const string &path, const string &language,
bool linux, Curl &c );
void removeFromDB( const string &path );
void changeDBPattern( const string &pattern );
void refreshDB( bool linux, Curl &c );
void updateDB( bool linux, Curl &c );
void cleanDB();
#endif
void iterateFS( std::map< int, std::set< string > > &seasons,
const string &path );
bool searchSpecificSeason( const char_t *const path, size_t &ep_pos,
const string &number );
string compilePattern( const string &pattern, int season, int episode,
const string &filename, const string &episodeName,
const string &showName );
#endif