tv_rename/functions.hpp

88 lines
2.3 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
2019-02-04 16:39:48 +00:00
#include <iostream>
#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
#ifdef GUI
#include <vector>
#endif
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
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 );
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 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 );
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();
2019-07-12 21:10:40 +00:00
void prepareDB( const std::string &_pattern = "" );
2019-06-04 19:54:00 +00:00
#ifndef GUI
void addToDB( string &show, const string &path, const string &language,
bool linux );
2019-07-12 21:10:40 +00:00
#else
void addToDB( string &show, const string &path, const string &language,
const string &url, const string &pattern, bool linux );
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,
const string &url );
void refreshSingleDB( const size_t &index, bool linux );
2019-06-04 19:54:00 +00:00
2019-02-04 16:39:48 +00:00
void iterateFS( std::map< int, std::set< string > > &seasons,
const string &path );
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
bool searchSpecificSeason( const char_t *const path, size_t &ep_pos,
const string &number );
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