tv_rename/functions.hpp

74 lines
1.9 KiB
C++
Raw Normal View History

2019-02-04 16:39:48 +00:00
#ifndef TV_FUNCTIONS_H
#define TV_FUNCTIONS_H
2018-09-22 22:50:42 +00:00
#include <map>
2019-02-04 16:39:48 +00:00
#include <set>
#include <string>
2019-07-12 21:10:40 +00:00
#include <unordered_map>
2019-01-23 19:46:03 +00:00
#include <vector>
2019-02-04 16:39:48 +00:00
#include "network.hpp"
#ifdef _WIN32
using string = std::wstring;
using char_t = wchar_t;
std::wstring utf8_to_wstring( const std::string &utf8 );
2019-02-04 16:39:48 +00:00
#else
using string = std::string;
using char_t = char;
#endif
2019-07-12 21:10:40 +00:00
#ifndef GUI
// CLI functions
2018-09-22 22:50:42 +00:00
void printHelp();
string encodeUrl( const string &url );
2019-02-04 16:39:48 +00:00
bool searchSeason( const char_t *const path, size_t &season_pos );
2020-01-15 18:55:24 +00:00
bool searchSeason( const char_t *const path, size_t &season_pos, size_t &ep_pos );
2019-02-04 16:39:48 +00:00
void parseSeasonNumbers( std::set< int > &seasons_num, const char_t *argument );
2019-01-19 12:40:10 +00:00
2019-02-04 16:39:48 +00:00
string encodeUrl( const string &url );
2019-01-23 19:46:03 +00:00
#else
2019-02-04 16:39:48 +00:00
// GUI functions
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
std::vector< std::pair< string, string > >
getPossibleShows( string show, const string &language );
2019-01-23 19:46:03 +00:00
#endif // GUI
2019-01-23 19:46:03 +00:00
2019-06-04 19:54:00 +00:00
string userHome();
2020-01-15 22:59:39 +00:00
void prepareDB( const string &_pattern = TEXT( "" ) );
2019-06-04 19:54:00 +00:00
#ifndef GUI
void addToDB( string &show, const string &path, const string &language,
2020-01-15 21:23:11 +00:00
bool linux, bool dvd );
2019-07-12 21:10:40 +00:00
#else
void addToDB( string &show, const string &path, const string &language,
2020-01-15 21:23:11 +00:00
const string &url, const string &pattern, bool linux, bool dvd );
2019-07-12 21:10:40 +00:00
std::vector< std::unordered_map< std::string, std::string > > dbGetShows();
#endif
2019-06-04 19:54:00 +00:00
void removeFromDB( const string &path );
void changeDBPattern( const string &pattern );
void refreshDB( bool linux );
void updateDB( bool linux );
2019-06-04 19:54:00 +00:00
void cleanDB();
2019-07-12 21:10:40 +00:00
void changeDB( size_t index, const string &path, const string &language,
2020-01-15 18:55:24 +00:00
const string &id, bool dvd );
void refreshSingleDB( const size_t &index, bool linux );
2019-06-04 19:54:00 +00:00
2020-01-15 18:55:24 +00:00
void iterateFS( std::map< int, std::map< int, string > > &seasons,
2019-02-04 16:39:48 +00:00
const string &path );
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
string compilePattern( const string &pattern, int season, int episode,
const string &filename, const string &episodeName,
const string &showName );
2019-01-21 19:30:14 +00:00
2018-09-22 22:50:42 +00:00
#endif