Sponsored Content
Top Forums Shell Programming and Scripting Sm - mplayer wrapper with resume and more Post 302808829 by dragon-uid0 on Friday 17th of May 2013 03:22:45 PM
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
 

7 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

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. 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

6. 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

7. 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
IPFM.CONF(5)							File Formats Manual						      IPFM.CONF(5)

NAME
ipfm.conf - IP Flow Meter configuration file DESCRIPTION
ipfm.conf is ipfm(8) configuration file. A hash mark (``#'') indicates that the end of the line is a comment and it will be ignored. The configuration rules will be interpreted from the end, and the first matching rule will be used, unless specified here. IPFM uses local and global variables, so it can manage multiple logs (different time delay, different hosts, different log filename ...) at the same time. Global variables will be used for all logs and local variables will only be used in the log being defined. GLOBAL VARIABLES
NETWORK DEVICE Syntax : DEVICE <device-name> <device-name> is the device on witch ipfm will log packets. IPFM monitors only one device. Time Coordinates Syntax : [UTC|local] This decides if IPFM will use UTC or local time in its outputs (log filename and the timestamp inside the file). Default is local. Note that IPFM works internally with UTC, and that the dates entered in the config file are UTC (see AFTER Syntax). NEW LOG Syntax : NEWLOG This creates a new log entry, where you can define new local variables. LOCAL VARIABLES
HOSTS TO LOG ipfm logs only specified hosts. Syntax: LOG [[NONE|FROM|TO|BOTH] <host>] [[NOT] WITH <host>] NONE do not log anything from or to this <host> FROM do log packets from this <host> TO do log packets to this <host> BOTH (default) do log packets from and to this <host> <host> can be : x.x.x.x : an IP. x.x.x.x/x.x.x.x : an IP followed by a subnet mask. WITH specifies if the packet is ignored (NOT WITH) or logged (WITH), in function of the second IP present in the packet. Examples : LOG 10.10.10.0/255.255.255.0 NOT WITH 10.10.10.1 will log any packets from or to hosts in subnet 10.10.10.0/255.255.255.0, except packets involving host 10.10.10.1 . LOG WITH 10.10.10.23 will log any packets in relation with host 10.10.10.23 LOG will log everything. OUTPUT TIME DELAY ipfm outputs its statistics every fixed period, with the ability to fix an exact time origin and offset, in Coordinated Universal Time (UTC). Syntax: DUMP EVERY <time> [AFTER <time>] <time> is composed of : <number> second(s) <number> minute(s) <number> hour(s) <number> day(s) Default DUMP time is 24 hours Default AFTER time is 0 seconds Examples: DUMP EVERY 30 minutes will dump the stats every 30 minutes at x:00 and x:30. DUMP EVERY 1 hour AFTER 7 minutes will dump the stats every hour, at 0:07, 1:07, 2:07, and so on, regardless of the time at which ipfm was launched. DUMP EVERY 1 day AFTER 14 hours will dump data every day, at 14:00:00 UTC (for France localtime (during the summer), at 16:00:00 +0200) CLEARING STATS You may want to clear your statistics sometimes, or after each dump. Syntax : CLEAR [ ALWAYS | NEVER | EVERY <time> [AFTER <time>] ] <time> is composed of : <number> second(s) <number> minute(s) <number> hour(s) <number> day(s) Default CLEAR mode is ALWAYS. Default AFTER time is 0 seconds. Note that both time values MUST be a multiple of the DUMP delay. Also, this line MUST come after the DUMP line. Examples CLEAR ALWAYS will clear the stats after every DUMP. CLEAR NEVER will never clear the stats, which means you are doing incremental statistics. CLEAR EVERY 30 minutes will clear the stats every 30 minutes at x:00 and x:30. Note that if your DUMP line had an AFTER value such as 3 minutes, this rule will clear the stats at x:03 and x:33. CLEAR EVERY 1 hour AFTER 10 minutes will clear the stats every hour, at 0:10, 1:10, 2:10, and so on. Note that if your DUMP line had an AFTER value such as 3 minutes, this rule will clear the stats at 0:13, 1:13, 2:13 and so on. LOG FILENAME Every delay, ipfm writes its output into a file, which name is specified by the rule FILENAME Syntax: FILENAME <filemask> <filemask> is a quoted string (eg. "/path/to/filename") that is parsed using strftime(3) syntax. Default FILENAME is /var/log/ipfm/%d-%b.%H-%M NOTE : The file will be overwritten without any check. REVERSE DNS You can activate or deactivate reverse DNS in the output file. WARNING : activating reverse DNS can delay a lot the production of the log file, due to DNS timeouts. Syntax : [RESOLVE|NORESOLVE] Default is NORESOLVE SORT OUTPUT FILE ipfm can sort output file depending on IN, OUT or TOTAL. Syntax : SORT IN|OUT|TOTAL Default is to sort nothing. Please note that this option could delay a bit the production of the log file. SET PROMISCUOUS MODE You can choose to log all packets on the network (default) or only packets which destination is your network device. This option could also be useful if you wish to set the promiscuous mode yourself (ifconfig eth0 [-]promisc), as the promisc mode is very badly handled under Linux. Please note that under Linux, if you run a program that sets the promiscuous mode (for example tcpdump), ipfm will also see its network interface set into promiscuous mode. Syntax [NO]PROMISC Default is PROMISC APPEND OR REPLACE LOG FILES You can choose to append the output to an existing logfile or to replace the old file by a new one. Syntax : APPEND|REPLACE Default is REPLACE SEE ALSO
strftime(3), ipfm(8) AUTHORS
Robert CHERAMY <tibob@via.ecp.fr> Andres KRAPF <dae@via.ecp.fr> Last change: 26 October 2000 IPFM.CONF(5)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy