Skip to content

Commit

Permalink
* Fixing #543 systems with more than one opencl device would break th…
Browse files Browse the repository at this point in the history
…umbnails and some encodings (thanks to swadomlic)

* Fixing #505 (maybe) trying new methods to clean file paths for subtitles (thanks to Maddie Davis)
  • Loading branch information
cdgriffith committed Feb 23, 2024
1 parent 88b44f0 commit 36ad9db
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Gather build version (*nix)
run: |
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Gather build version
shell: powershell
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Install Dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v3
with:
python-version: "3.11"
python-version: "3.12"

- run: pip install black==23.7.0
- run: python -m black --check .
Expand All @@ -29,7 +29,7 @@ jobs:

- uses: actions/setup-python@v3
with:
python-version: "3.11"
python-version: "3.12"

- name: Install PySide6 requirements
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 5.6.1

* Fixing #543 systems with more than one opencl device would break thumbnails and some encodings (thanks to swadomlic)
* Fixing #505 (maybe) trying new methods to clean file paths for subtitles (thanks to Maddie Davis)

## Version 5.6.0

* Adding Passes option for bitrate mode in x265 and x264 (thanks to Chriss)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2019-2023 Chris Griffith
Copyright (c) 2019-2024 Chris Griffith

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Special thanks to [leonardyan](https://github.com/leonardyan) for numerous Chine

# License

Copyright (C) 2019-2023 Chris Griffith
Copyright (C) 2019-2024 Chris Griffith

The code itself is licensed under the MIT which you can read in the `LICENSE` file. <br>
Read more about the release licensing in the [docs](docs/README.md) folder. <br>
Expand Down
2 changes: 1 addition & 1 deletion fastflix/encoders/common/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate_ffmpeg_start(
[
f'"{ffmpeg}"',
start_extra,
("-init_hw_device opencl=ocl -filter_hw_device ocl " if enable_opencl and remove_hdr else ""),
("-init_hw_device opencl:0.0=ocl -filter_hw_device ocl " if enable_opencl and remove_hdr else ""),
"-y",
time_one,
incoming_fps,
Expand Down
4 changes: 2 additions & 2 deletions fastflix/flix.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def generate_thumbnail_command(

# Hardware acceleration with OpenCL
if enable_opencl:
command += ["-init_hw_device", "opencl=ocl", "-filter_hw_device", "ocl"]
command += ["-init_hw_device", "opencl:0.0=ocl", "-filter_hw_device", "ocl"]

command += shlex.split(filters)

Expand Down Expand Up @@ -462,7 +462,7 @@ def ffmpeg_audio_encoders(app, config: Config) -> List:


def ffmpeg_opencl_support(app, config: Config) -> bool:
cmd = execute([f"{config.ffmpeg}", "-hide_banner", "-log_level", "error", "-init_hw_device", "opencl", "-h"])
cmd = execute([f"{config.ffmpeg}", "-hide_banner", "-log_level", "error", "-init_hw_device", "opencl:0.0", "-h"])
app.fastflix.opencl_support = cmd.returncode == 0
return app.fastflix.opencl_support

Expand Down
16 changes: 15 additions & 1 deletion fastflix/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,21 @@ def clean_file_string(source):


def quoted_path(source):
return str(source).strip().replace("\\", "\\\\").replace(":", "\\:").replace("'", "'\\\\\\''")
cleaned_string = (
str(source)
.strip()
.replace("\\", "\\\\")
.replace(":", "\\:")
.replace("'", "'\\\\\\''")
.replace("\r\n", "")
.replace("\n", "")
.replace("\r", "")
)
if " " in cleaned_string[0:4]:
logger.warning(f"Unexpected space at start of quoted path, attempting to fix: {cleaned_string}")
cleaned_string = cleaned_string[0:4].replace(" ", "") + cleaned_string[4:]
logger.warning(f"New path set to: {cleaned_string}")
return cleaned_string


def sanitize(source):
Expand Down
19 changes: 10 additions & 9 deletions fastflix/widgets/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from fastflix.widgets.settings import Settings
from fastflix.widgets.windows.concat import ConcatWindow
from fastflix.widgets.windows.multiple_files import MultipleFilesWindow
from fastflix.widgets.windows.hdr10plus_inject import HDR10PlusInjectWindow

# from fastflix.widgets.windows.hdr10plus_inject import HDR10PlusInjectWindow

logger = logging.getLogger("fastflix")

Expand Down Expand Up @@ -214,11 +215,11 @@ def init_menu(self):
concat_action.triggered.connect(self.show_concat)
tools_menu.addAction(concat_action)

hdr10p_inject_action = QAction(
QtGui.QIcon(get_icon("onyx-queue", self.app.fastflix.config.theme)), t("HDR10+ Inject"), self
)
hdr10p_inject_action.triggered.connect(self.show_hdr10p_inject)
tools_menu.addAction(hdr10p_inject_action)
# hdr10p_inject_action = QAction(
# QtGui.QIcon(get_icon("onyx-queue", self.app.fastflix.config.theme)), t("HDR10+ Inject"), self
# )
# hdr10p_inject_action.triggered.connect(self.show_hdr10p_inject)
# tools_menu.addAction(hdr10p_inject_action)

wiki_action = QAction(self.si(QtWidgets.QStyle.SP_FileDialogInfoView), t("FastFlix Wiki"), self)
wiki_action.triggered.connect(self.show_wiki)
Expand Down Expand Up @@ -273,9 +274,9 @@ def show_concat(self):
self.concat = ConcatWindow(app=self.app, main=self.main)
self.concat.show()

def show_hdr10p_inject(self):
self.hdr10p_inject = HDR10PlusInjectWindow(app=self.app, main=self.main)
self.hdr10p_inject.show()
# def show_hdr10p_inject(self):
# self.hdr10p_inject = HDR10PlusInjectWindow(app=self.app, main=self.main)
# self.hdr10p_inject.show()

def show_about(self):
self.about = About(app=self.app)
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target-version = ['py311']
target-version = ['py312']
exclude = '''
/(
\.eggs
Expand All @@ -21,7 +21,7 @@ authors = [{ name = "Chris Griffith", email = "[email protected]" }]
readme = "README.md"
#url = "https://fastflix.org"
#download_url = "https://github.com/cdgriffith/FastFlix/releases"
requires-python = ">=3.11,<3.12"
requires-python = ">=3.12"
dynamic = ["version"]
dependencies = [
"appdirs~=1.4",
Expand All @@ -33,7 +33,7 @@ dependencies = [
"pathvalidate>=2.4,<3.0",
"psutil>=5.9,<6.0",
"pydantic>=1.9,<2.0",
"pyside6>=6.4.2,<7.0",
"pyside6>=6.4.2",
"python-box[all]>=6.0,<7.0",
"requests>=2.28,<3.0",
"reusables>=0.9.6,<0.10.0",
Expand Down

0 comments on commit 36ad9db

Please sign in to comment.