Skip to content

Commit 52980d3

Browse files
Merge pull request #11 from michael-mueller-git/feature/flatpak
Feature/flatpak
2 parents fd60377 + b041f26 commit 52980d3

File tree

9 files changed

+436
-1
lines changed

9 files changed

+436
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ funscript-editor*.AppImage
1212
funscript-editor.spec
1313
funscript_actions.csv
1414
linuxdeploy*.AppImage
15+
build-dir
16+
.flatpak-builder
17+
repo

build_flatpak.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
sudo sysctl kernel.unprivileged_userns_clone=1
4+
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
5+
# flatpak install flathub org.freedesktop.Platform//21.08 org.freedesktop.Sdk//21.08
6+
flatpak install org.gnome.Platform//3.38 org.gnome.Sdk//3.38
7+
flatpak-builder --repo=repo --force-clean build-dir org.flatpak.PythonFunscriptEditor.json

contrib/flatpak/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Flatpak
2+
3+
## Build Flatpak from Source
4+
5+
Run in project root:
6+
7+
```bash
8+
./build_flatpak.sh
9+
```
10+
11+
To verify that the build was successful, run the following:
12+
13+
```bash
14+
flatpak --user remote-add --no-gpg-verify local-repo repo
15+
flatpak --user install local-repo org.flatpak.PythonFunscriptEditor
16+
flatpak run org.flatpak.PythonFunscriptEditor
17+
flatpak --user remote-delete local-repo
18+
```
19+
20+
An other option is to use `flatpak-builder` to install the application.
21+
22+
```
23+
flatpak-builder --user --install --force-clean build-dir org.flatpak.PythonFunscriptEditor.json
24+
flatpak run org.flatpak.PythonFunscriptEditor
25+
flatpak uninstall org.flatpak.PythonFunscriptEditor
26+
```

contrib/flatpak/runner.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
/app/bin/conda/bin/activate
4+
/app/bin/conda/bin/python /app/bin/main.py "$@"

environment_appimage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ dependencies:
160160
- matplotlib==3.4.2
161161
- mergedeep==1.3.4
162162
- mkdocs==1.2.1
163+
- pgi==0.0.11.2
163164
- playsound==1.3.0
164165
- pyinstaller==4.3
165166
- pyinstaller-hooks-contrib==2021.2

