Ticket #4479 (closed defect: fixed)

Opened 17 months ago

Last modified 6 weeks ago

video & images at cli (not in an X terminal)

Reported by: glennmcc Owned by: zaytsev
Priority: minor Milestone: 4.8.33
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

pressing 'enter' on a video or image file does not play or view the file when outside of X but rather at a cli

In the older versions of mc (circa 2010 and before) it worked just fine.

In the newer versions of mc it only works when inside of X running mc within a terminal window.

My currently installed version is 4.8.29

Attachments

0001-Ticket-4479-prioritize-console-players-for-audio-vid.patch (2.8 KB) - added by zaytsev 2 months ago.
sound.sh (2.2 KB) - added by glennmcc 2 months ago.
image.sh (1.6 KB) - added by glennmcc 2 months ago.
video.sh (1.3 KB) - added by glennmcc 2 months ago.

Change History

comment:1 Changed 2 months ago by glennmcc

Both of these now work perfectly both at the cli and inside of X

comment:2 Changed 2 months ago by glennmcc

Same problem was happening with sound.sh

xdg-open works OK inside of X but not at the cli outside of X

At the cli, xdg-open is treating the file linked to within mc
just as-if it were a URL and hence sends it to the links or lynx web browser.

comment:3 Changed 2 months ago by andrew_b

9	if [ -n "$DISPLAY" ]; then
10	([ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open")
11	fi

Code in the parenthesis is run in the child shell and has no effect in the current one.

$ A=aaa
$ echo $A
aaa
$ (A=bbb)
$ echo $A
aaa
$ A=bbb 
$ echo $A
bbb

comment:4 Changed 2 months ago by glennmcc

Unless that code is either commented-out all together
or simply only run when inside of X
the result is as I said... the file is sent to links or lynx
instead of to mplayer, or fim

xdg-open simply does not work correctly when running mc completely outside of X

It does work fine running mc in a terminal window _inside_ of X

So, do I simply need to remove the parenthesis like this ?
9 if [ -n "$DISPLAY" ]; then

10 [ -n "${MC_XDG_OPEN}" ]
MC_XDG_OPEN="xdg-open"

11 fi

Version 1, edited 2 months ago by glennmcc (previous) (next) (diff)

comment:5 Changed 2 months ago by glennmcc

Yep, that fixed it.

With the parenthesis inside of X mplayer was being used even though
xine was set as the default app for mp4 files.

Removed the parenthesis and now xine is used.

And since xdg-open is not coming into play at the cli outside of X
everything works as it should and images, videos and sound files
all get opened with the correct programs and are no-longer getting sent to links or lynx.

Last edited 2 months ago by glennmcc (previous) (diff)

comment:6 follow-up: ↓ 7 Changed 2 months ago by zaytsev

Reporter: can you test? Andrew: OK?

comment:7 in reply to: ↑ 6 Changed 2 months ago by glennmcc

Replying to zaytsev:

Reporter: can you test? Andrew: OK?

Line #9 does not work but rather results only in...

/usr/libexec/mc/ext.d/image.sh: line 9: [: -n: binary operator expected

Attempting to compress it all onto one line did not work correctly
and xdg-open was still getting used at the cli outside of X

My original lines 9, 10 & 11 work correctly after removing the parenthesis.

In addition, the " && sleep 10" is needed otherwise the message will not be seen until mc is exited.

echo "Please install either fim or fbi to view this file" && sleep 10

Last edited 2 months ago by glennmcc (previous) (diff)

Changed 2 months ago by glennmcc

Changed 2 months ago by glennmcc

Changed 2 months ago by glennmcc

comment:8 Changed 2 months ago by glennmcc

All 3 scripts without parenthesis have been working perfectly for me for a week so have now been re-uploaded to here.

comment:9 Changed 8 weeks ago by zaytsev

  • Priority changed from major to minor
  • Status changed from new to accepted
  • Branch state changed from no branch to on review
  • Owner set to zaytsev
  • Milestone changed from Future Releases to 4.8.33

Branch: 4479_console_players
Initial changeset:572312bd882581fcc49b2d8e070a7f4e4179b34e

  • Added the blocks to suppress the use of xdg-open to image, audio and video scripts.
  • Added console image viewers.
  • Removed error messages with sleep.

comment:10 Changed 8 weeks ago by andrew_b

Why not use built-in command which is POSIX compatible:
How can I check if a program exists from a Bash script?

comment:11 Changed 8 weeks ago by zaytsev

Well, I didn't know about it. Thank you for the pointer, looks like a good idea. I have just replaced all occurrences that I could find.

comment:12 Changed 8 weeks ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:13 Changed 7 weeks ago by zaytsev

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:14 Changed 6 weeks ago by zaytsev

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.