Compare commits

...

1 Commits

Author SHA1 Message Date
Brendan
06cd33151c Content download and output working. 2019-09-16 17:16:16 -07:00
3 changed files with 407 additions and 395 deletions

View File

@ -7,8 +7,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>394</width> <width>377</width>
<height>708</height> <height>522</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,297 +19,232 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>394</width> <width>377</width>
<height>0</height> <height>522</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>377</width>
<height>522</height>
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Continuity 0.0.1</string> <string>Continuity 0.0.1</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QTabWidget" name="tabs">
<item> <property name="geometry">
<widget class="QTabWidget" name="tabs"> <rect>
<property name="currentIndex"> <x>10</x>
<number>1</number> <y>10</y>
</property> <width>361</width>
<widget class="QWidget" name="audioTab"> <height>251</height>
<attribute name="title"> </rect>
<string>Audio</string> </property>
</attribute> <property name="currentIndex">
<layout class="QVBoxLayout" name="verticalLayout_2"> <number>1</number>
</property>
<widget class="QWidget" name="audioTab">
<attribute name="title">
<string>Audio</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="audio_url_label">
<property name="text">
<string>URL:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="audio_tab_playlist">
<property name="text">
<string>Playlist</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="audio_url_entry">
<property name="text">
<string>Paste URL here</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="audio_format_label">
<property name="text">
<string>Audio Format:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="audio_format_select">
<item> <item>
<widget class="QLabel" name="url_label"> <property name="text">
<property name="text"> <string>Ogg</string>
<string>URL:</string> </property>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="audio_url_entry"> <property name="text">
<property name="text"> <string>MP3</string>
<string>Paste URL here</string> </property>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="audio_format_select_label"> <property name="text">
<property name="text"> <string>FLAC</string>
<string>Audio Format:</string> </property>
</property> </item>
</widget> </widget>
</item>
<item>
<widget class="QLabel" name="bitrate_select_label">
<property name="text">
<string>Bitrate:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="bitrate_select">
<item>
<property name="text">
<string>128 kb/s</string>
</property>
</item> </item>
<item> <item>
<widget class="QComboBox" name="audio_format_select"> <property name="text">
<item> <string>192 kb/s</string>
<property name="text"> </property>
<string>Ogg</string>
</property>
</item>
<item>
<property name="text">
<string>MP3</string>
</property>
</item>
<item>
<property name="text">
<string>FLAC</string>
</property>
</item>
</widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="bitrate_select_label_a"> <property name="text">
<property name="text"> <string>320 kb/s</string>
<string>Bitrate:</string> </property>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="bitrate_select_a"> <property name="text">
<item> <string>Best</string>
<property name="text"> </property>
<string>128 kb/s</string> </item>
</property> </widget>
</item> </item>
<item> </layout>
<property name="text"> </widget>
<string>192 kb/s</string> <widget class="QWidget" name="videoTab">
</property> <attribute name="title">
</item> <string>Video</string>
<item> </attribute>
<property name="text"> <layout class="QVBoxLayout" name="verticalLayout_4">
<string>320 kb/s</string> <item>
</property> <widget class="QLabel" name="video_url_label">
</item> <property name="text">
</widget> <string>URL:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="video_tab_playlist">
<property name="text">
<string>Playlist</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="video_url_entry">
<property name="text">
<string>Paste URL here</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="video_format_label">
<property name="text">
<string>Video Format:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="video_format_select">
<item>
<property name="text">
<string>MP4</string>
</property>
</item> </item>
<item> <item>
<widget class="QLabel" name="play_finished_label"> <property name="text">
<property name="text"> <string>AVI</string>
<string>Play when finished?:</string> </property>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="play_finished_select"> <property name="text">
<item> <string>WEBM</string>
<property name="text"> </property>
<string>yes</string>
</property>
</item>
<item>
<property name="text">
<string>no</string>
</property>
</item>
</widget>
</item> </item>
</widget>
</item>
<item>
<widget class="QLabel" name="resolution_select_label">
<property name="text">
<string>Resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="resolution_select">
<item> <item>
<widget class="QLabel" name="changelog_box_label_a"> <property name="text">
<property name="text"> <string>Best</string>
<string>Changelog:</string> </property>
</property>
</widget>
</item> </item>
<item> </widget>
<widget class="QTextBrowser" name="changelog_text_box_a"> </item>
<property name="html"> </layout>
<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; </widget>
&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; </widget>
p, li { white-space: pre-wrap; } <widget class="KPushButton" name="download_button">
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; <property name="geometry">
&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;* added more buttons&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <rect>
</property> <x>120</x>
</widget> <y>430</y>
</item> <width>141</width>
<item> <height>34</height>
<widget class="QPushButton" name="ok_button_a"> </rect>
<property name="text"> </property>
<string>OK</string> <property name="text">
</property> <string>Download</string>
</widget> </property>
</item> </widget>
<item> <widget class="QTextBrowser" name="output_window">
<widget class="QPushButton" name="reset_button_a"> <property name="geometry">
<property name="text"> <rect>
<string>Reset</string> <x>10</x>
</property> <y>270</y>
</widget> <width>361</width>
</item> <height>141</height>
</layout> </rect>
</widget> </property>
<widget class="QWidget" name="videoTab"> </widget>
<attribute name="title"> <widget class="QProgressBar" name="progressBar">
<string>Video</string> <property name="geometry">
</attribute> <rect>
<layout class="QVBoxLayout" name="verticalLayout_4"> <x>10</x>
<item> <y>410</y>
<widget class="QLabel" name="video_url_label"> <width>361</width>
<property name="text"> <height>23</height>
<string>URL:</string> </rect>
</property> </property>
</widget> <property name="value">
</item> <number>24</number>
<item> </property>
<widget class="QLineEdit" name="url_entry_box_3"> </widget>
<property name="text">
<string>Paste URL here</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="video_format_select_label">
<property name="text">
<string>Video Format:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="video_format_select">
<item>
<property name="text">
<string>MP4</string>
</property>
</item>
<item>
<property name="text">
<string>AVI</string>
</property>
</item>
<item>
<property name="text">
<string>WEBM</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="bitrate_select_label_v">
<property name="text">
<string>Bitrate:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="bitrate_select_v">
<item>
<property name="text">
<string>128 kb/s</string>
</property>
</item>
<item>
<property name="text">
<string>192 kb/s</string>
</property>
</item>
<item>
<property name="text">
<string>320 kb/s</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="play_finished_label_v">
<property name="text">
<string>Play when finished?:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="play_finished_select_v">
<item>
<property name="text">
<string>yes</string>
</property>
</item>
<item>
<property name="text">
<string>no</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="changelog_box_label_v">
<property name="text">
<string>Changelog:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="changelog_text_box_3">
<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:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&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;* added more buttons&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ok_button_3">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reset_button_3">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QProgressBar" name="main_progress_bar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="status_text_label">
<property name="text">
<string>Status Output</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>394</width> <width>377</width>
<height>29</height> <height>30</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuMandy"> <widget class="QMenu" name="menuMandy">
@ -351,6 +286,13 @@ p, li { white-space: pre-wrap; }
</property> </property>
</action> </action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

