GiorgosXou / TUIFIManager

A cross-platform terminal-based termux-oriented file manager (and component), meant to be used with a Uni-Curses project or as is.
GNU General Public License v3.0
688 stars 13 forks source link

Add xdg-open as Default External Opener on media formats #9

Closed RaghavRao closed 2 years ago

RaghavRao commented 2 years ago

xdg-open (or termux-open) would be a good fall back for mp3, mp4 etc.

Also the OGG profile has a typo (.ogv)

GiorgosXou commented 2 years ago

xdg-open (or termux-open) would be a good fall back for mp3, mp4 etc.

I didn't know about xdg-open, now finally I can add start for Windows, open for macOS and xdg-open for Linux.

Also the OGG profile has a typo (.ogv)

Indeed, thanks for the catch! (.ogv extension's icon\profile must be changed to OGV)

From discord:

Tried this but failed with "Permission denied for /lib"?? ... I added a try except block for Permission Error, which fixed it.

where you've added the try except block?

RaghavRao commented 2 years ago

Sorry the permission error is a problem with uni-curses. I added it in line 96 of __init__.py of unicurses:


for p in paths:
  if os.path.exists(p):
    try:
      for file in os.listdir(p):
        if re.search(r'(libncursesw)\.so\.\d+(\.\d+)*$', file):
          version = file.split('so.')[1] 

          if LooseVersion(version) > LooseVersion(latest_version):
            lib_paths = [p + '/libncursesw.so.' + version, p + '/libpanelw.so.' + version]
            latest_version = version
    except PermissionError as e:
      print(str(e))

Output of diff:

96,102c96,99
<                 for file in os.listdir(p):
<                     if re.search(r'(libncursesw)\.so\.\d+(\.\d+)*$', file):
<                         version = file.split('so.')[1]
<
<                         if LooseVersion(version) > LooseVersion(latest_version):
<                             lib_paths = [p + '/libncursesw.so.' + version, p + '/libpanelw.so.' + version]
<                             latest_version = version
---
>                 try:
>                     for file in os.listdir(p):
>                         if re.search(r'(libncursesw)\.so\.\d+(\.\d+)*$', file):
>                             version = file.split('so.')[1]
103a101,105
>                             if LooseVersion(version) > LooseVersion(latest_version):
>                                 lib_paths = [p + '/libncursesw.so.' + version, p + '/libpanelw.so.' + version]
>                                 latest_version = version
>                 except PermissionError as e:
>                     print(str(e))