Sm - mplayer wrapper with resume and more


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sm - mplayer wrapper with resume and more
# 1  
Old 05-17-2013
Sm - mplayer wrapper with resume and more

This is a wrapper I use to play media files. If I quit I can restart, a big plus.

Code:
#!/bin/bash

# Title......: sm
# Description: show media
# Author.....: Mitchell Johnston - uid 0
# Contact....: mxj_97@yahoo.com
#----------------------------------

# variables
#----------------------------------
LOG=/var/tmp/$(basename $@).out

# functions
#----------------------------------
xtitle()  ## sets window title
{ 
    printf "\033]0; [$*] \007"
}


# main
#--------------------------- 
[ ! -f $@ ] && cd ~/videos    # if no args go to main video directory
xtitle $(basename $1)  # set title to file being played
if [ -f $LOG ]         # if it has been played before restart at quit point
then
        END=$(strings $LOG|tail -4|head -1 | cut -d: -f2|cut -dV -f1)
        mplayer -ss $END -msgcolor -use-filename-title -softvol -softvol-max 300 -vo xv $@ | tee $LOG
else
        mplayer -msgcolor -use-filename-title -softvol -softvol-max 300 -vo xv $@ | tee $LOG
fi

## removes files and log
echo -n "Delete $1 ? "
read ANS
if      [ "$ANS" == "y" ] 
then
        \rm $1 $LOG
else
        echo -n "Delete $LOG ? "
        read ANS2
        [ "$ANS2" == "y" ] && \rm $LOG
fi

[ -f $1 ] && ls -l $1
[ -f $LOG ] && ls -l $LOG
clear; vids .      # This is another script that lists media files w/ play time

Let me know if you find this of use, or have questions.

bd - If you are going to tell people the truth, you had better make them laugh or they will kill you. --Oscar Wilde
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cURL auto resume

Searched here and google and couldn't find a viable solution. Is there a way to transfer a file with curl and have it automatically attempt to resume it if there's an error, broken pipe, interruption, etc? curl -C- -T myfile.tar.gz ftp.site.com --user DC_Slick:password That's what I use... (1 Reply)
Discussion started by: DC Slick
1 Replies

2. Hardware

Cannot resume from suspend with new motherboardktop, does not resume properly

I would like to get pm-suspend (or any other suspend method) working for a small new desktop computer. It is based on a Zotac GF-8200 ITX motherboard and an AMD Athlon II X@ 240 CPU using ArchLinux x86_64. The pm-suspend script works, apparently putting the machine into suspend correctly... (0 Replies)
Discussion started by: lagagnon
0 Replies

3. HP-UX

How can I resume process ?

hi every body lock at this situation and tell me your advice i tried to install patch in hp-ux v2 i used swinstall -s /path to the patch every thing was good but during the installation network connection between the server and my labtob when i connect again to the server i tried to... (2 Replies)
Discussion started by: maxim42
2 Replies

4. Solaris

Solaris resume

Hi Im in solaris field and i have one year of experience so can anyone get me a sample resume for level 1 support for solaris so that it will be easy for me to update my profile..:) (1 Reply)
Discussion started by: madanmeer
1 Replies

5. What is on Your Mind?

Are companies viewing my resume? How do I track my resume visits?

Hi everybody, I am wondering if there is any tool or website out there which can track who is viewing my resume. It is very frustrating when you send your CV or Cover Letter and you receive no feedback from the company, you don't even know if they have checked it out. Thanks for your help (1 Reply)
Discussion started by: gearyipswich
1 Replies

6. Shell Programming and Scripting

I can't resume a process after stopping it!

Hello, I have a process running, for example a "top". I send it a signal to stop it kill -s SIGSTOP 3423 It works, but when I want to resume it by kill -s SIGCONT 3423 It does not work. Help me please..... I have Fedora Core 4. Thank you (0 Replies)
Discussion started by: Nene
0 Replies

7. Solaris

ftp resume feature

Hi all , Iam looking for an FTP clinet that supports "resume feature " , that is when iam trying to get and put a file , i will check weather the process of putting and getting a file is succesful ... In case of the process fails i want to roll back everything and try to ftp againg .... I... (2 Replies)
Discussion started by: ppass
2 Replies
Login or Register to Ask a Question