Change variable linux
to unix_names
Turns out that compilers have `#define linux 1` somewhere inside them and for some reason this wasn't a problem when compiling with the `-c` flag
This commit is contained in:
parent
12194d12e2
commit
afd6ca6607
@ -460,11 +460,11 @@ void prepareDB( const string &_pattern ) {
|
||||
|
||||
#ifndef GUI
|
||||
void addToDB( string &show, const string &path, const string &language,
|
||||
bool linux, bool dvd ) {
|
||||
bool unix_names, bool dvd ) {
|
||||
#else
|
||||
void addToDB( const string &show, const string &path, const string &language,
|
||||
const string &id, const string &pattern, bool linux, bool dvd,
|
||||
void *progress_ptr ) {
|
||||
const string &id, const string &pattern, bool unix_names,
|
||||
bool dvd, void *progress_ptr ) {
|
||||
#endif
|
||||
if ( !FSLib::exists( getDBName() ) )
|
||||
prepareDB();
|
||||
@ -517,8 +517,8 @@ void addToDB( const string &show, const string &path, const string &language,
|
||||
size_t i = 0;
|
||||
size_t seasons_size = seasons.size();
|
||||
for ( auto &x : seasons ) {
|
||||
singleSeason( absolute, show, x.first, id, language, pattern, linux,
|
||||
true, &x.second, false, dvd );
|
||||
singleSeason( absolute, show, x.first, id, language, pattern,
|
||||
unix_names, true, &x.second, false, dvd );
|
||||
i++;
|
||||
p.print( ( i * 100 ) / seasons_size );
|
||||
}
|
||||
@ -576,9 +576,9 @@ void cleanUpLine() {
|
||||
#endif
|
||||
|
||||
#ifndef GUI
|
||||
void refreshDB( bool linux ) {
|
||||
void refreshDB( bool unix_names ) {
|
||||
#else
|
||||
void refreshDB( bool linux, void *progress_ptr ) {
|
||||
void refreshDB( bool unix_names, void *progress_ptr ) {
|
||||
#endif
|
||||
if ( !FSLib::exists( getDBName() ) )
|
||||
return;
|
||||
@ -629,8 +629,8 @@ void refreshDB( bool linux, void *progress_ptr ) {
|
||||
for ( auto &x : seasons ) {
|
||||
singleSeason( show[TEXT( "PATH" )], show[TEXT( "SHOW" )],
|
||||
x.first, show[TEXT( "TVID" )],
|
||||
show[TEXT( "LANGUAGE" )], pattern, linux, true,
|
||||
&x.second, false,
|
||||
show[TEXT( "LANGUAGE" )], pattern, unix_names,
|
||||
true, &x.second, false,
|
||||
show[TEXT( "DVD" )] == TEXT( "1" ) );
|
||||
i++;
|
||||
p.print( ( i * 100 ) / seasons_size );
|
||||
@ -667,9 +667,9 @@ void refreshDB( bool linux, void *progress_ptr ) {
|
||||
}
|
||||
|
||||
#ifndef GUI
|
||||
void updateDB( bool linux ) {
|
||||
void updateDB( bool unix_names ) {
|
||||
#else
|
||||
void updateDB( bool linux, void *progress_ptr ) {
|
||||
void updateDB( bool unix_names, void *progress_ptr ) {
|
||||
#endif
|
||||
if ( !FSLib::exists( getDBName() ) )
|
||||
return;
|
||||
@ -735,8 +735,8 @@ void updateDB( bool linux, void *progress_ptr ) {
|
||||
for ( auto &x : new_eps ) {
|
||||
singleSeason( show[TEXT( "PATH" )], show[TEXT( "SHOW" )],
|
||||
x.first, show[TEXT( "TVID" )],
|
||||
show[TEXT( "LANGUAGE" )], pattern, linux, true,
|
||||
&x.second, false,
|
||||
show[TEXT( "LANGUAGE" )], pattern, unix_names,
|
||||
true, &x.second, false,
|
||||
show[TEXT( "DVD" )] == TEXT( "1" ) );
|
||||
i++;
|
||||
p.print( ( i * 100 ) / size );
|
||||
@ -892,7 +892,7 @@ void changeDB( size_t index, const string &path, const string &language,
|
||||
TEXT( " WHERE ID == " ) + show_id + TEXT( ";" ) );
|
||||
}
|
||||
|
||||
void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux,
|
||||
void refreshSelectDB( std::unordered_set< size_t > indexes, bool unix_names,
|
||||
void *progress_ptr ) {
|
||||
if ( !FSLib::exists( getDBName() ) )
|
||||
return;
|
||||
@ -939,8 +939,8 @@ void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux,
|
||||
for ( auto &x : seasons ) {
|
||||
singleSeason( show[TEXT( "PATH" )], show[TEXT( "SHOW" )],
|
||||
x.first, show[TEXT( "TVID" )],
|
||||
show[TEXT( "LANGUAGE" )], pattern, linux, true,
|
||||
&x.second, false,
|
||||
show[TEXT( "LANGUAGE" )], pattern, unix_names,
|
||||
true, &x.second, false,
|
||||
show[TEXT( "DVD" )] == TEXT( "1" ) );
|
||||
i++;
|
||||
p.print( ( i * 100 ) / size );
|
||||
|
@ -53,21 +53,21 @@ string userHome();
|
||||
void prepareDB( const string &_pattern = TEXT( "" ) );
|
||||
#ifndef GUI
|
||||
void addToDB( string &show, const string &path, const string &language,
|
||||
bool linux, bool dvd );
|
||||
bool unix_names, bool dvd );
|
||||
#else
|
||||
void addToDB( const string &show, const string &path, const string &language,
|
||||
const string &id, const string &pattern, bool linux, bool dvd,
|
||||
void *progress_ptr );
|
||||
const string &id, const string &pattern, bool unix_names,
|
||||
bool dvd, void *progress_ptr );
|
||||
#endif
|
||||
void removeFromDB( const string &path );
|
||||
void changeDBPattern( const string &pattern );
|
||||
#ifndef GUI
|
||||
void refreshDB( bool linux );
|
||||
void updateDB( bool linux );
|
||||
void refreshDB( bool unix_names );
|
||||
void updateDB( bool unix_names );
|
||||
void cleanDB();
|
||||
#else
|
||||
void refreshDB( bool linux, void *progress_ptr );
|
||||
void updateDB( bool linux, void *progress_ptr );
|
||||
void refreshDB( bool unix_names, void *progress_ptr );
|
||||
void updateDB( bool unix_names, void *progress_ptr );
|
||||
void cleanDB( void *progress_ptr );
|
||||
#endif
|
||||
|
||||
@ -75,7 +75,7 @@ void cleanDB( void *progress_ptr );
|
||||
std::vector< std::unordered_map< string, string > > dbGetShows();
|
||||
void changeDB( size_t index, const string &path, const string &language,
|
||||
const string &id, bool dvd );
|
||||
void refreshSelectDB( std::unordered_set< size_t > indexes, bool linux,
|
||||
void refreshSelectDB( std::unordered_set< size_t > indexes, bool unix_names,
|
||||
void *progress_ptr );
|
||||
void renameFiles( const std::vector< std::tuple< int, string, string, string > >
|
||||
&renamed_files );
|
||||
|
@ -21,9 +21,10 @@ DatabaseWindow::~DatabaseWindow() {
|
||||
}
|
||||
|
||||
DatabaseWindow::DatabaseWindow(
|
||||
bool _linux, std::map< std::string, std::string > &_language_map,
|
||||
bool _unix_names, std::map< std::string, std::string > &_language_map,
|
||||
Glib::RefPtr< Gtk::Application > _app )
|
||||
: linux( _linux ), language_map( _language_map ), app( _app ) {
|
||||
: unix_names( _unix_names ), language_map( _language_map ),
|
||||
app( _app ) {
|
||||
set_title( _( DATABASE ) );
|
||||
property_modal().set_value( true );
|
||||
|
||||
@ -222,7 +223,8 @@ void DatabaseWindow::save() {
|
||||
|
||||
pw->show();
|
||||
|
||||
std::thread t = std::thread( refreshSelectDB, changed_rows, linux, pw );
|
||||
std::thread t =
|
||||
std::thread( refreshSelectDB, changed_rows, unix_names, pw );
|
||||
t.detach();
|
||||
|
||||
changed_rows.clear();
|
||||
|
@ -12,7 +12,7 @@
|
||||
class DatabaseWindow : public Gtk::Window {
|
||||
public:
|
||||
DatabaseWindow() = delete;
|
||||
DatabaseWindow( bool _linux,
|
||||
DatabaseWindow( bool _unix_names,
|
||||
std::map< std::string, std::string > &_language_map,
|
||||
Glib::RefPtr< Gtk::Application > _app );
|
||||
virtual ~DatabaseWindow();
|
||||
@ -72,7 +72,7 @@ protected:
|
||||
Glib::RefPtr< Gtk::TreeStore > m_model;
|
||||
Gtk::CellRendererCombo m_combo_language;
|
||||
|
||||
bool linux;
|
||||
bool unix_names;
|
||||
std::map< std::string, std::string > &language_map;
|
||||
Glib::RefPtr< Gtk::Application > app;
|
||||
std::unique_ptr< SearchWindow > sw{ nullptr };
|
||||
|
@ -186,7 +186,7 @@ std::vector< string > getEpisodeNames( const string &id, const string &season,
|
||||
std::vector< std::tuple< int, string, string, string > >
|
||||
getRenamedFiles( const string &show, int season, const string &id,
|
||||
const string &language, const string &pattern,
|
||||
const bool &linux, const std::map< int, string > &files,
|
||||
const bool &unix_names, const std::map< int, string > &files,
|
||||
bool dvd ) {
|
||||
auto season_num = toString( std::to_string( season ) );
|
||||
auto episodes = getEpisodeNames( id, season_num, language, dvd );
|
||||
@ -227,7 +227,7 @@ getRenamedFiles( const string &show, int season, const string &id,
|
||||
}
|
||||
}
|
||||
// replace characters illegal in windows if desired
|
||||
if ( !linux ) {
|
||||
if ( !unix_names ) {
|
||||
name.erase( std::remove_if( name.begin(), name.end(),
|
||||
[]( char_t x ) {
|
||||
return x == '?' || x == '"' ||
|
||||
@ -318,7 +318,7 @@ bool authenticate( const std::string &api_key ) {
|
||||
|
||||
void singleSeason( const string &path, const string &show, int season,
|
||||
string id, const string &language, const string &pattern,
|
||||
const bool &linux, const bool &trust,
|
||||
const bool &unix_names, const bool &trust,
|
||||
std::map< int, string > *files_ptr, bool print, bool dvd ) {
|
||||
#ifndef GUI
|
||||
if ( id.empty() )
|
||||
@ -340,7 +340,7 @@ void singleSeason( const string &path, const string &show, int season,
|
||||
}
|
||||
|
||||
auto renamed_files = getRenamedFiles( show, season, id, language, pattern,
|
||||
linux, *files_ptr, dvd );
|
||||
unix_names, *files_ptr, dvd );
|
||||
|
||||
if ( renamed_files.empty() )
|
||||
goto end;
|
||||
|
@ -28,7 +28,7 @@ using char_t = char;
|
||||
|
||||
void singleSeason( const string &path, const string &show, int season,
|
||||
string id, const string &language, const string &pattern,
|
||||
const bool &linux, const bool &trust,
|
||||
const bool &unix_names, const bool &trust,
|
||||
std::map< int, string > *files_ptr = nullptr,
|
||||
bool print = true, bool dvd = false );
|
||||
|
||||
@ -43,7 +43,7 @@ void singleSeason( const string &path, const string &show, int season,
|
||||
std::vector< std::tuple< int, string, string, string > >
|
||||
getRenamedFiles( const string &show, int season, const string &id,
|
||||
const string &language, const string &pattern,
|
||||
const bool &linux, const std::map< int, string > &files,
|
||||
const bool &unix_names, const std::map< int, string > &files,
|
||||
bool dvd = false );
|
||||
|
||||
#ifndef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user