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

Joël Bourquard numlock at freesurf.ch
Sat May 24 12:35:16 CEST 2003


Thanks a lot Joonas and Corey !

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


It tests whether the filename contains .asx, then uses sed to do the
replacement.

Future improvements for it:
- Enable support of '%' character in filenames
- Detect .asf at end of filenames only
- Send correct commandline when playing video file outside current
directory (how?).

I'll try that 'tr' command, it looks simpler than sed. I haven't heard
of $@ before ;-)

Again, thanks

Joël

> Joonas Koivunen wrote:
> > if that's not an option, with a simple script you could accomplish 
> > it..
> > 
> 
> Yes, and to give a hint:
> $ cat playlist.asx | tr '\\' /
> 
> I don't think that'll break anything, but I don't deal with asx files at
> all. Make sure there never occur any backslashes for anything other than
> DOS-style paths.
> 
> The rest just depends on how you want to set it up. You could make a
> simple wrapper something like:
> 
> #!/bin/bash
> cat $1 | tr '\\' / > /tmp/playlist
> shift 1
> mplayer -playlist /tmp/playlist $@
> 
> 
> -Corey




More information about the MPlayer-users mailing list