Mainwindow,functions: move renameFiles to functions, fix dbGetShows declaration

This commit is contained in:
zvon 2020-02-25 10:08:34 +01:00
parent 53024af1a6
commit a6999553ec
3 changed files with 16 additions and 15 deletions

View File

@ -915,3 +915,16 @@ string getDBPattern() {
pattern );
return pattern;
}
/* change names of original files to generated new names
* orig - original filenames
* renamed - renamed filenames (sorted in the same order as `orig`)
*/
void renameFiles( const std::vector< std::tuple< int, string, string, string > >
&renamed_files ) {
for ( const auto &renamed : renamed_files ) {
FSLib::rename(
std::get< 1 >( renamed ) + TEXT( "/" ) + std::get< 2 >( renamed ),
std::get< 1 >( renamed ) + TEXT( "/" ) + std::get< 3 >( renamed ) );
}
}

View File

@ -65,11 +65,13 @@ void updateDB( bool linux, void *progress_ptr );
void cleanDB();
#ifdef GUI
std::vector< std::unordered_map< std::string, std::string > > dbGetShows();
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 *progress_ptr );
void renameFiles( const std::vector< std::tuple< int, string, string, string > >
&renamed_files );
#endif
void iterateFS( std::map< int, std::map< int, string > > &seasons,

View File

@ -108,20 +108,6 @@ void MainWindow::getNames() {
sw->show();
}
/* change names of original files to generated new names
* orig - original filenames
* renamed - renamed filenames (sorted in the same order as `orig`)
*/
void renameFiles( const std::vector<
std::tuple< int, std::string, std::string, std::string > >
&renamed_files ) {
for ( const auto &renamed : renamed_files ) {
FSLib::rename(
std::get< 1 >( renamed ) + "/" + std::get< 2 >( renamed ),
std::get< 1 >( renamed ) + "/" + std::get< 3 >( renamed ) );
}
}
void MainWindow::finishedSelection() {
// remove created SeasonWindow and delete it from memory
app->remove_window( *sw );