environment_flatpak.yaml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: base
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- _libgcc_mutex=0.1=main
7+
- _openmp_mutex=4.5=1_gnu
8+
- alabaster=0.7.12=pyhd3eb1b0_0
9+
- alsa-lib=1.2.3=h516909a_0
10+
- babel=2.9.1=pyhd3eb1b0_0
11+
- blas=1.0=mkl
12+
- brotlipy=0.7.0=py38h27cfd23_1003
13+
- bzip2=1.0.8=h7f98852_4
14+
- c-ares=1.17.1=h7f98852_1
15+
- ca-certificates=2021.7.5=h06a4308_1
16+
- cairo=1.16.0=hf32fb01_1
17+
- certifi=2021.5.30=py38h06a4308_0
18+
- cffi=1.14.6=py38h400218f_0
19+
- chardet=4.0.0=py38h06a4308_1003
20+
- cryptography=3.4.7=py38hd23ed53_0
21+
- dbus=1.13.18=hb2f20db_0
22+
- expat=2.4.1=h2531618_2
23+
- ffmpeg=4.3.1=hca11adc_2
24+
- fontconfig=2.13.1=h6c09931_0
25+
- freetype=2.10.4=h5ab3b9f_0
26+
- gettext=0.19.8.1=h0b5b191_1005
27+
- gitdb=4.0.7=pyhd3eb1b0_0
28+
- gitpython=3.1.18=pyhd3eb1b0_1
29+
- glib=2.68.3=h9c3ff4c_0
30+
- glib-tools=2.68.3=h9c3ff4c_0
31+
- gmp=6.2.1=h58526e2_0
32+
- gnutls=3.6.13=h85f3911_1
33+
- graphite2=1.3.13=h58526e2_1001
34+
- gst-plugins-base=1.18.4=hf529b03_2
35+
- gstreamer=1.18.4=h76c114f_2
36+
- harfbuzz=2.8.2=h83ec7ef_0
37+
- hdf5=1.10.6=nompi_h7c3c948_1111
38+
- icu=68.1=h58526e2_0
39+
- idna=2.10=pyhd3eb1b0_0
40+
- imagesize=1.2.0=pyhd3eb1b0_0
41+
- intel-openmp=2021.2.0=h06a4308_610
42+
- jasper=1.900.1=h07fcdf6_1006
43+
- jinja2=3.0.1=pyhd3eb1b0_0
44+
- jpeg=9d=h36c2ea0_0
45+
- krb5=1.19.1=hcc1bbae_0
46+
- lame=3.100=h7f98852_1001
47+
- lcms2=2.12=h3be6417_0
48+
- ld_impl_linux-64=2.35.1=h7274673_9
49+
- libblas=3.9.0=9_mkl
50+
- libcblas=3.9.0=9_mkl
51+
- libclang=11.1.0=default_ha53f305_1
52+
- libcurl=7.77.0=h2574ce0_0
53+
- libedit=3.1.20191231=he28a2e2_2
54+
- libev=4.33=h516909a_1
55+
- libevent=2.1.10=hcdb4288_3
56+
- libffi=3.3=he6710b0_2
57+
- libgcc-ng=9.3.0=h5101ec6_17
58+
- libgfortran-ng=7.5.0=ha8ba4b0_17
59+
- libgfortran4=7.5.0=ha8ba4b0_17
60+
- libglib=2.68.3=h3e27bee_0
61+
- libgomp=9.3.0=h5101ec6_17
62+
- libiconv=1.16=h516909a_0
63+
- liblapack=3.9.0=9_mkl
64+
- liblapacke=3.9.0=9_mkl
65+
- libllvm11=11.1.0=hf817b99_2
66+
- libnghttp2=1.43.0=h812cca2_0
67+
- libogg=1.3.4=h7f98852_1
68+
- libopencv=4.5.2=py38hcdf9bf1_0
69+
- libopus=1.3.1=h7f98852_1
70+
- libpng=1.6.37=hbc83047_0
71+
- libpq=13.3=hd57d9b9_0
72+
- libprotobuf=3.15.8=h780b84a_0
73+
- libssh2=1.9.0=ha56f1ee_6
74+
- libstdcxx-ng=9.3.0=hd4cf53a_17
75+
- libtiff=4.2.0=h85742a9_0
76+
- libuuid=1.0.3=h1bed415_2
77+
- libvorbis=1.3.7=h9c3ff4c_0
78+
- libwebp-base=1.2.0=h27cfd23_0
79+
- libxcb=1.14=h7b6447c_0
80+
- libxkbcommon=1.0.3=he3ba5ed_0
81+
- libxml2=2.9.12=h72842e0_0
82+
- lz4-c=1.9.3=h2531618_0
83+
- markupsafe=2.0.1=py38h27cfd23_0
84+
- mkl=2021.2.0=h06a4308_296
85+
- mkl-service=2.3.0=py38h27cfd23_1
86+
- mkl_fft=1.3.0=py38h42c9631_2
87+
- mkl_random=1.2.1=py38ha9443f7_2
88+
- mysql-common=8.0.25=ha770c72_0
89+
- mysql-libs=8.0.25=h935591d_0
90+
- ncurses=6.2=he6710b0_1
91+
- nettle=3.6=he412f7d_0
92+
- nspr=4.30=h9c3ff4c_0
93+
- nss=3.67=hb5efdd6_0
94+
- numpy=1.20.2=py38h2d18471_0
95+
- numpy-base=1.20.2=py38hfae3a4d_0
96+
- olefile=0.46=py_0
97+
- opencv=4.5.2=py38h578d9bd_0
98+
- openh264=2.1.1=h780b84a_0
99+
- openjpeg=2.3.0=h05c96fa_1
100+
- openssl=1.1.1k=h27cfd23_0
101+
- packaging=21.0=pyhd3eb1b0_0
102+
- pcre=8.45=h295c915_0
103+
- pillow=8.3.1=py38h2c7a002_0
104+
- pip=21.1.3=py38h06a4308_0
105+
- pixman=0.40.0=h36c2ea0_0
106+
- py-opencv=4.5.2=py38hd0cf306_0
107+
- pycparser=2.20=py_2
108+
- pygments=2.9.0=pyhd3eb1b0_0
109+
- pyopenssl=20.0.1=pyhd3eb1b0_1
110+
- pyparsing=2.4.7=pyhd3eb1b0_0
111+
- pyqt=5.12.3=py38h578d9bd_7
112+
- pyqt-impl=5.12.3=py38h7400c14_7
113+
- pyqt5-sip=4.19.18=py38h709712a_7
114+
- pyqtchart=5.12=py38h7400c14_7
115+
- pyqtwebengine=5.12.1=py38h7400c14_7
116+
- pysocks=1.7.1=py38h06a4308_0
117+
- python=3.8.10=h12debd9_8
118+
- python_abi=3.8=2_cp38
119+
- pytz=2021.1=pyhd3eb1b0_0
120+
- pyyaml=5.4.1=py38h27cfd23_1
121+
- qt=5.12.9=hda022c4_4
122+
- readline=8.1=h27cfd23_0
123+
- requests=2.25.1=pyhd3eb1b0_0
124+
- scipy=1.6.2=py38had2a1c9_1
125+
- setuptools=52.0.0=py38h06a4308_0
126+
- sip=4.19.13=py38he6710b0_0
127+
- six=1.16.0=pyhd3eb1b0_0
128+
- smmap=4.0.0=pyhd3eb1b0_0
129+
- snowballstemmer=2.1.0=pyhd3eb1b0_0
130+
- sphinx=4.0.2=pyhd3eb1b0_0
131+
- sphinxcontrib-applehelp=1.0.2=pyhd3eb1b0_0
132+
- sphinxcontrib-devhelp=1.0.2=pyhd3eb1b0_0
133+
- sphinxcontrib-htmlhelp=2.0.0=pyhd3eb1b0_0
134+
- sphinxcontrib-jsmath=1.0.1=pyhd3eb1b0_0
135+
- sphinxcontrib-qthelp=1.0.3=pyhd3eb1b0_0
136+
- sphinxcontrib-serializinghtml=1.1.5=pyhd3eb1b0_0
137+
- sqlite=3.36.0=hc218d9a_0
138+
- tk=8.6.10=hbc83047_0
139+
- typing-extensions=3.10.0.0=hd3eb1b0_0
140+
- typing_extensions=3.10.0.0=pyh06a4308_0
141+
- urllib3=1.26.6=pyhd3eb1b0_1
142+
- wheel=0.36.2=pyhd3eb1b0_0
143+
- x264=1!161.3030=h7f98852_1
144+
- xz=5.2.5=h7b6447c_0
145+
- yaml=0.2.5=h7b6447c_0
146+
- zlib=1.2.11=h7b6447c_3
147+
- zstd=1.4.9=haebb681_0
148+
- pip:
149+
- altgraph==0.17
150+
- click==8.0.1
151+
- coloredlogs==15.0.1
152+
- cycler==0.10.0
153+
- docutils==0.16
154+
- evdev==1.4.0
155+
- ghp-import==2.0.1
156+
- humanfriendly==9.2
157+
- importlib-metadata==4.6.1
158+
- kiwisolver==1.3.1
159+
- markdown==3.3.4
160+
- matplotlib==3.4.2
161+
- mergedeep==1.3.4
162+
- mkdocs==1.2.1
163+
- pgi==0.0.11.2
164+
- playsound==1.3.0
165+
- pyinstaller==4.3
166+
- pyinstaller-hooks-contrib==2021.2
167+
- pynput==1.7.3
168+
- python-dateutil==2.8.1
169+
- python-mpv==0.5.2
170+
- python-xlib==0.31
171+
- pyyaml-env-tag==0.1
172+
- screeninfo==0.6.7
173+
- sphinx-rtd-theme==0.5.2
174+
- watchdog==2.1.3
175+
- zipp==3.5.0
176+
prefix: /home/ubuntu/miniconda3

