tv_rename/functions.hpp

76 lines
1.9 KiB
C++

#ifndef TV_FUNCTIONS_H
#define TV_FUNCTIONS_H
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#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;
#define TEXT( a ) a
#endif
#ifndef GUI
// CLI functions
void printHelp();
string encodeUrl( const string &url );
bool searchSeason( const char_t *const path, size_t &season_pos );
bool searchSeason( const char_t *const path, size_t &season_pos, size_t &ep_pos );
void parseSeasonNumbers( std::set< int > &seasons_num, const char_t *argument );
string encodeUrl( const string &url );
#else
// GUI functions
std::vector< std::pair< string, string > >
getPossibleShows( string show, const string &language );
#endif // GUI
string userHome();
void prepareDB( const string &_pattern = TEXT( "" ) );
#ifndef GUI
void addToDB( string &show, const string &path, const string &language,
bool linux, bool dvd );
#else
void addToDB( string &show, const string &path, const string &language,
const string &url, const string &pattern, bool linux, bool dvd );
std::vector< std::unordered_map< std::string, std::string > > dbGetShows();
#endif
void removeFromDB( const string &path );
void changeDBPattern( const string &pattern );
void refreshDB( bool linux );
void updateDB( bool linux );
void cleanDB();
void changeDB( size_t index, const string &path, const string &language,
const string &id, bool dvd );
void refreshSingleDB( const size_t &index, bool linux );
void iterateFS( std::map< int, std::map< int, string > > &seasons,
const string &path );
string compilePattern( const string &pattern, int season, int episode,
const string &filename, const string &episodeName,
const string &showName );
#endif