1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
Description: Use system-wide install of youtube-dl instead of local one
Author: Nick Andrik <nick.andrik@gmail.com>
Forwarded: not-needed
Last-Update: 2024-09-20
Index: b/acetoneiso/sources/acetoneiso.h
===================================================================
--- a/acetoneiso/sources/acetoneiso.h
+++ b/acetoneiso/sources/acetoneiso.h
@@ -224,7 +224,7 @@ private slots:
void quitto();
void mountdisplayClicked();
void burniso2_cd();
- int utubedownload();
+ bool has_youtube_dl();
void removeHistory();
//torrent
Index: b/acetoneiso/sources/utube.h
===================================================================
--- a/acetoneiso/sources/utube.h
+++ b/acetoneiso/sources/utube.h
@@ -13,35 +13,20 @@
// You should have received a copy of the GNU General Public License
// along with AcetoneISO. If not, see <http://www.gnu.org/licenses/>.
-int acetoneiso::utubedownload() {
- QDir Homeutube = QDir::home();
-QFile yutubbodl(Homeutube.path() + "/.acetoneiso/youtube-dl");
-yutubbodl.remove();
-//system ("rm $HOME/.acetoneiso/youtube-dl > /dev/null 2>&1");
-if (system ("cd $HOME/.acetoneiso/;wget http://digilander.libero.it/bulletxt/youtube-dl > /dev/null 2>&1" ) ) {
-
-}
-//system ("chmod 755 $HOME/.acetoneiso/youtube-dl > /dev/null 2>&1");
-
-yutubbodl.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ExeGroup | QFile::ReadGroup | QFile::ReadOther | QFile::ExeOther);
-if (yutubbodl.exists()) {
- return 0;
-}
-else {
-return 1;
-}
-
+bool acetoneiso::has_youtube_dl() {
+ QFileInfo info("/usr/bin/yt-dlp");
+ if (! info.exists() ) {
+ QMessageBox::critical(this, "AcetoneISO",tr("Unable to find") + " yt-dlp " + tr("in /usr/bin.\nPlease install it and be sure it's linked to /usr/bin folder.") );
+ return false;
+ }
+ return true;
}
void acetoneiso::utube()
{
-utubedownload();
-
-if (utubedownload() == 1) {
- QMessageBox::warning(this, "AcetoneISO",tr("Unable to download youtube-dl.\nPlease try again and be sure your internet connection is alive.\nIf the problem persists please contact us at acetoneiso@gmail.com ."));
- return;
-}
+if (!has_youtube_dl())
+ return;
QDir Homeutube = QDir::home();
@@ -84,10 +69,8 @@ return;
void acetoneiso::utubeuser()
{
-utubedownload();
-if (utubedownload() == 1) {
- QMessageBox::warning(this, "AcetoneISO",tr("Unable to download youtube-dl.\nPlease try again and be sure your internet connection is alive.\nIf the problem persists please contact us at acetoneiso@gmail.com ."));
- return;
+if (!has_youtube_dl()) {
+ return;
}
QDir Homeutube = QDir::home();
|