tv_rename/functions.hpp

74 lines
1.7 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-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;
#else
using string = std::string;
using char_t = char;
#endif
#ifdef _WIN32
std::wstring utf8_to_wstring( const std::string &utf8 );
#endif
2019-01-23 19:46:03 +00:00
#ifndef GUI
2019-02-04 16:39:48 +00:00
// CLI functions
2019-01-23 19:46:03 +00:00
2019-02-04 16:39:48 +00:00
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 );
2018-09-22 22:50:42 +00:00
void printHelp();
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
void printLangs();
2019-02-04 16:39:48 +00:00
bool findLanguage( const char_t *language );
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, Curl &c );
string userHome();
2019-01-23 19:46:03 +00:00
#endif
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