Skip to content

Commit

Permalink
1st commit
Browse files Browse the repository at this point in the history
  • Loading branch information
samadritakarmakar committed Dec 4, 2016
0 parents commit cb4157d
Show file tree
Hide file tree
Showing 8 changed files with 917 additions and 0 deletions.
189 changes: 189 additions & 0 deletions License

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions Qutube-dl.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-12-02T21:24:20
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Qutube-dl
TEMPLATE = app


SOURCES += main.cpp\
qutubedl.cpp

HEADERS += qutubedl.h

FORMS += qutubedl.ui
358 changes: 358 additions & 0 deletions Qutube-dl.pro.user

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
This is a free youtube video downloader. It is a Qt based GUI frontend for youtube-dl. (See https://github.com/rg3/youtube-dl)

HOW TO COMPILE.

unpack the file in your preferred location

type the following:

cd Qutube-dl
qmake Qutube-dl.pro
make

you may also use QtCreator to compile.

SETUP

Create a folder 'Qutube-dl'
Move the executable (.exe for windows users) file just compiled into the folder.

Windows users add the bin directory of your Qt installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:

windeployqt <path to Qutube-dl executable>

Create a new folder 'youtube-dl' within 'Qutube-dl' folder
download the latest version of youtube-dl from https://rg3.github.io/youtube-dl/ and place within 'youtube-dl' folder.

Windows users must download the 'Windows executable that includes Python.'
Linux users must download python version by typing

wget https://yt-dl.org/downloads/latest/youtube-dl

HOW TO USE

copy and paste the video url in the box labelled 'Url'

You may directly press button 'Go!' to download the video to your desired location.
You may check the available versions by clicking 'Available Versions?' button.
Look for numbers under 'format code' in the output if you click the 'Available Versions?' button. Enter the desired format code in 'Format code' box and press 'Go!'

Thanks for using Qutube-dl!

11 changes: 11 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "qutubedl.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Qutubedl w;
w.show();

return a.exec();
}
138 changes: 138 additions & 0 deletions qutubedl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#include "qutubedl.h"
#include "ui_qutubedl.h"
#include <QString>
#include <QDebug>
#include <QProcess>
#include <QDir>
#include <QFileDialog>
Qutubedl::Qutubedl(QWidget *parent) :
QWidget(parent),
ui(new Ui::Qutubedl)
{
ui->setupUi(this);
}

Qutubedl::~Qutubedl()
{
delete ui;
delete youtube;
}


void Qutubedl::on_Go_pb_clicked()
{
get_texts();
QStringList argument;

if (proxy!="")
argument<<"--proxy"<<proxy;
if (fmt!="")
argument<<"-tf"<<fmt;
argument<<Url;
qDebug()<<argument;

button_handle();

QDir open;
youtube_d_handle();

QFileDialog *d_path = new QFileDialog;
QString d_path_string=d_path->getExistingDirectory(this,"Save Directory", QDir::homePath());
qDebug()<<d_path_string;
open.setCurrent(d_path_string);
qDebug()<<argument;
if(d_path_string !="")
click_handle(argument);
}

//Fetches Available formats
void Qutubedl::on_get_fmt_pb_clicked()
{
f_cb.clear();
get_texts();
youtube_d_handle();
button_handle();
QStringList argument;
argument<<"-F"<<Url;
click_handle(argument);
}

//update youtube-dl
void Qutubedl::on_updt_bcknd_pb_clicked()
{
youtube_d_handle();
button_handle();
QStringList argument;
argument<<"-U";
click_handle(argument);
}

//fetches texts entered
void Qutubedl::get_texts()
{
Url=ui->url->text();
proxy=ui->prxy->text();
fmt=ui->frmt->text();
}

//calls youtube-dl with given arguments
void Qutubedl::click_handle(QStringList argument)
{
#ifdef Q_OS_LINUX
youtube->start(youtube_path+"./youtube-dl", argument);
#else
youtube->start(youtube_path+"youtube-dl.exe", argument);
#endif

}

