Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
setvisible committed Nov 14, 2021
2 parents be6fa09 + 0045db1 commit c372d03
Show file tree
Hide file tree
Showing 28 changed files with 742 additions and 728 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ deploy:
# mandatory description (use '' if any) otherwise GitHub "422: Unprocessable entity" error
description: 'Draft release of DownZemAll version %AppVersion% (build $(appveyor_build_version))'
auth_token:
secure: 8tIRAglcbx9Yw8zLDDQnrdk/Fk/az61lSIykfvzqPApy6LFxjTHoUJW8gYDGKgsq
secure: J6XN9EP9btStQKZRRhB69DkQQHQ32ioCje4YV9jfK1Xvm/1w2r6lppsT2hBHvowk
artifact: myartifacts
draft: true
prerelease: false
Expand Down
18 changes: 10 additions & 8 deletions src/about.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,36 @@

#include "globals.h"
#include "version.h"
#include <QtCore/QCoreApplication>

#include <QtCore/QObject>
#include <QtCore/QString>


static QString buildAbout(const QString &paragraphDelimiter)
{
return QString(QCoreApplication::tr(
return QString(QObject::tr(
"%0 - %1 - version %2 - build %3"
).arg(STR_APPLICATION_NAME, STR_COMPILER_WORDSIZE, STR_APPLICATION_VERSION, STR_APPLICATION_BUILD) +
paragraphDelimiter +
QCoreApplication::tr(
QObject::tr(
"Copyright (C) %0 %1. All rights reserved."
).arg(STR_APPLICATION_DATE, STR_APPLICATION_AUTHOR) +
paragraphDelimiter +
QCoreApplication::tr("GNU LGPL License") +
QObject::tr("GNU LGPL License") +
paragraphDelimiter +
QCoreApplication::tr(
QObject::tr(
"Permission is hereby granted, free of charge, to any person obtaining a copy "
"of this software and associated documentation files (the \"Software\"), to deal "
"in the Software without restriction, including without limitation the rights "
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell "
"copies of the Software, and to permit persons to whom the Software is "
"furnished to do so, subject to the following conditions: ") +
paragraphDelimiter +
QCoreApplication::tr(
QObject::tr(
"The above copyright notice and this permission notice shall be included in all "
"copies or substantial portions of the Software. ") +
paragraphDelimiter +
QCoreApplication::tr(
QObject::tr(
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR "
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, "
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
Expand All @@ -71,7 +73,7 @@ inline QString about()

inline QString aboutHtml()
{
return QString("<h3>" + QCoreApplication::tr("About %0").arg(STR_APPLICATION_NAME) + "</h3>" +
return QString("<h3>" + QObject::tr("About %0").arg(STR_APPLICATION_NAME) + "</h3>" +
"<p><img src=\"://resources/logo/icon128.png\" /></p>" +
"<p></p>" +
"<p>" + buildAbout("</p><p>") + "</p>");
Expand Down
30 changes: 30 additions & 0 deletions src/core/fileutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ static const int s_forbidden_sub_strings_count = sizeof(s_forbidden_sub_strings)
static const QString s_substitute_char('_');
static const QString s_substitute_file_name("file");

/*
* This list of legal characters for filenames is limited to avoid injections
* of special or invisible characters that could be not supported by the OS.
*/
static const QString C_LEGAL_CHARS = QLatin1String("-+' @()[]{}°#,.&");


/******************************************************************************
******************************************************************************/
Expand Down Expand Up @@ -132,3 +138,27 @@ QString FileUtils::validateFileName(const QString &name, bool allowSubDir)

return fixedName;
}

/******************************************************************************
******************************************************************************/
QString FileUtils::cleanFileName(const QString &fileName)
{
QString ret = fileName.simplified();
ret = ret.remove(QRegularExpression("\\(official video\\)", QRegularExpression::CaseInsensitiveOption));
ret = ret.simplified();

QString::iterator it;
for (it = ret.begin(); it != ret.end(); ++it){
const QChar c = (*it).unicode();
if (c.isLetterOrNumber() || C_LEGAL_CHARS.contains(c)) {
continue;
}
if (c == QChar('"')) {
*it = QChar('\'');
} else {
*it = QChar('-');
}
}
ret = ret.replace(QRegularExpression("-+"), QLatin1String("-"));
return ret.simplified();
}
1 change: 1 addition & 0 deletions src/core/fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class FileUtils
{
public:
static QString cleanFileName(const QString &fileName);
static QString validateFileName(const QString &input, bool allowSubDir);
};

Expand Down
29 changes: 2 additions & 27 deletions src/core/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "stream.h"

#include <Core/FileUtils>
#include <Core/Format>

#include <QtCore/QCoreApplication>
Expand Down Expand Up @@ -45,12 +46,6 @@ static const QString C_PROGRAM_NAME = QLatin1String("yt-dlp");
static const QString C_WEBSITE_URL = QLatin1String("https://github.com/yt-dlp/yt-dlp");
static const int C_EXIT_SUCCESS = 0;

/*
* This list of legal characters for filenames is limited to avoid injections
* of special or invisible characters that could be not supported by the OS.
*/
static const QString C_LEGAL_CHARS = QLatin1String("-+' @()[]{}°#,.&");

static const QString C_NONE = QLatin1String("none");

static const QString C_WARNING_msg_header_01 = QLatin1String("WARNING:");
Expand Down Expand Up @@ -1521,26 +1516,6 @@ void StreamObject::setTitle(const QString &title)
m_userTitle = (title == m_data.defaultTitle) ? QString() : title;
}

static QString cleanFileName(const QString &fileName)
{
QString ret = fileName.simplified();
QString::iterator it;
for (it = ret.begin(); it != ret.end(); ++it){
const QChar c = (*it).unicode();
if (c.isLetterOrNumber() || C_LEGAL_CHARS.contains(c)) {
continue;
}
if (c == QChar('"')) {
*it = QChar('\'');
} else {
*it = QChar('_');
}
}
ret = ret.replace(QRegularExpression("_+"), QLatin1String("_"));
return ret.simplified();
}


QString StreamObject::fullFileName() const
{
return suffix().isEmpty()
Expand All @@ -1550,7 +1525,7 @@ QString StreamObject::fullFileName() const

QString StreamObject::fileBaseName() const
{
return cleanFileName(title());
return FileUtils::cleanFileName(title());
}

QString StreamObject::suffix() const
Expand Down
97 changes: 47 additions & 50 deletions src/locale/dza_ar_EG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2733,44 +2733,6 @@ Some examples are given below. Click to paste the example.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QCoreApplication</name>
<message>
<location filename="../about.h" line="27"/>
<source>%0 - %1 - version %2 - build %3</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="31"/>
<source>Copyright (C) %0 %1. All rights reserved.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="35"/>
<source>GNU LGPL License</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="37"/>
<source>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="45"/>
<source>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="49"/>
<source>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="74"/>
<source>About %0</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QObject</name>
<message>
Expand All @@ -2784,17 +2746,17 @@ Some examples are given below. Click to paste the example.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="1364"/>
<location filename="../core/stream.cpp" line="1482"/>
<source>Video %0 x %1%2%3</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="1371"/>
<location filename="../core/stream.cpp" line="1489"/>
<source>[%0] %1 x %2 (%3 fps) @ %4 KBit/s, codec: %5</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="1380"/>
<location filename="../core/stream.cpp" line="1498"/>
<source>[%0] %1 Hz @ %2 KBit/s, codec: %3</source>
<translation type="unfinished"/>
</message>
Expand Down Expand Up @@ -2918,6 +2880,41 @@ Some examples are given below. Click to paste the example.</source>
<source>Dark</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="29"/>
<source>%0 - %1 - version %2 - build %3</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="33"/>
<source>Copyright (C) %0 %1. All rights reserved.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="37"/>
<source>GNU LGPL License</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="39"/>
<source>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="47"/>
<source>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="51"/>
<source>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../about.h" line="76"/>
<source>About %0</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QueueItem</name>
Expand Down Expand Up @@ -3006,36 +3003,36 @@ Some examples are given below. Click to paste the example.</source>
<context>
<name>Stream</name>
<message>
<location filename="../core/stream.cpp" line="496"/>
<location filename="../core/stream.cpp" line="492"/>
<source>The process crashed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>StreamAssetDownloader</name>
<message>
<location filename="../core/stream.cpp" line="832"/>
<location filename="../core/stream.cpp" line="828"/>
<source>Couldn&apos;t parse JSON file.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="835"/>
<location filename="../core/stream.cpp" line="858"/>
<location filename="../core/stream.cpp" line="831"/>
<location filename="../core/stream.cpp" line="854"/>
<source>The process crashed.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="852"/>
<location filename="../core/stream.cpp" line="848"/>
<source>Couldn&apos;t parse playlist (no data received).</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="855"/>
<location filename="../core/stream.cpp" line="851"/>
<source>Couldn&apos;t parse playlist (ill-formed JSON file).</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../core/stream.cpp" line="1058"/>
<location filename="../core/stream.cpp" line="1176"/>
<source>Cancelled.</source>
<translation type="unfinished"/>
</message>
Expand Down Expand Up @@ -3091,8 +3088,8 @@ Some examples are given below. Click to paste the example.</source>
<context>
<name>StreamExtractorListCollector</name>
<message>
<location filename="../core/stream.cpp" line="1233"/>
<location filename="../core/stream.cpp" line="1252"/>
<location filename="../core/stream.cpp" line="1351"/>
<location filename="../core/stream.cpp" line="1370"/>
<source>The process crashed.</source>
<translation type="unfinished"/>
</message>
Expand Down
Binary file modified src/locale/dza_de_DE.qm
Binary file not shown.
Loading

0 comments on commit c372d03

Please sign in to comment.