Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.4 #50

Merged
merged 43 commits into from
Aug 3, 2024
Merged

3.4 #50

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bb12fc7
- added changelog information when checking for updates
EchterAlsFake Jun 25, 2024
bca137b
- fixed xvideos searching
EchterAlsFake Jun 25, 2024
20ea422
- fixed searching and pagination
EchterAlsFake Jun 25, 2024
3f45167
- repositioned some functions
EchterAlsFake Jun 25, 2024
47a4823
- refactored loading video attributes
EchterAlsFake Jun 26, 2024
de97f0c
- refactoring and improving the layout (not finished)
EchterAlsFake Jun 26, 2024
b1b6c7a
- implemented thumbnail writing into the metadata of the mp4 header
EchterAlsFake Jun 26, 2024
e7210dd
- fixed something in the layout which pissed me off for months.
EchterAlsFake Jun 26, 2024
cf11c77
- some more (unstable) layout fixes
EchterAlsFake Jun 26, 2024
36af317
- some progress on fixing sorting
EchterAlsFake Jun 27, 2024
8b508a6
- finished fixing the sorting
EchterAlsFake Jun 27, 2024
4a370dc
- announcement for xhamster
EchterAlsFake Jun 27, 2024
cd3f646
- removed pypresence from android requirements
EchterAlsFake Jun 28, 2024
7dfa03e
- fixed top bar button icon size
EchterAlsFake Jun 30, 2024
f78b1ec
- correctly renamed some widgets
EchterAlsFake Jun 30, 2024
1147f80
- small change for the icons
EchterAlsFake Jun 30, 2024
e497794
- added tree widget auto apply by author's name
EchterAlsFake Jun 30, 2024
30675b6
- some targets added
EchterAlsFake Jul 3, 2024
3a2ac29
- Added support for spankbang (only downloading)
EchterAlsFake Jul 6, 2024
a7b55d0
- potentially fixing #44
EchterAlsFake Jul 10, 2024
a7c7d4c
Merge remote-tracking branch 'origin/3.4' into 3.4
EchterAlsFake Jul 10, 2024
e53ccdb
- added region blocked exception #44
EchterAlsFake Jul 11, 2024
5cc1416
- adding spankbang api to requirements
EchterAlsFake Jul 11, 2024
0098ba6
- updated changelog
EchterAlsFake Jul 12, 2024
711af0a
- improved logging
EchterAlsFake Jul 29, 2024
aca8abe
- layout fix for the hqporner / eporner tab
EchterAlsFake Jul 29, 2024
d66ab64
merging #48 into v3.4
EchterAlsFake Jul 29, 2024
76e318b
- testing python3.12 nuitka build
EchterAlsFake Jul 29, 2024
6060e0b
- python3.12 nuitka build succeeded on Linux....
EchterAlsFake Jul 29, 2024
568f4a1
- python3.12 nuitka build succeeded on Linux....
EchterAlsFake Jul 29, 2024
213b629
Merge remote-tracking branch 'origin/3.4' into 3.4
EchterAlsFake Jul 29, 2024
e9c4dba
- fixing nuitka version in windows / macos build
Jul 29, 2024
74ebc32
- fixed the windows build script
Jul 30, 2024
3c31487
- fixed the translations in the code
EchterAlsFake Jul 30, 2024
fec5ba9
- improved the ffmpeg installation cleanup
EchterAlsFake Jul 31, 2024
9884a58
- last fix for the translations
EchterAlsFake Jul 31, 2024
53c3295
- fix for the settings layout
EchterAlsFake Jul 31, 2024
c0ca0d5
- added downloading support for spankbang
EchterAlsFake Jul 31, 2024
f5a705d
- added downloading support for spankbang in the ClI
EchterAlsFake Aug 3, 2024
afc1af8
- fixed the translations once again
EchterAlsFake Aug 3, 2024
c8291db
Merge branch 'master' into 3.4
EchterAlsFake Aug 3, 2024
22dbe31
- pov: me being stupid as usual :skull:
EchterAlsFake Aug 3, 2024
889ea38
Merge remote-tracking branch 'origin/3.4' into 3.4
EchterAlsFake Aug 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 32 additions & 41 deletions Porn_Fetch_CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
import phub.consts

from src.backend.shared_functions import *
from src.backend.log_config import setup_logging
from base_api.modules.download import *
from base_api.modules.progress_bars import *
from base_api.base import Core
from rich import print as rprint
from rich.markdown import Markdown

