You are not logged in.

#226 2022-12-24 11:16:13

hully
Member
Registered: 2022-11-14
Posts: 161

Re: mimeo: open files by mimetype or file name

@Xyne

Thank you

1. The link in the first post of this thread (http://xyne.archlinux.ca/projects/mimeo) doesn't work anymore. The new link seems to be https://xyne.dev/projects/mimeo/.

2. Is there a (git or other VCS) repository for mimeo?

Offline

#227 2022-12-28 14:54:15

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: mimeo: open files by mimetype or file name

hully wrote:

1. The link in the first post of this thread (http://xyne.archlinux.ca/projects/mimeo) doesn't work anymore. The new link seems to be https://xyne.dev/projects/mimeo/.

Fixed, thanks.

hully wrote:

2. Is there a (git or other VCS) repository for mimeo?

It's on the way. I'm working through a TODO list for moving all of my projects to Gitlab and moving the website to Hugo but it's been slow due to limited free time.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#228 2023-01-09 09:35:22

hully
Member
Registered: 2022-11-14
Posts: 161

Re: mimeo: open files by mimetype or file name

Thanks.

How does mimeo infer mimetype?

I have STATA scripts with .do extension. They are text files to be opened with STATA.

Sometimes mimeo infer "text/x-csrc", but sometimes it infer "text/plain"

Offline

#229 2023-01-09 20:27:05

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: mimeo: open files by mimetype or file name

It uses Python's built-in MIME-types module and the "file" command, with an optional dependency on the "shared-mime-info" package.
Are you getting different results for the same file on the same system?
You could also try using regular expressions to obtain consistent results via the configuration file. See "mimeo --assoc-help" for details.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#230 2023-01-21 03:04:55

iojeda
Member
Registered: 2018-11-23
Posts: 4

Re: mimeo: open files by mimetype or file name

Hi @Xyne
Thanks for this amazing piece of software.
I was trying to do the vlc example in the documentation but I don't really understand how to do it.
I do apologize if this questions are too stupid but I don't understand how to configure mimeo properly

In Association File Examples you have this

vlc --one-instance --playlist-enqueue %U
  ^https?://(www.)?youtube.com/watch\?.*v=

I have added that to ~/.config/mimeo/associations.txt

But still can't open youtube links with vlc. What am I missing?

Last edited by iojeda (2023-01-21 03:06:00)

Offline

#231 2023-01-21 09:10:36

progandy
Member
Registered: 2012-05-17
Posts: 5,266

Re: mimeo: open files by mimetype or file name

What do you expect to happen?
This configuration is only for the mimeo command itself.
If you want to handle clicking a link in another application, then most should work if you replace xdg-open (e.g. install xdg-utils-mimeo from the AUR).
Browsers themselves do not ask the system how to open links, so for those you need to install addons.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#232 2023-02-17 10:06:03

hully
Member
Registered: 2022-11-14
Posts: 161

Re: mimeo: open files by mimetype or file name

I am reading `mimeo --filepath-help`

> Pass en empty argument to disable the check"

"en" should be "an".

What does it mean to disable the check? That `$HOME/.config/mimeo/associations.txt` is not read even if present?

> --term 'urxvt -e %s' --deprecated"

The double quote at the end should be removed

Offline

#233 2023-02-26 03:19:02

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: mimeo: open files by mimetype or file name

hully wrote:

What does it mean to disable the check? That `$HOME/.config/mimeo/associations.txt` is not read even if present?

Yes, the empty path will skip reading existing associations files (the previous sentence states that mimeo will check files for associations).

I have changed it to "Pass an empty string to skip existing files." and fixed the errors that you mentioned for the next release. Thanks for the feedback!


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#234 2023-03-28 19:31:07

tleydxdy
Member
Registered: 2017-10-11
Posts: 21

Re: mimeo: open files by mimetype or file name

I found a bug when I was trying to use /etc/xdg/mimeo/associations.txt instead of ~/.config/mimeo/associations.txt
in Mimeo.py:1291 the code uses the exception as hint that it shoud try the next config file location, but in Mimeo.py:497 the exception is catched to print a debug message, so mimeo would only ever check the ~/.config location

Offline

#235 2023-04-10 20:12:12

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: mimeo: open files by mimetype or file name

tleydxdy wrote:

I found a bug when I was trying to use /etc/xdg/mimeo/associations.txt instead of ~/.config/mimeo/associations.txt
in Mimeo.py:1291 the code uses the exception as hint that it shoud try the next config file location, but in Mimeo.py:497 the exception is catched to print a debug message, so mimeo would only ever check the ~/.config location

Fixed, thanks. A new version should be up shortly.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#236 2023-04-23 20:15:52

ectospasm
Member
Registered: 2015-08-28
Posts: 292

Re: mimeo: open files by mimetype or file name

@Xyne

I use mimeo in a zsh shell function, like so:

open () {
    mimeo "${@}" &
}

With the previous version (2022.7-3), this used to work, and didn't leave background jobs running (if there were any stderr/stdout output of the commands, it would appear in the shell, but otherwise wouldn't interfere with my usage of that shell). 

Now, in version 2023, it keeps the background job running (as if mimeo no longer forks, or whatever its previous behavior was), and at least with mplayer (after using open() to open an MP4 file), it suspends the job.  If I bring that job to the forground (e.g. with `fg` or `fg %1`, etc.) I can no longer use that shell.  And at least for mplayer, if it gets any input from stdin, it exits MPlayer.  From what I can tell, mimeo no longer forks (or whatever the process is called), it runs in the foreground where it used to not do that.

I use mimeo through this open() shell function heavily, to launch GUI programs without having to first fire up the GUI program and navigate to the file I want to open.  With version 2023, my usage is completely broken, and it's not clear from the changelog what changed (the changelog on the main mimeo page only has the last updaet from 2021).  I don't know where to begin looking for why it appears to be broken.  The ampersand in open() appears to suspend the GUI program, which is definitely not what I want.

I've tried inserting nohup in my open() shell function, but that has unsatisfactory results (namely, the shell job is still running).  I've also removed the ampersand (for sending the shell command to the background), but that keeps me from using that shell entirely until the program launched through mimeo/open() is closed.  Basically, I don't want to be able to kill any programs launched with mimeo via this open() function using standard shell job control. I want to be able to close the window, or find the PID using `ps`, etc., to stop the launched program.

Downgrading to 2022.7-3 seems to fix it, for now.  Any ideas?

Offline

#237 2023-05-07 03:11:29

rEnr3n
Member
Registered: 2012-07-25
Posts: 39

Re: mimeo: open files by mimetype or file name

Traceback (most recent call last):
  File "/usr/bin/mimeo", line 5, in <module>
    from Mimeo import run_main
ModuleNotFoundError: No module named 'Mimeo'

The package on your repo needs rebuild. python 3.11 is already out.

Edit: AUR package needs bump too.

Last edited by rEnr3n (2023-05-07 08:17:21)

Offline

#238 2023-10-12 14:55:44

diniamo
Member
Registered: 2022-06-15
Posts: 107

Re: mimeo: open files by mimetype or file name

xdg-settings get default-url-scheme-handler (<app>) fails:

❯ xdg-settings get default-url-scheme-handler
xdg-settings: default-url-scheme-handler not implemented for mimeo
❯ xdg-settings get default-url-scheme-handler obsidian
xdg-settings: default-url-scheme-handler not implemented for mimeo

I'm trying to run the command because Obsidian gave me the same error message before crashing:

xdg-settings: default-url-scheme-handler not implemented for mimeo
[15956:1012/165324.160987:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[15956:1012/165324.161035:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[15956:1012/165324.161045:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[15956:1012/165324.161051:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[15956:1012/165324.198180:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type: 
2023-10-12 14:

Note that I use the xdg-desktop-portal-hyprland package, but I don't think that should affect anything, because the normal xdg-desktop-portal package is one of its dependencies, which leads me to assume that it's just an extension.

Offline

#239 2024-04-30 09:26:20

raffaem
Member
Registered: 2023-07-04
Posts: 22

Re: mimeo: open files by mimetype or file name

@Xyne could this be uploaded to PyPi? I have problems with Python dependencies and by uploading this on PyPI I could install it in a virtual environment easily

Last edited by raffaem (2024-04-30 13:38:12)

Offline

#240 2024-05-07 23:51:07

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: mimeo: open files by mimetype or file name

raffaem wrote:

@Xyne could this be uploaded to PyPi? I have problems with Python dependencies and by uploading this on PyPI I could install it in a virtual environment easily

I'm on the process of cleaning up my projects, properly packaging them and putting them up on GitLab. As soon as that's done I will push everything worthwhile to PyPI.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB