[MPlayer-users] Re: MPlayer and backslashes in .asx files ?

malc malc at tmbg.co.uk
Sun May 25 01:50:17 CEST 2003


> Date: Sun, 25 May 2003 18:30:33 +0300
> From: Joonas Koivunen <rzei at mbnet.fi>
> To: "MPlayer user's list." <mplayer-users at mplayerhq.hu>
> Subject: Re: [MPlayer-users] MPlayer and backslashes in .asx files ?
> Message: 6
> 
> On Saturday 24 May 2003 13:35, Joël Bourquard wrote:
> > For the record, here's the script I came up with:
> >
> > #!/bin/bash
> > PLAYER_CMD="mplayer -quiet -dr -fs -double -stop_xscreensaver"
> > echo "$1" | grep ".asx" &>/dev/null
> > if [ $? == 0 ]; then
> >     sed "s%Files[\\]%$PWD/Files/%" "$1" | $PLAYER_CMD -playlist
> > /dev/stdin
> > else
> >     $PLAYER_CMD "$1"
> > fi
> i'd like to add that afaik grep is case-sensitive. so if you transfer stuff 
> from windows systems, you might end up with files with .ASX and your script 
> not noticing those.. i have no knowledge when do these uppercase filenames 
> happen, sometimes i just found ones..

grep -i   # ignore case ;-)

> > It tests whether the filename contains .asx, then uses sed to do the
> > replacement.
> using tr as Corey pointed out seems a bit more mplayer-like way to do it as 
> it's cleaner :))
> 
> > Future improvements for it:
> > - Enable support of '%' character in filenames
> wouldn't using Coreys way deal with this problem?
> 
> > - Detect .asf at end of filenames only
> isn't that something like egrep "^asx" hmm.. or did that match to the 
> beginning? i'm not an expert in regular expressions, but that's the way to 
> go..

grep -i "asx$"    # $ is the regexp pattern for end of line

> > - Send correct commandline when playing video file outside current
> > directory (how?).
> hmm..
> i'm not sure what you mean, but you might mean the script needing to be in 
> /usr/bin or somewhere in your path..
> 
> > Again, thanks
> >
> > Joël
> 
> -rzei

Regards,

malc.




More information about the MPlayer-users mailing list