Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| mplayer-resume [2013/06/28 17:42] – created beandog | mplayer-resume [2013/06/28 17:48] (current) – beandog | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== mplayer-resume ====== | ====== mplayer-resume ====== | ||
| - | '' | + | **mplayer-resume** is a PHP shell script I wrote to resume playback of files through mplayer. |
| - | Note that this code is an '' | + | Note that this code is an **archived copy** of the source code. It's unmaintained, |
| + | |||
| + | === README === | ||
| + | |||
| + | < | ||
| + | MPlayer playback / resume position script | ||
| + | |||
| + | This PHP script will save the playback position of a file | ||
| + | you watch with MPlayer. | ||
| + | again, it will resume from last playback position. | ||
| + | |||
| + | The *only* way this script will work is if you pass the | ||
| + | " | ||
| + | mapped by either LIRC or the keyboard. | ||
| + | |||
| + | The script captures the output and saves it to a file in | ||
| + | the playback directory for each media file. | ||
| + | |||
| + | See http:// | ||
| + | commands that work on both backends. | ||
| + | |||
| + | Installation: | ||
| + | |||
| + | To execute this program, either call it using the PHP | ||
| + | binary, or make it executable. Whichever you like best. :) | ||
| + | |||
| + | $ php mplayer-resume movie.avi | ||
| + | |||
| + | # cp mplayer-resume / | ||
| + | # chmod +x / | ||
| + | $ mplayer-resume --filename movie.avi | ||
| + | |||
| + | The script should parse any arguments that you want to send | ||
| + | mplayer at the same time, regardless of whether you start | ||
| + | it as a standalone program or with php. | ||
| + | |||
| + | Standalone: | ||
| + | $ mplayer-resume --filename movie.avi -vo xv | ||
| + | |||
| + | With php: | ||
| + | $ php mplayer-resume --filename movie.avi -vo xv | ||
| + | |||
| + | Syntax: | ||
| + | |||
| + | mplayer-resume --filename < | ||
| + | |||
| + | As of v2.0, the syntax has changed. | ||
| + | would attempt to guess the correct filename, but in cases of movies | ||
| + | with spaces in the file, it would cause problems. | ||
| + | define the filename manually with the --filename argument. | ||
| + | |||
| + | MPlayer optional arguments: | ||
| + | |||
| + | You can still pass all the normal arguments you would normally use | ||
| + | when running mplayer. | ||
| + | after mplayer-resume has added it's own. | ||
| + | |||
| + | $ mplayer-resume --filename "My movie.mkv" | ||
| + | |||
| + | The *only* extra arguments that this script will add to your | ||
| + | mplayer command is -ss to seek to resume a file, and | ||
| + | -quiet so it can correctly grab the output. | ||
| + | |||
| + | The script will also strip out any commands that are known to | ||
| + | break the output. | ||
| + | " | ||
| + | |||
| + | Optional arguments: | ||
| + | |||
| + | Currently, mplayer-resume only supports one extra argument, a | ||
| + | small feature added to the script to scratch a personal itch of mine. | ||
| + | |||
| + | Passing --use-dir-conf to mplayer-resume will look for a file named | ||
| + | " | ||
| + | and if one exists, it will pass " | ||
| + | binary. | ||
| + | |||
| + | This is just a little workaround to add a feature that mplayer doesn' | ||
| + | currently implement. :) | ||
| + | |||
| + | LIRC: | ||
| + | |||
| + | Setup your ~/.lircrc file to do three things when you hit | ||
| + | the stop button: | ||
| + | |||
| + | 1) Get the time position | ||
| + | 2) Get the filename | ||
| + | 3) Stop playing | ||
| + | |||
| + | Here' | ||
| + | |||
| + | begin | ||
| + | prog = mplayer | ||
| + | button = stop | ||
| + | config = get_time_pos | ||
| + | end | ||
| + | begin | ||
| + | prog = mplayer | ||
| + | button = stop | ||
| + | config = get_filename | ||
| + | end | ||
| + | begin | ||
| + | prog = mplayer | ||
| + | button = stop | ||
| + | config = quit | ||
| + | end | ||
| + | |||
| + | You can of course map any button on your remote that you'd like | ||
| + | to use this function for. | ||
| + | |||
| + | Keyboard: | ||
| + | |||
| + | Map a key with ~/ | ||
| + | |||
| + | Sample entry: | ||
| + | |||
| + | g get_time_pos | ||
| + | |||
| + | When you want to save the position, hit ' | ||
| + | to quit playback. | ||
| + | |||
| + | You can also do it manually using mplayer' | ||
| + | which is useful for debugging: | ||
| + | |||
| + | $ mplayer -slave -quiet movie.avi | ||
| + | get_time_pos | ||
| + | quit | ||
| + | |||
| + | Configuration: | ||
| + | |||
| + | This script will save a text file for each media file you | ||
| + | watch using this script. | ||
| + | config variable $save_files_to defined in the script, which | ||
| + | must be a directory that this script can read / write to. | ||
| + | |||
| + | The script will try to automatically create a directory, and | ||
| + | uses / | ||
| + | |||
| + | MythTV: | ||
| + | |||
| + | If you are using MythVideo (http:// | ||
| + | use mplayer-resume as your playback script instead of mplayer, | ||
| + | it's easy to setup. | ||
| + | |||
| + | From the main menu, go to: | ||
| + | |||
| + | Utilities/ | ||
| + | Video Settings | ||
| + | Player Settings | ||
| + | |||
| + | Change the entry for Default Player to: | ||
| + | |||
| + | mplayer-resume %s | ||
| + | |||
| + | Please note that you *do not* need to put quotes around the | ||
| + | filename (as of v0.20.x), as MythTV will do it by itself. | ||
| + | |||
| + | You can of course add any other extra MPlayer arguments as you | ||
| + | normally may here. | ||
| + | |||
| + | mplayer-resume -fs -vo xv -aspect 16/9 %s | ||
| + | |||
| + | Notes: | ||
| + | |||
| + | If your CLI version of PHP is dumping version information | ||
| + | each time it runs, add -q to the top line to supress the | ||
| + | output. | ||
| + | |||
| + | # | ||
| + | |||
| + | Bugs: | ||
| + | |||
| + | Doesn' | ||
| + | entry per filename | ||
| + | |||
| + | Help: | ||
| + | |||
| + | If you get stuck, don't hesitate to contact me. | ||
| + | |||
| + | http:// | ||
| + | </ | ||
| == mplayer-resume 2.0 == | == mplayer-resume 2.0 == | ||
| Line 267: | Line 447: | ||
| } | } | ||
| ?> | ?> | ||
| + | </ | ||
| + | |||
| + | === ChangeLog === | ||
| + | |||
| + | < | ||
| + | 2.0 (2009-08-11) | ||
| + | |||
| + | - Add --filename argument to specify filename directly, instead | ||
| + | of trying to guess what it is. | ||
| + | - Add optional argument --use-filedir-conf, | ||
| + | in local directory, and pass -include mplayer.conf to mplayer. | ||
| + | |||
| + | 1.6 (2008-12-16) | ||
| + | |||
| + | - Check exit codes on mplayer, so that if mplayer quits | ||
| + | unexpectedly, | ||
| + | - Send exit codes | ||
| + | |||
| + | 1.5 (2008-01-12) | ||
| + | |||
| + | - Allow spaces in filenames. | ||
| + | - Get the filename from MPlayer on exit, and use that to save | ||
| + | the file to. Useful for playlists. | ||
| + | |||
| + | 1.3 (2006-09-15) | ||
| + | |||
| + | - Call env instead of php directly | ||
| + | - Get $HOME environment variable to save files to | ||
| + | |||
| + | 1.2 | ||
| + | |||
| + | - Documentation updates | ||
| </ | </ | ||