logger = setup_logging()


class CLI:
def __init__(self):
self.skip_existing_files = None
self.threading_mode = None
self.result_limit = None
self.directory_system = None
Expand Down Expand Up @@ -106,7 +110,6 @@ def menu(self):
sys.exit(0)

def load_user_settings(self):
self.language = self.conf.get("Video", "language")
self.delay = int(self.conf.get("Video", "delay"))
self.workers = int(self.conf.get("Performance", "workers"))
self.timeout = int(self.conf.get("Performance", "timeout"))
Expand All @@ -115,6 +118,7 @@ def load_user_settings(self):
self.quality = self.conf.get("Video", "quality")
self.output_path = correct_output_path(output_path=self.conf.get("Video", "output_path"))
self.directory_system = True if self.conf.get("Video", "directory_system") == "1" else False
self.skip_existing_files = True if self.conf.get("Video", "skip_existing_files") == "true" else False
self.result_limit = int(self.conf.get("Video", "search_limit"))
self.threading_mode = self.conf.get("Performance", "threading_mode")

Expand All @@ -127,24 +131,11 @@ def load_user_settings(self):
phub.consts.FFMPEG_EXECUTABLE = self.ffmpeg_path

else:
logger_error("FFMPEG wasn't found... Have you extracted it from the .zip file?")
logger_error("FFMPEG Features won't be available!")
logger.warning("FFMPEG wasn't found... Have you extracted it from the .zip file?")
logger.warning("FFMPEG Features won't be available!")
self.ffmpeg_features = False

def save_user_settings(self):
languages = f"""{Fore.WHITE}
de: German
en: English
fr: French
zh: Chinese
rt: Russian
nl: Dutch
es: Spanish
it: Italian
pt: Portuguese
cz: Czech
jp: Japanese
"""
while True:
settings_options = input(f"""
{Fore.WHITE}--------- {Fore.LIGHTGREEN_EX}Quality {Fore.WHITE}----------
Expand All @@ -161,10 +152,8 @@ def save_user_settings(self):
{return_color()}9) Enable / Disable directory system
{Fore.WHITE}-------- {return_color()}Result Limit {Fore.WHITE}-------
{return_color()}10) Change result limit
{Fore.WHITE}-------- {return_color()}Language (Video titles for PornHub){Fore.WHITE}
{return_color()}11) Change Language
{Fore.WHITE}-------- {return_color()}Output Path {Fore.WHITE}--------
{return_color()}12) Change output path
{return_color()}11) Change output path

{Fore.LIGHTRED_EX}99) Exit
{return_color()}------------->:""")
Expand Down Expand Up @@ -211,15 +200,9 @@ def save_user_settings(self):
self.conf.set("Video", "search_limit", limit)

elif settings_options == "11":
print("Please enter a language code from the list below:")
print(languages)
language = input(f"Enter the new language code -->:")
self.conf.set("Video", "language", language)

elif settings_options == "12":
path = input(f"Enter a new output path -->:")
if not os.path.exists(path):
raise FileNotFoundError("The specified output path doesn't exist!")
raise "The specified output path doesn't exist!"

self.conf.set("Video", "output_path", path)

Expand All @@ -234,7 +217,7 @@ def process_video(self, url=None):
if url is None:
url = input(f"{return_color()}Please enter the Video URL -->:")

video = check_video(url=url, language=self.language, delay=self.delay)
video = check_video(url=url, delay=self.delay)
title = Core().strip_title(video.title)

if isinstance(video, Video):
Expand All @@ -255,10 +238,10 @@ def process_video(self, url=None):
output_path = pathlib.Path(output_path + title + ".mp4")

if os.path.exists(output_path):
logger_debug(f"{return_color()}File: {output_path} already exists, skipping...")
logger.debug(f"{return_color()}File: {output_path} already exists, skipping...")
return

logger_debug(f"{return_color()}Trying to acquire the semaphore...")
logger.debug(f"{return_color()}Trying to acquire the semaphore...")
self.semaphore.acquire()
self.thread = threading.Thread(target=self.download, args=(video, output_path,))
self.thread.start()
Expand Down Expand Up @@ -333,7 +316,7 @@ def search_videos(self):
self.iterate_generator(Client().search(query))

elif website == "2":
self.iterate_generator(hq_Client().search_videos(query=query, pages=10))
self.iterate_generator(hq_Client().search_videos(query=query))

