mkiol / dsnote

Speech Note Linux app. Note taking, reading and translating with offline Speech to Text, Text to Speech and Machine translation.
Mozilla Public License 2.0
468 stars 19 forks source link

Drag and drop does not work on Kde #66

Closed AlexandreBonneau closed 7 months ago

AlexandreBonneau commented 9 months ago

Hello,

first, thank you for this awesome application! I'm using the flatpak 4.3.0 version on Debian Trixie Kde, and unfortunately when trying to drag and drop mp3 directly onto the SpeechNote app, I get a Error: Couldn't open the file. error message.

Here is the log when trying to drag and drop such file. Do note that the app does have access to that location since I can use the transcribe file menu to open it.

» flatpak run net.mkiol.SpeechNote --verbose
Qt: Session management error: Could not open network socket
[I] 09:44:48.964 0x7fd89e210d00 init:49 - logging to stderr enabled
[D] 09:44:48.965 0x7fd89e210d00 () - version: 4.3.0
[D] 09:44:48.965 0x7fd89e210d00 () - translation: "fr_FR"
[D] 09:44:48.965 0x7fd89e210d00 () - starting standalone app
[D] 09:44:48.966 0x7fd89e210d00 () - app: net.mkiol dsnote
[D] 09:44:48.966 0x7fd89e210d00 () - config location: "/home/user/.var/app/net.mkiol.SpeechNote/config"
[D] 09:44:48.966 0x7fd89e210d00 () - data location: "/home/user/.var/app/net.mkiol.SpeechNote/data/net.mkiol/dsnote"
[D] 09:44:48.966 0x7fd89e210d00 () - cache location: "/home/user/.var/app/net.mkiol.SpeechNote/cache/net.mkiol/dsnote"
[D] 09:44:48.966 0x7fd89e210d00 () - settings file: "/home/user/.var/app/net.mkiol.SpeechNote/config/net.mkiol/dsnote/settings.conf"
[D] 09:44:48.966 0x7fd89e210d00 () - platform: "xcb"
[D] 09:44:49.125 0x7fd89e210d00 () - supported audio input devices:
ALSA lib ../../oss/pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
[D] 09:44:49.137 0x7fd89e210d00 () - "pulse"
[D] 09:44:49.162 0x7fd89e210d00 () - "default"
ALSA lib ../../../src/pcm/pcm_direct.c:2045:(snd1_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)
ALSA lib ../../../src/pcm/pcm_direct.c:2045:(snd1_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)
[D] 09:44:49.166 0x7fd89e210d00 () - "alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo"
[D] 09:44:49.166 0x7fd89e210d00 () - "alsa_output.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo.monitor"
[D] 09:44:49.166 0x7fd89e210d00 () - "alsa_output.pci-0000_0e_00.4.analog-stereo.monitor"
[D] 09:44:49.166 0x7fd89e210d00 () - "alsa_output.pci-0000_0c_00.1.hdmi-stereo-extra4.monitor"
[D] 09:44:49.294 0x7fd89e210d00 () - starting service: app-standalone
[D] 09:44:49.297 0x7fd89e210d00 () - mbrola dir: "/app/bin"
[D] 09:44:49.297 0x7fd89e210d00 () - espeak dir: "/app/bin"
[D] 09:44:49.297 0x7fd8849ad600 loop:56 - py executor loop started
[D] 09:44:49.306 0x7fd89e210d00 () - module already unpacked: "rhvoicedata"
[D] 09:44:49.306 0x7fd8851ae600 () - config version: 51 51
[D] 09:44:49.306 0x7fd89e210d00 () - module already unpacked: "rhvoiceconfig"
[D] 09:44:49.314 0x7fd89e210d00 () - module already unpacked: "espeakdata"
[D] 09:44:49.314 0x7fd89e210d00 () - default stt model not found: "fr_fasterwhisper_medium"
[D] 09:44:49.314 0x7fd89e210d00 () - default tts model not found: "fr_piper_upmc_medium_0"
[D] 09:44:49.314 0x7fd89e210d00 () - default mnt lang not found: "fr"
[D] 09:44:49.314 0x7fd89e210d00 () - new default mnt lang: "fr"
[D] 09:44:49.314 0x7fd89e210d00 () - service refresh status, new state: busy
[D] 09:44:49.314 0x7fd89e210d00 () - service state changed: unknown => busy
[D] 09:44:49.314 0x7fd89e210d00 () - delaying features availability
[D] 09:44:49.316 0x7fd89e210d00 () - available styles: ("Default", "Fusion", "Imagine", "Material", "org.kde.breeze", "org.kde.desktop", "Plasma", "Universal")
[D] 09:44:49.317 0x7fd89e210d00 () - style paths: ("/usr/lib/qml/QtQuick/Controls.2")
[D] 09:44:49.317 0x7fd89e210d00 () - import paths: ("/usr/lib/qml", "/app/bin", "qrc:/qt-project.org/imports")
[D] 09:44:49.317 0x7fd89e210d00 () - library paths: ("/usr/share/runtime/lib/plugins", "/usr/lib/plugins", "/app/bin")
[D] 09:44:49.317 0x7fd89e210d00 () - using auto qt style
[D] 09:44:49.317 0x7fd89e210d00 () - XDG_CURRENT_DESKTOP: KDE
[D] 09:44:49.317 0x7fd89e210d00 () - switching to style: "org.kde.desktop"
[D] 09:44:49.338 0x7fd8851ae600 () - models changed
[D] 09:44:49.585 0x7fd89e210d00 () - starting app: app-standalone
[D] 09:44:49.586 0x7fd89e210d00 () - app service state: unknown => busy
logger error: invalid format string
qrc:/qml/main.qml:269:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
logger error: invalid format string
qrc:/qml/main.qml:260:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
logger error: invalid format string
qrc:/qml/Notepad.qml:24:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
logger error: invalid format string
qrc:/qml/Translator.qml:29:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
logger error: invalid format string
qrc:/qml/MainToolBar.qml:221:13: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[D] 09:44:49.985 0x7fd89e210d00 onCompleted:155 - default font pixel size: 14
[D] 09:44:49.997 0x7fd89e210d00 () - service refresh status, new state: busy
[D] 09:44:49.997 0x7fd89e210d00 () - service refresh status, new state: busy
[W] 09:44:50.28 0x7fd89e210d00 ():168 - qrc:/qml/Translator.qml:168:9: QML ColumnLayout (parent or ancestor of QQuickLayoutAttached): Binding loop detected for property "preferredWidth"
[D] 09:44:50.37 0x7fd89e210d00 () - trying features availability update: false
[D] 09:44:50.128 0x7fd89e210d00 () - stt models changed
[D] 09:44:50.130 0x7fd89e210d00 () - update listen
[D] 09:44:50.130 0x7fd89e210d00 () - app stt configured: false => true
[D] 09:44:50.135 0x7fd89e210d00 () - app active stt model: "" => "fr_fasterwhisper_medium"
[D] 09:44:50.135 0x7fd89e210d00 () - update listen
[D] 09:44:50.135 0x7fd89e210d00 () - tts models changed
[D] 09:44:50.137 0x7fd89e210d00 () - update listen
[D] 09:44:50.137 0x7fd89e210d00 () - app tts configured: false => true
[D] 09:44:50.137 0x7fd89e210d00 () - app active tts model: "" => "fr_piper_upmc_medium_0"
[D] 09:44:50.137 0x7fd89e210d00 () - update listen
[W] 09:44:50.137 0x7fd89e210d00 () - no available tts models for in mnt
[W] 09:44:50.137 0x7fd89e210d00 () - no available tts models for out mnt
[D] 09:44:50.137 0x7fd89e210d00 () - ttt models changed
[D] 09:44:50.137 0x7fd89e210d00 () - app ttt configured: false => true
[D] 09:44:50.141 0x7fd89e210d00 () - mnt langs changed
[D] 09:44:50.142 0x7fd89e210d00 () - update listen
[D] 09:44:50.142 0x7fd89e210d00 () - app mnt configured: false => true
[D] 09:44:50.142 0x7fd89e210d00 () - app active mnt lang: "" => "fr"
[D] 09:44:50.142 0x7fd89e210d00 () - app mnt available out langs: 0 => 1
[D] 09:44:50.143 0x7fd89e210d00 () - app tts available models for in mnt: 0 => 2
[D] 09:44:50.144 0x7fd89e210d00 () - app active tts model for in mnt: "" => "fr_mimic3_fr_m_ailabs_low_ezwa"
[D] 09:44:50.144 0x7fd89e210d00 () - app active mnt out lang: "" => "en"
[W] 09:44:50.144 0x7fd89e210d00 () - no available tts models for out mnt
[D] 09:44:50.841 0x7fd89e210d00 () - trying features availability update: false
[D] 09:44:51.841 0x7fd89e210d00 () - trying features availability update: false
[D] 09:44:52.527 0x7fd8849ad600 libs_availability:171 - py libs availability: [coqui-tts=true, faster-whisper=true, mimic3-tts=true, transformers=true, unikud=true, gruut_de=true, gruut_es=true, gruut_fa=true, gruut_fr=true, gruut_nl=true, gruut_it=true, gruut_ru=true, gruut_sw=true, mecab=true, torch-cuda=false]
[D] 09:44:52.841 0x7fd89e210d00 () - trying features availability update: true
[D] 09:44:52.841 0x7fd89e210d00 () - features availability ready
[W] 09:44:52.841 0x7fd89e210d00 has_lib:423 - failed to open libcudnn.so: libcudnn.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
[W] 09:44:52.849 0x7fd89e210d00 has_hip:79 - failed to open whisper-hipblas lib: libwhisper-hipblas.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
[D] 09:44:52.854 0x7fd89e210d00 () - updating model using availability
[D] 09:44:52.854 0x7fd89e210d00 () - updating model using availability internal
[D] 09:44:52.856 0x7fd89e210d00 () - service refresh status, new state: idle
[D] 09:44:52.856 0x7fd89e210d00 () - service state changed: busy => idle
[D] 09:44:52.856 0x7fd89e210d00 () - scan cuda: true
[D] 09:44:52.856 0x7fd89e210d00 () - scan hip: true
[D] 09:44:52.856 0x7fd89e210d00 () - scan opencl: true false
[D] 09:44:52.856 0x7fd89e210d00 add_cuda_devices:229 - scanning for cuda devices
[D] 09:44:52.856 0x7fd89e210d00 add_cuda_devices:238 - cuda version: driver=0, runtime=0
[W] 09:44:52.856 0x7fd89e210d00 add_cuda_devices:243 - cudaGetDeviceCount returned: 35
[D] 09:44:52.856 0x7fd89e210d00 add_hip_devices:266 - scanning for hip devices
[W] 09:44:52.856 0x7fd89e210d00 hip_api:170 - failed to open hip lib: libamdhip64.so: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
[D] 09:44:52.856 0x7fd89e210d00 add_opencl_devices:303 - scanning for opencl devices
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:320 - opencl number of platforms: 2
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:345 - opencl platform: 0, name=Clover, vendor=Mesa
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:359 - opencl number of devices: 1
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:383 - opencl device: 0, platform name=Clover, device name=AMD Radeon RX Vega (vega10, LLVM 15.0.7, DRM 3.54, 6.5.0-4-amd64), types=[GPU, ]
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:345 - opencl platform: 1, name=AMD Accelerated Parallel Processing, vendor=Advanced Micro Devices, Inc.
[D] 09:44:52.924 0x7fd89e210d00 add_opencl_devices:359 - opencl number of devices: 0
[D] 09:44:52.925 0x7fd89e210d00 () - service refresh status, new state: idle
[D] 09:44:52.925 0x7fd89e210d00 () - app service state: busy => idle
[W] 09:44:52.930 0x7fd89e210d00 () - no available tts models for out mnt
[W] 09:44:52.930 0x7fd89e210d00 () - invalid task, reseting task state
[D] 09:44:52.930 0x7fd89e210d00 () - app busy: true => false
[D] 09:44:52.931 0x7fd89e210d00 () - stt models changed
[D] 09:44:52.931 0x7fd89e210d00 () - update listen
[D] 09:44:52.931 0x7fd89e210d00 () - tts models changed
[D] 09:44:52.931 0x7fd89e210d00 () - update listen
[W] 09:44:52.931 0x7fd89e210d00 () - no available tts models for out mnt
[D] 09:44:52.931 0x7fd89e210d00 () - ttt models changed
[D] 09:44:52.934 0x7fd89e210d00 () - mnt langs changed
[D] 09:44:52.934 0x7fd89e210d00 () - update listen
[D] 09:44:54.312 0x7fd89e210d00 () - opening files: ("/home/user/dsnote/audio source/Z0000230.mp3")
[D] 09:44:54.837 0x7fd89e210d00 () - opening file: "/home/user/dsnote/audio source/Z0000230.mp3"
[D] 09:44:54.837 0x7fd89e210d00 init_av_in_format:347 - opening file: /home/user/dsnote/audio source/Z0000230.mp3
[E] 09:44:54.837 0x7fd89e210d00 init_av_in_format:352 - avformat_open_input error: Aucun fichier ou dossier de ce type
[W] 09:44:54.837 0x7fd89e210d00 () - failed to open file for read: "/home/user/dsnote/audio source/Z0000230.mp3"
[D] 09:45:01.326 0x7fd89e210d00 () - exiting

At first I saw that I had a space in my file path, but I tried placing the file elsewhere (in ~/tmp), and the bug persists.

mkiol commented 9 months ago

Thanks for the report.

This problem is due to sandboxing isolation. Flatpak app is able directly access only files in specific locations. Default Speech Note permissions are only for Desktop, Download, Music, Documents and Videos folders.

You can grand more locations by overriding permissions with flatpak-override. For instance, to allow Speech Note to access your all files and directories under home folder you need to execute the following command:

flatpak override net.mkiol.SpeechNote --filesystem=home

It is worth to mention that this problem does not occur when you use "Open file" menu option because, in this case, the application accesses the file via so called "XDG Portal". Portal generates, on request, a valid temporary file path to a file outside the Flatpak sandbox.

By the way, there is API spec for Drag&Drop via XDG Portal, but it is not implemented yet in QT.

mkiol commented 7 months ago

Closing the issue because the root problem is not in Speech Note but in Flatpak "permissions" architecture.