cboxdoerfer / fsearch

A fast file search utility for Unix-like systems based on GTK3
GNU General Public License v2.0
3.27k stars 207 forks source link

[BUG] FSearch doesn't open audio/video files in Celluloid if file open behavior is "Close" #387

Closed kimimaru4000 closed 2 years ago

kimimaru4000 commented 2 years ago

Describe the bug When searching files in FSearch, if I attempt to open an audio or video file, via keyboard or double-clicking, the file doesn't open in Celluloid. I narrowed down the situation, and it happens only if the Behaviour after successfully opening a file setting is set to Close.

Opening other files works, and if I navigate to the folder with the media file and try to open it in the file manager, it opens. Oddly enough, it's only in FSearch and with Celluloid where it doesn't open.

This used to work in previous versions of FSearch. It stopped for me with version 0.2. My Celluloid version is 0.21.

To Reproduce Steps to reproduce the behavior:

  1. Set Behaviour after successfully opening a file in Preferences to Close, and check the with keyboard shortcuts or menu entries and with double click boxes.
  2. Set Celluloid as your default audio and video player.
  3. Search for an audio (Ex. ogg) or video (Ex. ogv, mp4) file to open.
  4. Try to open the file, either by double-clicking or with a keyboard shortcut (Ex. Enter/Return).
  5. Observe that the file doesn't open in Celluloid.

Expected behavior The file opens in Celluloid.

Screenshots N/A

Desktop (please complete the following information):

Additional context I reverted a failed Mint 21 upgrade and I noticed a few things were out of whack. I'm not 100% sure if this bug is caused by that or the new FSearch version.

cboxdoerfer commented 2 years ago

Thx for the bug report. Can you do the following?

Ideally the terminal should show something like this:

(fsearch:45261): fsearch-utils-DEBUG: 20:06:58.539: [open] opening file/folder:
uri: "file:///home/test/test.mp4"
content type: "video/mp4"
application: "Celluloid"
cmd: "/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=celluloid --file-forwarding io.github.celluloid_player.Celluloid @@u %U @@"
kimimaru4000 commented 2 years ago

Here's the output:

placeholder@placeholder:~$ env G_MESSAGES_DEBUG=fsearch-utils fsearch
Gtk-Message: 21:46:16.585: Failed to load module "appmenu-gtk-module"
activate fsearch
(fsearch:106349): fsearch-utils-DEBUG: 21:46:24.129: [open] opening file/folder:
uri: "file:///home/placeholder/Test.mp3"
content type: "audio/mpeg"
application: "Celluloid"
cmd: "celluloid %U"
placeholder@placeholder:~$ env G_MESSAGES_DEBUG=fsearch-utils fsearch
Gtk-Message: 21:46:37.452: Failed to load module "appmenu-gtk-module"
activate fsearch
(fsearch:106481): fsearch-utils-DEBUG: 21:46:43.952: [open] opening file/folder:
uri: "file:///home/placeholder/log.txt"
content type: "text/plain"
application: "Text Editor"
cmd: "xed %U"
cboxdoerfer commented 2 years ago

Thx for the output, everything looks fine there. Unfortunately I can't reproduce the issue on my system or in a virtual machine, which makes debugging this issue a bit more complicated. So a few more questions:

cboxdoerfer commented 2 years ago

Oh nevermind, I've managed to reproduce the issue. Can you confirm that the issue stops when you uncheck the "with keyboard shortcuts and menu entries" setting in the behavior after opening settings?

kimimaru4000 commented 2 years ago

Yes, the issue stops if I uncheck the options that cause FSearch to close after opening a file. However, my intention is to close FSearch when opening the file.

cboxdoerfer commented 2 years ago

Yes, now that I can reproduce the issue (it seems to be some kind of race condition, which means it likely varies between different hardware setups), I can investigate that. I'll report back to you once I've figured out the root cause and hopefully a fix.

kimimaru4000 commented 2 years ago

I found something new: if Celluloid is already open, opening the file from FSearch works just fine. So on my machine at least, this bug affects the case only in which Celluloid is not already opened.

cboxdoerfer commented 2 years ago

Thx, I think I've fixed the issue. The patch just needs some more minor work (comments, getting rid of debug output, ...). So by tomorrow you should be able to get your hands on it, to test if everything works as expected.

cboxdoerfer commented 2 years ago

I have just pushed the potential fix to master. Can you try this out? You'd either have to use the daily PPA, which will have the new build within the next 24 hours:

daily PPA

Install the daily PPA and new FSearch package:

sudo apt remove fsearch
sudo add-apt-repository ppa:christian-boxdoerfer/fsearch-daily
sudo apt update
sudo apt install fsearch

Then run or restart FSearch and try if everything works as expected.

To revert back to the stable PPA simply run:

sudo apt remove fsearch
sudo add-apt-repository --remove ppa:christian-boxdoerfer/fsearch-daily
sudo apt update
sudo apt install fsearch

or you can also build it yourself

build it yourself:

sudo apt install git build-essential meson libtool pkg-config intltool libicu-dev libpcre3-dev libglib2.0-dev libgtk-3-dev libxml2-utils
cd ~
git clone https://github.com/cboxdoerfer/fsearch.git
cd fsearch
meson builddir
ninja -C builddir && builddir/src/fsearch

The last command will launch FSearch, so make sure FSearch is not already running. To remove the test build you can simply delete the fsearch directory in your home directory.

kimimaru4000 commented 2 years ago

I opted to build from source, and it fixes the issue! Many thanks for looking into this and solving it so quickly!

cboxdoerfer commented 2 years ago

I opted to build from source, and it fixes the issue! Many thanks for looking into this and solving it so quickly!

Awesome! No problem and thanks for reporting the issue and testing the patch! I will create a 0.2.2 release in the next couple of days with the fix, which will then land in the stable PPA.

cboxdoerfer commented 2 years ago

FYI, 0.2.2 with the fix was just released and should be in the stable PPA in a few hours.