elif website == "3":
self.iterate_generator(xv_Client().search(query))
Expand All @@ -342,9 +325,9 @@ def search_videos(self):
self.iterate_generator(xn_Client().search(query).videos)

elif website == "5":
self.iterate_generator(ep_Client().search_videos(query, page=1, per_page=self.result_limit,
self.iterate_generator(ep_Client().search_videos(query, per_page=self.result_limit,
sorting_order="", sorting_gay="", sorting_low_quality="",
enable_html_scraping=True))
enable_html_scraping=True, page=1))

def process_file(self):
videos = []
Expand All @@ -364,14 +347,14 @@ def process_file(self):
else:
videos.append(line)

logger_debug(f"{return_color()}Processing Models / Videos...")
logger.debug(f"{return_color()}Processing Models / Videos...")
for video in videos:
objects.append(check_video(video, language=self.language, delay=self.delay))
objects.append(check_video(video, delay=self.delay))

for video in models:
objects.append(video)

logger_debug(f"{return_color()}Done!")
logger.debug(f"{return_color()}Done!")
self.iterate_generator(objects)

def download(self, video, output_path):
Expand All @@ -380,17 +363,18 @@ def download(self, video, output_path):
self.threading_mode = resolve_threading_mode(mode=self.threading_mode, video=video,
workers=self.workers, timeout=self.timeout)
video.download(path=output_path, quality=self.quality, downloader=self.threading_mode,
display=Callback.text_progress_bar)
display=self.callback_wrapper(video.title, Callback.text_progress_bar))

elif isinstance(video, ep_Video) or isinstance(video, hq_Video):
video.download(path=output_path, quality=self.quality, callback=Callback.text_progress_bar)
video.download(path=output_path, quality=self.quality, callback=self.callback_wrapper(video.title,
Callback.text_progress_bar))

else:
video.download(downloader=self.threading_mode, path=output_path, quality=self.quality,
callback=Callback.text_progress_bar)
callback=self.callback_wrapper(video.title, Callback.text_progress_bar))

finally:
logger_debug(f"{return_color()}Finished downloading for: {video.title}")
logger.debug(f"{return_color()}Finished downloading for: {video.title}")
self.semaphore.release()
if self.ffmpeg_features:
os.rename(f"{output_path}", f"{output_path}_.tmp")
Expand All @@ -401,9 +385,16 @@ def download(self, video, output_path):
print(f"\r\033[K[Converting: {progress}/100", end='', flush=True)

os.remove(f"{output_path}_.tmp")
write_tags(path=output_path, video=video, ffmpeg_path=None)
write_tags(path=output_path, video=video)
else:
logger_debug("FFMPEG features disabled, writing tags and converting the video won't be available!")
logger.debug("FFMPEG features disabled, writing tags and converting the video won't be available!")

@staticmethod
def callback_wrapper(title, callback):
def wrapped_callback(pos, total):
callback(pos, total, title)

return wrapped_callback

@staticmethod
def credits():
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@
- Multiple user interface languages
- Native Android application
- modern looking user interface
- Supports over 115 MB/s download speed thanks to well optimized HLS downloading

## General Information
> [!NOTE]
> Supported Platforms:

- Windows (10 / 11)
- Linux (X11 / Wayland)
- Android
- Android (Android is very unstable, please consider using the CLI on Termux instead!)
- macOS (Untested)

