Formatting
This commit is contained in:
parent
d2ae8ab94c
commit
d36d7a385d
24
.clang-format
Normal file
24
.clang-format
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
BasedOnStyle: LLVM
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
Cpp11BracedListStyle: 'false'
|
||||
IndentWidth: '4'
|
||||
Language: Cpp
|
||||
PointerAlignment: Right
|
||||
SortIncludes: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesInAngles: 'true'
|
||||
SpacesInCStyleCastParentheses: 'true'
|
||||
SpacesInContainerLiterals: 'true'
|
||||
SpacesInParentheses: 'true'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
Standard: Cpp11
|
||||
TabWidth: '4'
|
||||
UseTab: Never
|
||||
|
||||
...
|
@ -118,7 +118,6 @@ public:
|
||||
return dir_path.c_str();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
string dir_path;
|
||||
};
|
||||
|
@ -129,7 +129,7 @@ bool searchSpecificSeason( const char_t *const path, size_t &ep_pos,
|
||||
while ( path[cur_pos] == '0' )
|
||||
cur_pos++;
|
||||
// if season number is 0, move back because previous loop skipped it
|
||||
if( number == TEXT("0") )
|
||||
if ( number == TEXT( "0" ) )
|
||||
cur_pos--;
|
||||
// make sure season's number is the same as provided in argument
|
||||
// `number`
|
||||
@ -193,8 +193,8 @@ void iterateFS( std::map< int, std::set< string > > &seasons,
|
||||
// if file is a correct format, add it to file list
|
||||
// for its season
|
||||
if ( searchSeason( p, season_pos ) )
|
||||
seasons[std::stoi( p + season_pos )].insert(
|
||||
path + dir_divider + p );
|
||||
seasons[std::stoi( p + season_pos )].insert( path + dir_divider +
|
||||
p );
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,11 +286,13 @@ void printHelp() {
|
||||
cout << "Usage:" << std::endl;
|
||||
cout << " tv_rename [options] [path]" << std::endl << std::endl;
|
||||
cout << " -h, --help show this help message and exit"
|
||||
<< std::endl << std::endl;
|
||||
<< std::endl
|
||||
<< std::endl;
|
||||
cout << " path can be either a file or a directory, if it's a directory"
|
||||
<< std::endl;
|
||||
cout << " all files in it and its subdirectories will be renamed"
|
||||
<< std::endl << std::endl;
|
||||
<< std::endl
|
||||
<< std::endl;
|
||||
cout << "OPTIONS" << std::endl;
|
||||
cout << " -s, --show <string> TV show from which you want the";
|
||||
cout << " episode names" << std::endl;
|
||||
@ -394,11 +396,10 @@ getPossibleShows( string show, const string &language, Curl &c ) {
|
||||
show = encodeUrl( show );
|
||||
#ifdef _WIN32
|
||||
auto source_code = utf8_to_wstring(
|
||||
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
|
||||
show + TEXT( "&l=" ) + language ) );
|
||||
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) + show +
|
||||
TEXT( "&l=" ) + language ) );
|
||||
#else
|
||||
auto source_code =
|
||||
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
|
||||
auto source_code = c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
|
||||
show + TEXT( "&l=" ) + language );
|
||||
#endif
|
||||
size_t pos{};
|
||||
|
6
main.cpp
6
main.cpp
@ -163,7 +163,7 @@ int parseCommandLine( string &show, std::set< int > &seasons_num, string &path,
|
||||
{ "print-langs", no_argument, 0, '0' },
|
||||
{ "name-pattern", required_argument, 0, '1' },
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ 0, 0, 0, 0}
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
int i{}; // this is useless, but needed for handleArgument
|
||||
@ -224,7 +224,7 @@ int main
|
||||
|
||||
if ( !FSLib::isDirectory( path ) && FSLib::exists( path ) ) {
|
||||
// specified file, not directory
|
||||
auto *file_set = new std::set<string>;
|
||||
auto *file_set = new std::set< string >;
|
||||
file_set->insert( path );
|
||||
size_t season_pos{};
|
||||
if ( !searchSeason( path.c_str(), season_pos ) ) {
|
||||
@ -233,7 +233,7 @@ int main
|
||||
return 1;
|
||||
} else {
|
||||
auto season = std::stoi( path.c_str() + season_pos );
|
||||
singleSeason( path, show, season, TEXT(""), language, pattern,
|
||||
singleSeason( path, show, season, TEXT( "" ), language, pattern,
|
||||
linux, trust, c, file_set );
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "network.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <Windows.h>
|
||||
#include <WinInet.h>
|
||||
#include <Windows.h>
|
||||
|
||||
using string = std::wstring;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <string>
|
||||
#include "seasonwindow.hpp"
|
||||
#include <string>
|
||||
|
||||
void SeasonWindow::confirm() {
|
||||
// go through all checkbuttons and save numbers
|
||||
|
@ -13,10 +13,10 @@
|
||||
|
||||
#ifndef GUI
|
||||
|
||||
#include "filesystem.hpp"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include "filesystem.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include "../filesystem.hpp"
|
||||
#include <sys/stat.h>
|
||||
|
||||
FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {}
|
||||
|
||||
FSLib::Directory::Iterator::Iterator( const Directory &d_ ) : d( opendir( d_.path() ) ) {
|
||||
FSLib::Directory::Iterator::Iterator( const Directory &d_ )
|
||||
: d( opendir( d_.path() ) ) {
|
||||
current_entry = readdir( d );
|
||||
if ( current_entry != nullptr &&
|
||||
( !strcmp( current_entry->d_name, "." ) ||
|
||||
@ -11,7 +12,8 @@ FSLib::Directory::Iterator::Iterator( const Directory &d_ ) : d( opendir( d_.pat
|
||||
++( *this );
|
||||
}
|
||||
|
||||
FSLib::Directory::Iterator::Iterator( const Directory &d_, const struct dirent *current_entry_ )
|
||||
FSLib::Directory::Iterator::Iterator( const Directory &d_,
|
||||
const struct dirent *current_entry_ )
|
||||
: d( opendir( d_.path() ) ), current_entry( current_entry_ ) {}
|
||||
|
||||
FSLib::Directory::Iterator::~Iterator() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "../filesystem.hpp"
|
||||
#include <Shlwapi.h>
|
||||
#include <windows.h>
|
||||
#include "../filesystem.hpp"
|
||||
|
||||
FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {
|
||||
// need to append \\* for windows to search files in directory
|
||||
|
Loading…
Reference in New Issue
Block a user