Skip to content

Commit

Permalink
Merge pull request #5 from PyFlat/v1.3.1
Browse files Browse the repository at this point in the history
V1.3.1
  • Loading branch information
PyFlat-JR authored Mar 8, 2024
2 parents aa40f77 + 41624a3 commit 5d68842
Show file tree
Hide file tree
Showing 15 changed files with 287 additions and 40 deletions.
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/main.py",
"console": "integratedTerminal"
}
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ All images were created with the _Show-Thumbnails_ setting: **Off**

[![](showcase/Select_Playlist_Range.png)](#playlist)

## Precise-Selection-Dialog for playlists

[![](showcase/Select_Playlist_Precise.png)](#playlist)

## Download-Page for playlists

[![](showcase/Download_Playlist.png)](#playlist)
Expand Down
14 changes: 3 additions & 11 deletions appdata/changelog.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<strong>New Features:</strong>

<ul>
<li style="text-align: left;">The old settings page has been replaced by a menubar.</li>
<li style="text-align: left;">You can now set the default resolution.</li>
<li style="text-align: left;">There is now logging to make it easier to find errors.</li>
<li style="text-align: left;">The video search no longer takes place automatically instead you have to click on the button to start the search.</li>
<li style="text-align: left;">You can now select even more precisely which videos you would like to download from a playlist.</li>
</ul>
<br>
<strong>Bug Fixes:</strong>
<ul>
<li style="text-align: left;">
Fix for issues
<a href="https://github.com/PyFlat/YT-Downloader/issues/2" style="color: white; text-decoration: underline; font-weight: bold;">#2</a> and
<a href="https://github.com/PyFlat/YT-Downloader/issues/3" style="color: white; text-decoration: underline; font-weight: bold;">#3</a>
</li>
<li style="text-align: left;">Fixed a bug where the program crashed when a video was opened in the download overview.</li>
<li style="text-align: left;">Other small bug fixes.</li>
<li style="text-align: left;">Fixed a bug where the program got an error when searching for a video</li>
<li style="text-align: left;">Fixed a bug where the button to go to the previous page for playlists disappeared</li>
</ul>
7 changes: 6 additions & 1 deletion appdata/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ QSlider {
background-color: none;
min-height: 20px;
}

QSlider::handle:disabled{
background: #b2b2b2;
}
QSlider::handle {
background: white;
height: 20px;
Expand Down Expand Up @@ -254,6 +256,9 @@ QTableWidget QScrollBar{
border: 0;
padding: 0;
}
QTableWidget{
border: 0;
}

QTextBrowser {
border: none;
Expand Down
2 changes: 1 addition & 1 deletion exe_installer_setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "PyFlat Youtube Downloader"
#define MyAppVersion "1.3.0"
#define MyAppVersion "1.3.1"
#define MyAppPublisher "PyFlat Studios"
#define MyAppExeName "main.exe"

Expand Down
72 changes: 61 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ def get_abs_path(relative_path):
from src.CustomWidgets.ProgressDialog import ProgressDialog
from src.Ui_MainWindow import Ui_MainWindow
from src.CustomWidgets.SLabel import SLabel
from src.CustomWidgets.VideoSelectDialog import VideoSelectDialog

from urllib.request import urlopen
from urllib.error import URLError

VERSION = "1.3.0"
VERSION = "1.3.1"

class noLogger:
def error(msg):
Expand All @@ -52,8 +53,6 @@ def __init__(self):
self.ui.search_stack_widg.setCurrentIndex(0)
self.ui.download_2.setCurrentIndex(0)

self.ui.tableWidget.verticalScrollBar().setObjectName("test")

self.ui.tableWidget.focusOutEvent = self.on_focus_out

self.bind_keys()
Expand Down Expand Up @@ -148,6 +147,8 @@ def __init__(self):
mw.ui.download_button.clicked.connect(lambda: self.data.prepare_for_download())
mw.ui.next_page_btn.clicked.connect(lambda: mw.ui.download_2.setCurrentIndex(0))
mw.ui.last_page_btn.clicked.connect(lambda: mw.ui.download_2.setCurrentIndex(1))
mw.ui.select_videos_btn.clicked.connect(lambda: self.show_video_select())
mw.ui.playlist_range_slider.valueChanged.connect(lambda: self.change_download_range())
mw.ui.scrollArea.verticalScrollBar().valueChanged.connect(lambda: [self.fill_new_widgs()])
mw.search_shortcut.activated.connect(self.enter_pressed)
mw.ui.tableWidget.cellClicked.connect(self.handle_clicked)
Expand All @@ -158,6 +159,7 @@ def __init__(self):
self.update_thread = None
self.downloads = []
self.cur_process = []
self.selected_ids = []
self.loading = False
self.delete_exe_files()
self.connect_menu_actions()
Expand All @@ -169,6 +171,38 @@ def __init__(self):
if getattr(sys, 'frozen', False) and self.update_check:
self.search_for_updates()

def show_video_select(self):
videos = []
for index, playlist_object in enumerate(self.data.playlist_data_objects):
videos.append({"title": playlist_object.title,
"uploader": playlist_object.author,
"playlist_index": index,
"selected": True if index + 1 in self.selected_ids else False
})
self.video_select_dialog = VideoSelectDialog(mw, videos)
self.video_select_dialog.exec()
self.selected_ids = self.video_select_dialog.get_selected()
if self.selected_ids == [] or self.has_clear_range(self.selected_ids):
mw.ui.playlist_range_slider.setEnabled(True)
else:
mw.ui.playlist_range_slider.setEnabled(False)

def change_download_range(self):
start, stop = mw.ui.playlist_range_slider.value()
self.selected_ids = []
for num in range(start, stop + 1):
self.selected_ids.append(num)

def has_clear_range(self, numbers):
numbers.sort()

for i in range(len(numbers) - 1):
if numbers[i + 1] - numbers[i] != 1:
return False
mw.ui.playlist_range_slider.setValue((numbers[0], numbers[-1]))
return True


def enter_pressed(self):
if mw.ui.mainpages.currentIndex() == 0:
mw.ui.searching_button.click()
Expand Down Expand Up @@ -413,6 +447,8 @@ def yt_search(self, text, pl_items, req):

def use_info(self, info, cur_link):
self.loading = False
if not info:
info = {}
if info != {} and info["webpage_url_domain"] != None and info["webpage_url_domain"] == "youtube.com" and info["channel"] != None and info != False:
self.cur_link = cur_link
if "?list=" in cur_link and ("&list=" not in cur_link and "?v=" not in cur_link):
Expand Down Expand Up @@ -548,6 +584,7 @@ def update_main_frame(self):
mw.invokeFunc(mw.ui.download_2, "setCurrentIndex", Qt.QueuedConnection, Q_ARG(int, 1))
mw.invokeFunc(mw.ui.info_range_slider_label, "setText", Qt.QueuedConnection, Q_ARG(str, "Select the Range you want to Download"))
mw.ui.date_label.setText(f"Playlist Count: {self.data.playlist_count} Videos")
mw.ui.last_page_btn.setVisible(True)
mw.invokeFunc2(mw, "setWidg2Range", Qt.QueuedConnection, Q_ARG(int, 1), Q_ARG(int, self.data.playlist_count))
mw.invokeFunc2(mw, "setWidg2Value", Qt.QueuedConnection, Q_ARG(int, 1), Q_ARG(int, self.data.playlist_count))

Expand Down Expand Up @@ -821,6 +858,7 @@ def create_data_objects(self, url, info, index):
self.playlist_data_objects[index] = x
if not None in self.playlist_data_objects:
mw.ui.download_button.setEnabled(True)
mw.ui.select_videos_btn.setEnabled(True)

def get_thumbnail_url(self):
x = []
Expand Down Expand Up @@ -898,12 +936,16 @@ def check_if_exists(self, filename):
self.download()

def download_playlist(self):
start, stop = mw.ui.playlist_range_slider.value()
def download_next(i):
if i < stop:
self.playlist_data_objects[i].prepare_for_download()
QTimer.singleShot(1000, lambda: download_next(i + 1))
download_next(start - 1)
if dl.selected_ids == []:
dl.yes_no_messagebox("No video chosen", QMessageBox.Warning, "Warning", QMessageBox.Ok)
return
def download_next(index):
if index < len(dl.selected_ids):
video_id = dl.selected_ids[index]-1
self.playlist_data_objects[video_id].prepare_for_download()
QTimer.singleShot(1000, lambda: download_next(index + 1))

download_next(0)

def download(self, row=None):
if row == None:
Expand Down Expand Up @@ -1307,8 +1349,16 @@ def run(self):
screenshot = mw.grab()
screenshot.save("showcase/Select_Playlist_Range.png", "png")

mw.ui.select_videos_btn.click()
self.msleep(1000)

screenshot = dl.video_select_dialog.grab()
screenshot.save("showcase/Select_Playlist_Precise.png", "png")

mw.ui.next_page_btn.click()

self.msleep(1000)

screenshot = mw.grab()
screenshot.save("showcase/Download_Playlist.png", "png")

Expand All @@ -1331,6 +1381,6 @@ def qt_message_handler(mode, context, message):
qInstallMessageHandler(qt_message_handler)
mw = MainWindow()
dl = Downloader()
#thread = ScreenShot(mw)
#thread.start()
# thread = ScreenShot(mw)
# thread.start()
sys.exit(app.exec())
48 changes: 38 additions & 10 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</size>
</property>
<property name="windowTitle">
<string>Youtube Downloader v1.3.0</string>
<string>Youtube Downloader v1.3.1</string>
</property>
<property name="styleSheet">
<string notr="true">* {
Expand Down Expand Up @@ -608,7 +608,7 @@ QTableWidget QScrollBar{
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="mpage1">
<property name="sizePolicy">
Expand Down Expand Up @@ -1139,6 +1139,9 @@ QTableWidget QScrollBar{
</widget>
<widget class="QWidget" name="download_bar_page3">
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="info_range_slider_label">
<property name="maximumSize">
Expand Down Expand Up @@ -1181,16 +1184,41 @@ QTableWidget QScrollBar{
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="next_page_btn">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>Next</string>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>25</number>
</property>
<item>
<widget class="QPushButton" name="select_videos_btn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Select Videos</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="next_page_btn">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

setup(
name="youtube_downloader",
version="1.3.0",
version="1.3.1",
description="Youtube Downloader",
options={"build_exe": build_exe_options},
executables=executables,
Expand Down
Binary file modified showcase/Download_Overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified showcase/Download_Playlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified showcase/Search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase/Select_Playlist_Precise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified showcase/Select_Playlist_Range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5d68842

Please sign in to comment.