The Graphical User Interface is only for 64bit systems. The CLI supports 64 and 32bit systems.
Expand Down
56 changes: 36 additions & 20 deletions README/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ Initial Release
- Fixed typo issues
- Fixed the output path issue
- Changed License to LGPLv3 (The reason for this is, that I am stupid and I used the wrong license. Creative Commons is not valid to be used for developing with Qt. I didn't know that, I am sorry...)

# 1.2
- Added additional stuff to the metadata function (Likes, Image URL, Tags)
- Added border colours for input fields

# 1.3
- Added Threading Modes
- Single: Downloads will be executed within the main thread, and the GUI won't respond to your actions if the download isn't finished.

- Multiple: Download(s) will be executed with separate Threads (QThreads). This is mostly intended for single downloads. You can use that function also for multiple downloads, but that will ruin the progress bar, because it will jump between the different videos.

# 1.4

- Changed UI (stackedWidget)

# 1.5

# 1.5
- Added CI
- Made Readme.md and Build process simpler to understand

# 1.6

- Fixed 7 Bugs
- CLI is more stable
- Code refactoring
Expand All @@ -40,7 +37,6 @@ Initial Release


# 1.7

- Implemented an automated fix for the IndexError exception
- Improved overall code quality
- Split the code into multiple files, to be better readable
Expand All @@ -56,7 +52,6 @@ Initial Release


# 1.8

- Implemented final License agreement
- Persistent settings (untested)
- Added Ubuntu to Install script
Expand All @@ -68,16 +63,13 @@ Initial Release
- Added some basic exceptions

# 1.9

- Fixed OS Error issue
- Added function to strip out special symbols in title, to prevent path issues

# 2.0

This release exists, but I don't remember the changes anymore.

# 2.1

- A complete new UI design
- UI is more fluent / flexible
- API updated to v3.1
Expand All @@ -97,7 +89,6 @@ This release exists, but I don't remember the changes anymore.
- added more filters, to prevent OS Error

# 2.2

- You can now log in with your PornHub Account
- You can now fetch your watched, liked, and recommended videos for your PornHub Account
- updated the CLI a little bit (not finished. It's my priority for the next release)
Expand All @@ -106,16 +97,13 @@ This release exists, but I don't remember the changes anymore.
- removed Security.md, because it was useless, and I don't really remember why I even added it
- added all files to the release page (thanks to Egsagon for telling me that I should do that :)

# 2.3

# 2.3
- fixed some issues...


# 2.4

- If you use the file / model - user - channel functionality, then the TreeWidget will be used
to let you select the videos that you want to download instead of downloading everything

- fixed an issue in the termux build script
- API updated to v3.1-4
- You can now select if you want to have a delay or not (enabling it is recommended!)
Expand All @@ -127,7 +115,6 @@ The next update will focus more on features / compatibility to other systems.
I hope that most issues are now fixed.

# 2.5

- Added search filters
- Move settings to a new page of stacked Widget
- Added keyboard shortcut and some buttons for it
Expand All @@ -138,14 +125,12 @@ I hope that most issues are now fixed.
- Recoded CLI

# 2.6

- API Updated to v3.2.1
- Redesign of the settings widget
- removed some things from the roadmap
- added a connection error exception

# 2.7

- API Updated to v4
- Huge stability and performance boost
- fixed setting Delay not working issue
Expand Down Expand Up @@ -200,7 +185,6 @@ I hope that most issues are now fixed.
- improved visual look and progressbar

# 2.9

- API updated to 4.1.3
- Added Enhancement request from #11 (Skips already downloaded videos...)
- huge Performance increase when downloading (thanks to Egsagon's threaded preset)
Expand Down Expand Up @@ -399,4 +383,36 @@ I tested it on Android 12 & 13 on two devices.
- Improved visual appearance and startup time

## Deprecations
- removed all metadata functionality from Porn Fetch, because it's useless and hard to maintain.
- removed all metadata functionality from Porn Fetch, because it's useless and hard to maintain.

# 3.4

## New Features
- Added support for spankbang
- You can now choose between user uploads, featured videos or both of them when downloading from a PornHub model account
- You can now decide if already existing files will be skipped, or if the title will be slightly changed to download both of them
- Thumbnail of videos will be written into the mp4 file
- You can now automatically select all videos from an author by a certain name

## Design
- switched the sidebar to a top bar (looks better)
- removed the progressbars at the bottom, but added a second widget for it (more space)
- added a new button into the menu which can switch to the previous mentioned widget
- fixed the whole layout for the desktop application.
- Video titles will now be shown in the progress report in the CLI

## Deprecations
- removed internet checks, because it triggers AV
- removed status bar at the top, because it's useless
- removed discord rich presence. I don't even remember why I added it :skull:

## Bug fixes
- Fixed a bug where you couldn't search on xvideos
- Porn Fetch now handles 2002 errors from PornHub (when a video is blocked in your region) Thanks #44 @WatsonSola
- Fixed several issues in the tag writing function (The thing that converts the video with ffmpeg)
- All APIs will now use infinite paging, so that always all videos until the defined search limit will be fetched
- Fixed playlist downloading
- Fixed file progress
- Fixed an issue where the semaphore wouldn't release in the CLI which makes downloading almost impossible, because
the thread is permanently locked
- Fixed the build scripts for Windows and Linux | Thanks @omar-st [Pull Request #48](https://github.com/EchterAlsFake/Porn_Fetch/commit/2d9cc2885c1383369020a5c26e957fe5cdf0f886) [Related Issue #46](https://github.com/EchterAlsFake/Porn_Fetch/issues/46)
Loading
Loading