330
main.py
View File

@ -7,73 +7,59 @@
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
import sys, os, subprocess, time, psutil
from PyQt5.QtWidgets import QApplication, QPushButton
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.resize(394, 708) MainWindow.resize(377, 522)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy) MainWindow.setSizePolicy(sizePolicy)
MainWindow.setMinimumSize(QtCore.QSize(394, 0)) MainWindow.setMinimumSize(QtCore.QSize(377, 522))
MainWindow.setMaximumSize(QtCore.QSize(377, 522))
self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget") self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.tabs = QtWidgets.QTabWidget(self.centralwidget) self.tabs = QtWidgets.QTabWidget(self.centralwidget)
self.tabs.setGeometry(QtCore.QRect(10, 10, 361, 251))
self.tabs.setObjectName("tabs") self.tabs.setObjectName("tabs")
self.audioTab = QtWidgets.QWidget() self.audioTab = QtWidgets.QWidget()
self.audioTab.setObjectName("audioTab") self.audioTab.setObjectName("audioTab")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.audioTab) self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.audioTab)
self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout_2.setObjectName("verticalLayout_2")
self.url_label = QtWidgets.QLabel(self.audioTab) self.audio_url_label = QtWidgets.QLabel(self.audioTab)
self.url_label.setObjectName("url_label") self.audio_url_label.setObjectName("audio_url_label")
self.verticalLayout_2.addWidget(self.url_label) self.verticalLayout_2.addWidget(self.audio_url_label)
self.audio_tab_playlist = QtWidgets.QCheckBox(self.audioTab)
self.audio_tab_playlist.setObjectName("audio_tab_playlist")
self.verticalLayout_2.addWidget(self.audio_tab_playlist)
self.audio_url_entry = QtWidgets.QLineEdit(self.audioTab) self.audio_url_entry = QtWidgets.QLineEdit(self.audioTab)
self.audio_url_entry.setObjectName("audio_url_entry") self.audio_url_entry.setObjectName("audio_url_entry")
self.verticalLayout_2.addWidget(self.audio_url_entry) self.verticalLayout_2.addWidget(self.audio_url_entry)
self.audio_format_select_label = QtWidgets.QLabel(self.audioTab) self.audio_format_label = QtWidgets.QLabel(self.audioTab)
self.audio_format_select_label.setObjectName("audio_format_select_label") self.audio_format_label.setObjectName("audio_format_label")
self.verticalLayout_2.addWidget(self.audio_format_select_label) self.verticalLayout_2.addWidget(self.audio_format_label)
self.audio_format_select = QtWidgets.QComboBox(self.audioTab) self.audio_format_select = QtWidgets.QComboBox(self.audioTab)
self.audio_format_select.setObjectName("audio_format_select") self.audio_format_select.setObjectName("audio_format_select")
self.audio_format_select.addItem("") self.audio_format_select.addItem("mp3")
self.audio_format_select.addItem("") self.audio_format_select.addItem("ogg")
self.audio_format_select.addItem("") self.audio_format_select.addItem("flac")
self.verticalLayout_2.addWidget(self.audio_format_select) self.verticalLayout_2.addWidget(self.audio_format_select)
self.bitrate_select_label_a = QtWidgets.QLabel(self.audioTab) self.bitrate_select_label = QtWidgets.QLabel(self.audioTab)
self.bitrate_select_label_a.setObjectName("bitrate_select_label_a") self.bitrate_select_label.setObjectName("bitrate_select_label")
self.verticalLayout_2.addWidget(self.bitrate_select_label_a) self.verticalLayout_2.addWidget(self.bitrate_select_label)
self.bitrate_select_a = QtWidgets.QComboBox(self.audioTab) self.bitrate_select = QtWidgets.QComboBox(self.audioTab)
self.bitrate_select_a.setObjectName("bitrate_select_a") self.bitrate_select.setObjectName("bitrate_select")
self.bitrate_select_a.addItem("") self.bitrate_select.addItem("Best")
self.bitrate_select_a.addItem("") #self.bitrate_select.addItem("128K")
self.bitrate_select_a.addItem("") #self.bitrate_select.addItem("256K")
self.verticalLayout_2.addWidget(self.bitrate_select_a) #self.bitrate_select.addItem("320K")
self.play_finished_label = QtWidgets.QLabel(self.audioTab) self.verticalLayout_2.addWidget(self.bitrate_select)
self.play_finished_label.setObjectName("play_finished_label")
self.verticalLayout_2.addWidget(self.play_finished_label)
self.play_finished_select = QtWidgets.QComboBox(self.audioTab)
self.play_finished_select.setObjectName("play_finished_select")
self.play_finished_select.addItem("")
self.play_finished_select.addItem("")
self.verticalLayout_2.addWidget(self.play_finished_select)
self.changelog_box_label_a = QtWidgets.QLabel(self.audioTab)
self.changelog_box_label_a.setObjectName("changelog_box_label_a")
self.verticalLayout_2.addWidget(self.changelog_box_label_a)
self.changelog_text_box_a = QtWidgets.QTextBrowser(self.audioTab)
self.changelog_text_box_a.setObjectName("changelog_text_box_a")
self.verticalLayout_2.addWidget(self.changelog_text_box_a)
self.ok_button_a = QtWidgets.QPushButton(self.audioTab)
self.ok_button_a.setObjectName("ok_button_a")
self.verticalLayout_2.addWidget(self.ok_button_a)
self.reset_button_a = QtWidgets.QPushButton(self.audioTab)
self.reset_button_a.setObjectName("reset_button_a")
self.verticalLayout_2.addWidget(self.reset_button_a)
self.tabs.addTab(self.audioTab, "") self.tabs.addTab(self.audioTab, "")
self.videoTab = QtWidgets.QWidget() self.videoTab = QtWidgets.QWidget()
self.videoTab.setObjectName("videoTab") self.videoTab.setObjectName("videoTab")
@ -82,59 +68,45 @@ class Ui_MainWindow(object):
self.video_url_label = QtWidgets.QLabel(self.videoTab) self.video_url_label = QtWidgets.QLabel(self.videoTab)
self.video_url_label.setObjectName("video_url_label") self.video_url_label.setObjectName("video_url_label")
self.verticalLayout_4.addWidget(self.video_url_label) self.verticalLayout_4.addWidget(self.video_url_label)
self.url_entry_box_3 = QtWidgets.QLineEdit(self.videoTab) self.video_tab_playlist = QtWidgets.QCheckBox(self.videoTab)
self.url_entry_box_3.setObjectName("url_entry_box_3") self.video_tab_playlist.setObjectName("video_tab_playlist")
self.verticalLayout_4.addWidget(self.url_entry_box_3) self.verticalLayout_4.addWidget(self.video_tab_playlist)
self.video_format_select_label = QtWidgets.QLabel(self.videoTab) self.video_url_entry = QtWidgets.QLineEdit(self.videoTab)
self.video_format_select_label.setObjectName("video_format_select_label") self.video_url_entry.setObjectName("video_url_entry")
self.verticalLayout_4.addWidget(self.video_format_select_label) self.verticalLayout_4.addWidget(self.video_url_entry)
self.video_format_label = QtWidgets.QLabel(self.videoTab)
self.video_format_label.setObjectName("video_format_label")
self.verticalLayout_4.addWidget(self.video_format_label)
self.video_format_select = QtWidgets.QComboBox(self.videoTab) self.video_format_select = QtWidgets.QComboBox(self.videoTab)
self.video_format_select.setObjectName("video_format_select") self.video_format_select.setObjectName("video_format_select")
self.video_format_select.addItem("") self.video_format_select.addItem("mp4")
self.video_format_select.addItem("") self.video_format_select.addItem("mkv")
self.video_format_select.addItem("") self.video_format_select.addItem("webm")
self.video_format_select.addItem("flv")
self.verticalLayout_4.addWidget(self.video_format_select) self.verticalLayout_4.addWidget(self.video_format_select)
self.bitrate_select_label_v = QtWidgets.QLabel(self.videoTab) self.resolution_select_label = QtWidgets.QLabel(self.videoTab)
self.bitrate_select_label_v.setObjectName("bitrate_select_label_v") self.resolution_select_label.setObjectName("resolution_select_label")
self.verticalLayout_4.addWidget(self.bitrate_select_label_v) self.verticalLayout_4.addWidget(self.resolution_select_label)
self.bitrate_select_v = QtWidgets.QComboBox(self.videoTab) self.resolution_select = QtWidgets.QComboBox(self.videoTab)
self.bitrate_select_v.setObjectName("bitrate_select_v") self.resolution_select.setObjectName("resolution_select")
self.bitrate_select_v.addItem("") self.resolution_select.addItem("480")
self.bitrate_select_v.addItem("") self.resolution_select.addItem("720")
self.bitrate_select_v.addItem("") self.resolution_select.addItem("1080")
self.verticalLayout_4.addWidget(self.bitrate_select_v) self.verticalLayout_4.addWidget(self.resolution_select)
self.play_finished_label_v = QtWidgets.QLabel(self.videoTab)
self.play_finished_label_v.setObjectName("play_finished_label_v")
self.verticalLayout_4.addWidget(self.play_finished_label_v)
self.play_finished_select_v = QtWidgets.QComboBox(self.videoTab)
self.play_finished_select_v.setObjectName("play_finished_select_v")
self.play_finished_select_v.addItem("")
self.play_finished_select_v.addItem("")
self.verticalLayout_4.addWidget(self.play_finished_select_v)
self.changelog_box_label_v = QtWidgets.QLabel(self.videoTab)
self.changelog_box_label_v.setObjectName("changelog_box_label_v")
self.verticalLayout_4.addWidget(self.changelog_box_label_v)
self.changelog_text_box_3 = QtWidgets.QTextBrowser(self.videoTab)
self.changelog_text_box_3.setObjectName("changelog_text_box_3")
self.verticalLayout_4.addWidget(self.changelog_text_box_3)
self.ok_button_3 = QtWidgets.QPushButton(self.videoTab)
self.ok_button_3.setObjectName("ok_button_3")
self.verticalLayout_4.addWidget(self.ok_button_3)
self.reset_button_3 = QtWidgets.QPushButton(self.videoTab)
self.reset_button_3.setObjectName("reset_button_3")
self.verticalLayout_4.addWidget(self.reset_button_3)
self.tabs.addTab(self.videoTab, "") self.tabs.addTab(self.videoTab, "")
self.verticalLayout.addWidget(self.tabs) self.download_button = QPushButton(self.centralwidget)
self.main_progress_bar = QtWidgets.QProgressBar(self.centralwidget) self.download_button.setGeometry(QtCore.QRect(120, 430, 141, 34))
self.main_progress_bar.setProperty("value", 24) self.download_button.setObjectName("download_button")
self.main_progress_bar.setObjectName("main_progress_bar") self.output_window = QtWidgets.QTextBrowser(self.centralwidget)
self.verticalLayout.addWidget(self.main_progress_bar) self.output_window.setGeometry(QtCore.QRect(10, 270, 361, 141))
self.status_text_label = QtWidgets.QLabel(self.centralwidget) self.output_window.setObjectName("output_window")
self.status_text_label.setObjectName("status_text_label") self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
self.verticalLayout.addWidget(self.status_text_label) self.progressBar.setGeometry(QtCore.QRect(10, 410, 361, 23))
self.progressBar.setProperty("value", 0)
self.progressBar.setObjectName("progressBar")
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 394, 29)) self.menubar.setGeometry(QtCore.QRect(0, 0, 377, 30))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
self.menuMandy = QtWidgets.QMenu(self.menubar) self.menuMandy = QtWidgets.QMenu(self.menubar)
self.menuMandy.setObjectName("menuMandy") self.menuMandy.setObjectName("menuMandy")
@ -160,69 +132,163 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuAbout.menuAction()) self.menubar.addAction(self.menuAbout.menuAction())
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
self.tabs.setCurrentIndex(1) self.tabs.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def dl_content(self):
index = self.tabs.currentIndex()
if index == 0:
url = self.audio_url_entry.text()
if "https://" not in url[:8]:
if "http://" not in url[:7]:
self.output_window.append("That is not a valid url.")
return
self.output_window.append("Downloading " + url + "...")
self.output_window.repaint()
playlist = self.audio_tab_playlist.isChecked()
audio_format = self.audio_format_select.currentText()
#command = "youtube-dl "
#if playlist == 1:
# command = command + "--yes-playlist "
#command = command + "--extract-audio "
#command = command + "--audio-format "
#command = command + audio_format
#command = command + " -o '%(title)s.%(ext)s' "
#command = command + url
if playlist == 0:
subprocess.Popen(["youtube-dl", "--extract-audio", "--audio-format", audio_format, "-o '%(title)s.%(ext)s'", url], stdout=open('status.txt', 'w'), encoding='utf-8')
timeout = 0
for p in psutil.process_iter(attrs=['name']):
while p.info['name'] == "youtube-dl":
b = open('status.txt', 'r', encoding='utf-8')
self.output_window.clear()
self.output_window.append(b.read())
self.output_window.repaint()
time.sleep(2)
if p.info['name'] == "youtube-dl":
size = os.path.getsize("status.txt")
if size == os.path.getsize("status.txt"):
timeout = timeout + 1
if timeout == 30:
break
#b.close()
if playlist == 1:
subprocess.run(["youtube-dl", "--yes-playlist", "--extract-audio", "--audio-format", audio_format, "-o '%(title)s.%(ext)s'", url], stdout=open('status.txt', 'w'), encoding='utf-8')
timeout = 0
for p in psutil.process_iter(attrs=['name']):
while p.info['name'] == "youtube-dl":
b = open('status.txt', 'r', encoding='utf-8')
self.output_window.clear()
self.output_window.append(b.read())
self.output_window.repaint()
time.sleep(2)
if p.info['name'] == "youtube-dl":
size = os.path.getsize("status.txt")
if size == os.path.getsize("status.txt"):
timeout = timeout + 1
if timeout == 30:
break
if index == 1:
url = self.video_url_entry.text()
if "https://" not in url[:8]:
if "http://" not in url[:7]:
self.output_window.append("That is not a valid url.")
return
self.output_window.append("Downloading " + url + "...")
self.output_window.repaint()
playlist = self.video_tab_playlist.isChecked()
video_format = self.video_format_select.currentText()
resolution = self.resolution_select.currentText()
command = "(" + video_format + ")[height<=" + resolution + "]'"
if playlist == 0:
print("video playlist 0")
subprocess.Popen(["youtube-dl", "-f", command, "-o '%(title)s.%(ext)s'", url], stdout=open('status.txt', 'w'), encoding='utf-8')
timeout = 0
for p in psutil.process_iter(attrs=['name']):
print("process for")
while p.info['name'] == "youtube-dl":
print("file open")
b = open('status.txt', 'r', encoding='utf-8')
self.output_window.clear()
self.output_window.append(b.read())
self.output_window.repaint()
time.sleep(2)
if p.info['name'] == "youtube-dl":
print("size check")
size = os.path.getsize("status.txt")
if size == os.path.getsize("status.txt"):
timeout = timeout + 1
if timeout == 30:
break
if playlist == 1:
subprocess.Popen(["youtube-dl", "--yes-playlist", "-f", command, "-o '%(title)s.%(ext)s'", url], stdout=open('status.txt', 'w'), encoding='utf-8')
timeout = 0
for p in psutil.process_iter(attrs=['name']):
while p.info['name'] == "youtube-dl":
b = open('status.txt', 'r', encoding='utf-8')
self.output_window.clear()
self.output_window.append(b.read())
self.output_window.repaint()
time.sleep(2)
if p.info['name'] == "youtube-dl":
size = os.path.getsize("status.txt")
if size == os.path.getsize("status.txt"):
timeout = timeout + 1
if timeout == 30:
break
self.output_window.append("File Download Complete!")
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Continuity 0.0.1")) MainWindow.setWindowTitle(_translate("MainWindow", "Continuity 0.0.1"))
self.url_label.setText(_translate("MainWindow", "URL:")) self.audio_url_label.setText(_translate("MainWindow", "URL:"))
self.audio_tab_playlist.setText(_translate("MainWindow", "Playlist"))
self.audio_url_entry.setText(_translate("MainWindow", "Paste URL here")) self.audio_url_entry.setText(_translate("MainWindow", "Paste URL here"))
self.audio_format_select_label.setText(_translate("MainWindow", "Audio Format:")) self.audio_format_label.setText(_translate("MainWindow", "Audio Format:"))
self.audio_format_select.setItemText(0, _translate("MainWindow", "Ogg")) #self.audio_format_select.setItemText(0, _translate("MainWindow", "Ogg"))
self.audio_format_select.setItemText(1, _translate("MainWindow", "MP3")) #self.audio_format_select.setItemText(1, _translate("MainWindow", "MP3"))
self.audio_format_select.setItemText(2, _translate("MainWindow", "FLAC")) #self.audio_format_select.setItemText(2, _translate("MainWindow", "FLAC"))
self.bitrate_select_label_a.setText(_translate("MainWindow", "Bitrate:")) self.bitrate_select_label.setText(_translate("MainWindow", "Bitrate:"))
self.bitrate_select_a.setItemText(0, _translate("MainWindow", "128 kb/s")) #self.bitrate_select.setItemText(0, _translate("MainWindow", "128 kb/s"))
self.bitrate_select_a.setItemText(1, _translate("MainWindow", "192 kb/s")) #self.bitrate_select.setItemText(1, _translate("MainWindow", "192 kb/s"))
self.bitrate_select_a.setItemText(2, _translate("MainWindow", "320 kb/s")) #self.bitrate_select.setItemText(2, _translate("MainWindow", "320 kb/s"))
self.play_finished_label.setText(_translate("MainWindow", "Play when finished?:")) #self.bitrate_select.setItemText(3, _translate("MainWindow", "Best"))
self.play_finished_select.setItemText(0, _translate("MainWindow", "yes"))
self.play_finished_select.setItemText(1, _translate("MainWindow", "no"))
self.changelog_box_label_a.setText(_translate("MainWindow", "Changelog:"))
self.changelog_text_box_a.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">* added more buttons</p></body></html>"))
self.ok_button_a.setText(_translate("MainWindow", "OK"))
self.reset_button_a.setText(_translate("MainWindow", "Reset"))
self.tabs.setTabText(self.tabs.indexOf(self.audioTab), _translate("MainWindow", "Audio")) self.tabs.setTabText(self.tabs.indexOf(self.audioTab), _translate("MainWindow", "Audio"))
self.video_url_label.setText(_translate("MainWindow", "URL:")) self.video_url_label.setText(_translate("MainWindow", "URL:"))
self.url_entry_box_3.setText(_translate("MainWindow", "Paste URL here")) self.video_tab_playlist.setText(_translate("MainWindow", "Playlist"))
self.video_format_select_label.setText(_translate("MainWindow", "Video Format:")) self.video_url_entry.setText(_translate("MainWindow", "Paste URL here"))
self.video_format_select.setItemText(0, _translate("MainWindow", "MP4")) self.video_format_label.setText(_translate("MainWindow", "Video Format:"))
self.video_format_select.setItemText(1, _translate("MainWindow", "AVI")) #self.video_format_select.setItemText(0, _translate("MainWindow", "MP4"))
self.video_format_select.setItemText(2, _translate("MainWindow", "WEBM")) #self.video_format_select.setItemText(1, _translate("MainWindow", "AVI"))
self.bitrate_select_label_v.setText(_translate("MainWindow", "Bitrate:")) #self.video_format_select.setItemText(2, _translate("MainWindow", "WEBM"))
self.bitrate_select_v.setItemText(0, _translate("MainWindow", "128 kb/s")) self.resolution_select_label.setText(_translate("MainWindow", "Resolution:"))
self.bitrate_select_v.setItemText(1, _translate("MainWindow", "192 kb/s")) #self.resolution_select.setItemText(0, _translate("MainWindow", "Best"))
self.bitrate_select_v.setItemText(2, _translate("MainWindow", "320 kb/s"))
self.play_finished_label_v.setText(_translate("MainWindow", "Play when finished?:"))
self.play_finished_select_v.setItemText(0, _translate("MainWindow", "yes"))
self.play_finished_select_v.setItemText(1, _translate("MainWindow", "no"))
self.changelog_box_label_v.setText(_translate("MainWindow", "Changelog:"))
self.changelog_text_box_3.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">* added more buttons</p></body></html>"))
self.ok_button_3.setText(_translate("MainWindow", "OK"))
self.reset_button_3.setText(_translate("MainWindow", "Reset"))
self.tabs.setTabText(self.tabs.indexOf(self.videoTab), _translate("MainWindow", "Video")) self.tabs.setTabText(self.tabs.indexOf(self.videoTab), _translate("MainWindow", "Video"))
self.status_text_label.setText(_translate("MainWindow", "Status Output")) self.download_button.setText(_translate("MainWindow", "Download"))
#self.download_button.clicked.connect(dl_file())
self.menuMandy.setTitle(_translate("MainWindow", "File")) self.menuMandy.setTitle(_translate("MainWindow", "File"))
self.menuEdit.setTitle(_translate("MainWindow", "Edit")) self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
self.menuAbout.setTitle(_translate("MainWindow", "About")) self.menuAbout.setTitle(_translate("MainWindow", "About"))
self.actionSettings.setText(_translate("MainWindow", "Settings")) self.actionSettings.setText(_translate("MainWindow", "Settings"))
self.actionQuit_Ctrl_q.setText(_translate("MainWindow", "Quit (Ctrl + q)")) self.actionQuit_Ctrl_q.setText(_translate("MainWindow", "Quit (Ctrl + q)"))
self.actionSettings_2.setText(_translate("MainWindow", "Settings")) self.actionSettings_2.setText(_translate("MainWindow", "Settings"))
self.download_button.clicked.connect(self.dl_content)
#from KPushButton import KPushButton
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys, os , subprocess
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow() MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow() ui = Ui_MainWindow()

4
status.txt Normal file
View File

@ -0,0 +1,4 @@
[youtube] wqipMcwJeQI: Downloading webpage
[youtube] wqipMcwJeQI: Downloading video info webpage
[download] 'Beastie boys - Paul Revere.mp4' has already been downloaded
[download] 100% of 5.21MiB