//Sets youtube-dl directory path in variable youtube_path
void Qutubedl::youtube_d_handle()
{
QDir open;
if(!open.cd("youtube-dl"))
qWarning("Cannot Find Directory \"youtube-dl\"");
if(i==0)
{
youtube_path=open.currentPath()+open.fromNativeSeparators("//youtube-dl")+open.fromNativeSeparators("/");
i++;
}
qDebug()<<youtube_path+"./youtube-dl";
}

//connections to QProcess instance youtube
void Qutubedl::button_handle()
{
connect(youtube,SIGNAL(started()),this, SLOT(disable_go()));
connect(youtube,SIGNAL(finished(int)),this, SLOT(enable_go()));
connect(youtube,SIGNAL(readyReadStandardOutput()),this, SLOT(readoutput()));
connect(youtube,SIGNAL(readyReadStandardError()),this, SLOT(readoutput()));
}

//Disables Go Pushbutton
void Qutubedl::disable_go()
{
ui->Go_pb->setEnabled(false);
}

//Enables Go Pushbutton
void Qutubedl::enable_go()
{
ui->Go_pb->setEnabled(true);
f_output.clear();
}

//Output of youtube-dl is printed in QTextBrowser output_tb
void Qutubedl::readoutput()
{
QByteArray output=youtube->readAllStandardOutput();
QByteArray output2=youtube->readAllStandardError();
if (QString(output).contains("[download]", Qt::CaseSensitive))
f_output=QString(output);
else
f_output=f_output+QString(output);
f_output=f_output+QString(output2);
qDebug()<<f_output;
ui->output_tb->setText(f_output);
}

47 changes: 47 additions & 0 deletions qutubedl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef QUTUBEDL_H
#define QUTUBEDL_H

#include <QWidget>
#include <QProcess>
#include <QString>

namespace Ui {
class Qutubedl;
}

class Qutubedl : public QWidget
{
Q_OBJECT

public:
explicit Qutubedl(QWidget *parent = 0);
~Qutubedl();

private slots:
void on_Go_pb_clicked();
void disable_go();
void enable_go();
void readoutput();

void on_get_fmt_pb_clicked();

void on_updt_bcknd_pb_clicked();

private:
Ui::Qutubedl *ui;
QProcess *youtube=new QProcess;
QString f_output;
QString f_cb;
int i=0,z=0;
QString youtube_path;
QString Url;
QString proxy;
QString fmt;

void get_texts();
void click_handle(QStringList argument);
void button_handle();
void youtube_d_handle();
};

#endif // QUTUBEDL_H
113 changes: 113 additions & 0 deletions qutubedl.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qutubedl</class>
<widget class="QWidget" name="Qutubedl">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>699</width>
<height>345</height>
</rect>
</property>
<property name="windowTitle">
<string>Qutubedl</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0" colspan="2">
<widget class="QTextBrowser" name="output_tb">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;This program is a Qt based GUI frontend for youtube-dl program.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;Copyright (C) 2016 Samadrita Karmakar (samadritakarmakar@gmail.com)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Hack';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;This program is free software: you can redistribute it and/or modify&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;it under the terms of the GNU General Public License as published by&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;the Free Software Foundation, either version 3 of the License, or&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;(at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Hack';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;This program is distributed in the hope that it will be useful,&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;GNU General Public License for more details.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Hack';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;You should have received a copy of the GNU General Public License&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Hack';&quot;&gt;along with this program. If not, see &amp;lt;http://www.gnu.org/licenses/&amp;gt;.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Url:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Format Code:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Proxy:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="frmt">
<property name="text">
<string>18</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="url">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="prxy"/>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="Go_pb">
<property name="text">
<string>Go!</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="get_fmt_pb">
<property name="text">
<string>Available Format?</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="updt_bcknd_pb">
<property name="text">
<string>Update Backend</string>
</property>
</widget>
</item>
<item row="4" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_4">
<property name="text">
<string>eg: socks://127.0.0.1:9050/</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

0 comments on commit cb4157d

Please sign in to comment.