Updated: Nov 10, 2009 - Updates to the mplayerstart script can now be found at
http://igurublog.wordpress.com/downl...-mplayerstart/
The versions and descriptions below are outdated.
Here is an updated version of the mplayerstart script that adds some
functionality to the previous one posted here. I'm sharing this here in case
others want to use it, or use bits of the code in their own scripts.
mplayerstart is a wrapper script for mplayer which allows the user to resume
playback of a previously played file, supports a tv-out mode, disables the KDE
screensaver, and a few other things. This version adds a check to see if KDE is
running, kmix volume level restoration for each resumed file, support for
resuming audio files, automatic playback of the last played file, and acceptance
of .resume files on the command line.
Just save this bash script, make it executable (chmod ugo+x mplayerstart), and
use it to open media files. If you make an application shortcut to it or add it
to the K menu, you can then associate it with avi and other media files in the
file manager. Then you can just click on the movie or music file to have
resumable playback (very slick).
The only thing this script requires is a folder to store the resume files (a few
bytes each) and to temporarily store mplayer console output (which can be a few
dozen MB, and is deleted when playing the movie is finished). By default, the
script uses the folder ~/.mplayerstart/ for this data.
What mplayerstart does:
* This version first checks to see if KDE (kdesktop) is running. If it isn't,
it skips the KDE features automatically.
* mplayerstart plays the media file specified, and when you quit mplayer, saves
a .resume file which records where playback was stopped, as well as the kmix
volume levels in use when playback was stopped. mplayerstart also disables the
KDE screensaver while playing video files.
* The next time mplayerstart opens a file with the same name as the above media
file (regardless of location), it can resume playback, and also set the kmix
volume levels to their last used level for this file.
* mplayerstart can also automatically resume the last played file.
* When using the --tv switch, mplayerstart will create an X :1 session and send
mplayer's output there, which is useful for NVidia (and other?) video cards with
TV-Out. Just set up your xorg.conf file as described here:
http://en.wikibooks.org/wiki/NVidia/TV-OUT
Usage:
plays the movie from the resume point (if any) and creates a new resume point.
If you save the above command (mplayerstart --resume) as an application shortcut
or add it to the K menu, you can then associate it with avi and other media
files in the file manager for one-click resume.
If you leave out the --resume switch as shown above, mplayerstart will begin
playback at the beginning of the media file and will create a new resume point
when finished.
plays the last played media file from the resume point (if any) and creates a
new resume point. If you save the above command as an application shortcut or
add it to the K menu, you can then associate it with a keyboard shortcut (I use
Windows-R) to quickly resume playback.
passes a .resume file for playback. If you associate .resume files with the
above command, this allows you to browse the folder of resumeable files (found
in ~/.mplayerstart/ by default) and click on a .resume file. If mplayerstart
can't find the media file in it's last known location, it will search up to two
folders recursively (configure these folders in the script).
Notes:
* mplayerstart plays video files in full screen mode without a GUI. To quit
playback press 'q'. For other keyboard shortcuts consult 'man mplayer'.
* Audio files are played back in GUI mode. When the audio file is done playing,
press 'q' or close mplayer. The .resume file will not be saved until you quit
mplayer.
* You can customize the location of mplayerstart's .resume files in the script
at the top of the file (just load the script into a text editor).
* After playback, mplayerstart will not re-enable the KDE screensaver if other
mplayer's are still running.
* This new version of mplayerstart will read the .resume files created by prior
versions, but will save .resume files which are NOT compatible with the prior
version. You may want to backup your resume folder before testing this version.
Tips:
* If you want to quit mplayer without saving the resume point, press Page-Up
repeatedly until mplayer quits. (PageUp fast-forwards 10 minutes - thus the end
of file will be reached and no resume point will be saved.)
The script:
Please use the updated script at
http://igurublog.wordpress.com/downl...-mplayerstart/
http://igurublog.wordpress.com/downl...-mplayerstart/
The versions and descriptions below are outdated.
Here is an updated version of the mplayerstart script that adds some
functionality to the previous one posted here. I'm sharing this here in case
others want to use it, or use bits of the code in their own scripts.
mplayerstart is a wrapper script for mplayer which allows the user to resume
playback of a previously played file, supports a tv-out mode, disables the KDE
screensaver, and a few other things. This version adds a check to see if KDE is
running, kmix volume level restoration for each resumed file, support for
resuming audio files, automatic playback of the last played file, and acceptance
of .resume files on the command line.
Just save this bash script, make it executable (chmod ugo+x mplayerstart), and
use it to open media files. If you make an application shortcut to it or add it
to the K menu, you can then associate it with avi and other media files in the
file manager. Then you can just click on the movie or music file to have
resumable playback (very slick).
The only thing this script requires is a folder to store the resume files (a few
bytes each) and to temporarily store mplayer console output (which can be a few
dozen MB, and is deleted when playing the movie is finished). By default, the
script uses the folder ~/.mplayerstart/ for this data.
What mplayerstart does:
* This version first checks to see if KDE (kdesktop) is running. If it isn't,
it skips the KDE features automatically.
* mplayerstart plays the media file specified, and when you quit mplayer, saves
a .resume file which records where playback was stopped, as well as the kmix
volume levels in use when playback was stopped. mplayerstart also disables the
KDE screensaver while playing video files.
* The next time mplayerstart opens a file with the same name as the above media
file (regardless of location), it can resume playback, and also set the kmix
volume levels to their last used level for this file.
* mplayerstart can also automatically resume the last played file.
* When using the --tv switch, mplayerstart will create an X :1 session and send
mplayer's output there, which is useful for NVidia (and other?) video cards with
TV-Out. Just set up your xorg.conf file as described here:
http://en.wikibooks.org/wiki/NVidia/TV-OUT
Usage:
Code:
mplayerstart --resume movie.avi
If you save the above command (mplayerstart --resume) as an application shortcut
or add it to the K menu, you can then associate it with avi and other media
files in the file manager for one-click resume.
Code:
mplayerstart movie.avi
playback at the beginning of the media file and will create a new resume point
when finished.
Code:
mplayerstart --resumelast
new resume point. If you save the above command as an application shortcut or
add it to the K menu, you can then associate it with a keyboard shortcut (I use
Windows-R) to quickly resume playback.
Code:
mplayerstart movie.resume
above command, this allows you to browse the folder of resumeable files (found
in ~/.mplayerstart/ by default) and click on a .resume file. If mplayerstart
can't find the media file in it's last known location, it will search up to two
folders recursively (configure these folders in the script).
Notes:
* mplayerstart plays video files in full screen mode without a GUI. To quit
playback press 'q'. For other keyboard shortcuts consult 'man mplayer'.
* Audio files are played back in GUI mode. When the audio file is done playing,
press 'q' or close mplayer. The .resume file will not be saved until you quit
mplayer.
* You can customize the location of mplayerstart's .resume files in the script
at the top of the file (just load the script into a text editor).
* After playback, mplayerstart will not re-enable the KDE screensaver if other
mplayer's are still running.
* This new version of mplayerstart will read the .resume files created by prior
versions, but will save .resume files which are NOT compatible with the prior
version. You may want to backup your resume folder before testing this version.
Tips:
* If you want to quit mplayer without saving the resume point, press Page-Up
repeatedly until mplayer quits. (PageUp fast-forwards 10 minutes - thus the end
of file will be reached and no resume point will be saved.)
The script:
Please use the updated script at
http://igurublog.wordpress.com/downl...-mplayerstart/
Comment