funscript_editor/ui/funscript_editor_window.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ def __open_video(self):
276276
file_name = QtWidgets.QFileDialog.getOpenFileName(
277277
None,
278278
caption="Select Video File",
279-
directory=QtCore.QDir.currentPath())
279+
options=QtWidgets.QFileDialog.DontUseNativeDialog # required to get correct path in flatpak
280+
)
280281
if len(file_name) < 1: return
281282
if not any(file_name[0].lower().endswith(x) for x in ['.mkv', '.mp4']): return
282283

@@ -294,6 +295,7 @@ def __open_video(self):
294295
self.ui.seekBar.setMaximum(max((0, self.video_player.get_length-2)))
295296
self.ui.seekBar.setValue(0)
296297
self.ui.timestamp.setText(FFmpegStream.millisec_to_timestamp(0)+' ')
298+
self.__logger.info("Load Video: %s (%s)" , file_name[0], "True" if os.path.exists(file_name[0]) else "False")
297299

298300
def __new_funscript(self):
299301
self.funscript = Funscript(fps=self.video_player.get_fps)

funscript_editor/ui/video_player.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def open(self, video_file :str) -> None:
403403
self.player.pause = True
404404
cap = cv2.VideoCapture(video_file)
405405
self.fps = cap.get(cv2.CAP_PROP_FPS)
406+
if self.fps == 0: self.fps = 30
406407
self.height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
407408
self.width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
408409
self.duration = cap.get(cv2.CAP_PROP_FRAME_COUNT) / self.fps

0 commit comments

Comments
 (0)