Skip to content

Commit

Permalink
fix you-get auto update feature+add Korean translations
Browse files Browse the repository at this point in the history
  • Loading branch information
mhogomchungu committed Jul 2, 2024
1 parent 12f1807 commit 269af2e
Show file tree
Hide file tree
Showing 22 changed files with 322 additions and 402 deletions.
4 changes: 2 additions & 2 deletions src/engines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ engines::engine::engine( Logger& logger,
m_line( m_jsonObject.value( "VersionStringLine" ).toInt() ),
m_position( m_jsonObject.value( "VersionStringPosition" ).toInt() ),
m_valid( true ),
m_autoUpdate( m_jsonObject.value( "AutoUpdate" ).toBool() ),
m_autoUpdate( m_jsonObject.value( "AutoUpdate" ).toBool( true ) ),
m_likeYoutubeDl( m_jsonObject.value( "LikeYoutubeDl" ).toBool() ),
m_mainEngine( true ),
m_archiveContainsFolder( m_jsonObject.value( "ArchiveContainsFolder" ).toBool() ),
Expand Down Expand Up @@ -1563,7 +1563,7 @@ bool engines::engine::baseEngine::foundNetworkUrl( const QString& s )
return s == m_engine.commandName() ;
}

void engines::engine::baseEngine::renameArchiveFolder( const QString& )
void engines::engine::baseEngine::renameArchiveFolder( const QString&,const QString& )
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/engines.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ class engines

virtual bool foundNetworkUrl( const QString& ) ;

virtual void renameArchiveFolder( const QString& ) ;
virtual void renameArchiveFolder( const QString&,const QString& ) ;

QString updateTextOnCompleteDownlod( const QString& uiText,
const QString& downloadingOptions,
Expand Down Expand Up @@ -951,9 +951,9 @@ class engines
{
m_engine->processData( outPut,data,id,readableJson ) ;
}
void renameArchiveFolder( const QString& e ) const
void renameArchiveFolder( const QString& s,const QString& e ) const
{
return m_engine->renameArchiveFolder( e ) ;
return m_engine->renameArchiveFolder( s,e ) ;
}
QString commandString( const engines::engine::exeArgs::cmd& cmd ) const
{
Expand Down
34 changes: 16 additions & 18 deletions src/engines/you-get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,19 @@ QString you_get::updateCmdPath( const QString& e )
return e + "/" + name + "/" + name ;
}

static QString _archiveExtension()
{
return ".tar.gz" ;
}

bool you_get::foundNetworkUrl( const QString& url )
{
return url.startsWith( "you-get" ) && url.endsWith( ".tar.gz" ) ;
if( url.startsWith( "you_get" ) || url.startsWith( "you-get" ) ){

return url.endsWith( _archiveExtension() ) ;
}else{
return false ;
}
}

void you_get::setProxySetting( QStringList& e,const QString& s )
Expand All @@ -47,27 +57,15 @@ void you_get::setProxySetting( QStringList& e,const QString& s )
e.append( s ) ;
}

void you_get::renameArchiveFolder( const QString& e )
void you_get::renameArchiveFolder( const QString& archivePath,const QString& binPath )
{
const auto m = QDir( e ).entryList( QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot ) ;

const auto& name = engines::engine::baseEngine::engine().name() ;
auto m = _archiveExtension() ;

QDir dir ;
auto path = binPath + "/" + QFileInfo( archivePath ).fileName().replace( m,"" ) ;

for( const auto& it : m ){

QFileInfo s( e + "/" + it ) ;

if( s.isDir() && it.startsWith( name ) ){

if( it != name ){
const auto& name = engines::engine::baseEngine::engine().name() ;

dir.rename( e + "/" + it,e + "/" + name ) ;
break ;
}
}
}
QDir().rename( path,binPath + "/" + name ) ;
}

std::vector<engines::engine::baseEngine::mediaInfo> you_get::mediaProperties( Logger& l,const QByteArray& e )
Expand Down
2 changes: 1 addition & 1 deletion src/engines/you-get.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class you_get : public engines::engine::baseEngine

void setProxySetting( QStringList&,const QString& ) override ;

void renameArchiveFolder( const QString& ) override ;
void renameArchiveFolder( const QString&,const QString& ) override ;

std::vector< engines::engine::baseEngine::mediaInfo > mediaProperties( Logger&,const QByteArray& ) override ;

Expand Down
1 change: 1 addition & 0 deletions src/media-downloader.pro
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ TRANSLATIONS = \
../translations/de_DE.ts \
../translations/pt_BR.ts \
../translations/nl_NL.ts \
../translations/ko_KR.ts \
../translations/ar.ts
2 changes: 1 addition & 1 deletion src/networkAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void networkAccess::extractArchiveOuput( networkAccess::Opts opts,

if( engine.archiveContainsFolder() ){

engine.renameArchiveFolder( opts.tempPath ) ;
engine.renameArchiveFolder( opts.filePath,opts.tempPath ) ;

auto exe = engine.updateCmdPath( m_ctx.logger(),opts.tempPath ) ;

Expand Down
2 changes: 2 additions & 0 deletions src/translator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ translator::translator( settings& s,QApplication& app ) : m_qapp( app ),m_settin
this->addString( QObject::tr( "Portuguese (Brazil)" ),"Portuguese (Brazil)","pt_BR" ) ;
this->addString( QObject::tr( "Dutch (Netherlands)" ),"Dutch (Netherlands)","nl_NL" ) ;
this->addString( QObject::tr( "Arabic" ),"Arabic","ar" ) ;
this->addString( QObject::tr( "Korean (Korea)" ),"Korean (Korea)","ko_KR" ) ;

this->setDefaultLanguage() ;
}

Expand Down
4 changes: 4 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,10 @@ Ejemplo 2: ${gateway}:8080</translation>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/fr_FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/it_IT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@ Per maggiori dettagli vedi la GNU General Public License .</translation>
<source>Like Count: %1</source>
<translation>N. mi piace: %1</translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/ja_JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ Exampe 2: ${gateway}:8080</source>
<source>Like Count: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Korean (Korea)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>batchdownloader</name>
Expand Down
Loading

0 comments on commit 269af2e

Please sign in to comment.