Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently switched to linux from windows and currently I watch the movies in Totem Movie Player. Everything is fine but I miss two features.
1. On windows, I can set Media Player Classic to shut down the computer when it finishes to play the movie/playlist.
2. Also there is a sound "normalization" option, which "lowers" the sound volume for the louder moments in the movie and then restores it back.
Is there any movie player for linux with such features, or at least with the first one available?
For your first question, you could always run your media player, with the options you need and the file you want played, from a terminal, and append the poweroff command at the end, as such:
Code:
mplayer <options> file_to_play.avi && poweroff
As far as your second question, I know for sure that VLC has the option for sound normalization.
For your first question, you could always run your media player, with the options you need and the file you want played, from a terminal, and append the poweroff command at the end, as such:
For your first question, you could always run your media player, with the options you need and the file you want played, from a terminal, and append the poweroff command at the end
An excellent suggestion; I recommend you do that if possible.
There exists an another approach. For example, you might want to shut down only after all programs in a specific set have all exited. In this case, you'd use a script, which regularly checks the process list, and if there are none of the required processes running, it shuts down the machine.
Such a script is very simple to write. This one takes the list of commands (to watch) as command line parameters. If you supply none, it does nothing.
Code:
#!/bin/bash
# Interval in seconds to wait between checks
SECONDS="5"
# Do nothing if no commands specified.
[ $# -gt 0 ] || exit 0
# Construct a ps command:
CMD=(ps)
while [ $# -gt 0 ]; do
CMD=("${CMD[@]}" "-C" "$1")
shift 1
done
CMD=("${CMD[@]}" "-o" "pid=")
# Use a background subshell
(
# Check until no processes found.
while [ -n "$(${CMD[@]})" ]; do
sleep $SECONDS
done
# Shutdown
poweroff
) &
For example, if you save the above as poweroff-without , and set it executable with chmod 0755 poweroff-without then running
Code:
./poweroff-without mplayer firefox-bin
will shut down your computer when neither mplayer nor firefox are running. It checks every five seconds, so allow for a five-second delay, though.
Scripts like that can be extended easily. For example, you might want it to cancel the poweroff completely, if you run some other command -- say in case you forgot the poweroff was activated.
If this is a recurring use case (I mean with many programs), it should be a rather simple but fun exercise to write a GTK+ Python/Ruby/Perl/C++ tool or widget, which presents a menu of running (and non-running known) programs you could select. There might be people in the Programming forum willing to help write such a program. (Just use the external 'ps' command to do the process listing and checking, and the rest is quite simple.)
Hey Rod, that's a good one too. I have a script somewhat similar to that within one of my backups, I should find it and post it up. Honestly, to the OP, he could do whatever he would like, but as far as running multiple commands, your script would be an easier way, due to the fact that using && with other commands would need to finish executing the first command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.