[solved] Wildcard, Video Audio ID.

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Mattyboy

[solved] Wildcard, Video Audio ID.

Post by Mattyboy »

Code: Select all

mintman@mintman-To-be-filled-by-O-E-M ~ $ cat /home/mintman/.bash_aliases
alias lost='cd ~/Desktop/shows/lost; ls && mplayer L* -aid 2' 
My mother is in bed after having a hip operation and she's been watching the show Lost which I've downloaded for her. The idea is to just type in 'lost' in terminal and it will then play and continue to play the next episode without her having to get out of bed.

The above command works fine apart from selecting the audio id contained in the video stream -aid 2. The wildcard, used to play each file in numerical order, seems to be throwing that selection off in mplayer

Code: Select all

mplayer L* -aid 2
any suggestions? Thanks :)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: Wildcard, Video Audio ID.

Post by rene »

mplayer's -aid is I believe a strictly per-input option. That is, while you are saying, e.g.,

Code: Select all

mplayer L1 L2 L3 -aid 2
you should be saying

Code: Select all

mplayer L1 -aid 2 L2 -aid 2 L3 -aid 2
You can do so with

Code: Select all

mplayer $(for LOST in L*; do echo "$LOST" -aid 2; done)
Note, before you do, also try if simply mplayer -aid 2 L* makes the -aid apply to all inputs; don't have mplayer here to test but don't believe it does. Also, before this I posted calling mplayer itself in a loop,

Code: Select all

for LOST in L*; do mplayer "$LOST" -aid 2; done
but near-immediately deleted it again when noticing that wasn't in fact what you were asking; you may have still gotten a notification for it though. And, in fact, might be all you need I suppose.
Mattyboy

Re: Wildcard, Video Audio ID.

Post by Mattyboy »

rene wrote: Wed May 09, 2018 7:59 pm
Thanks rene.

Simply swapping the aid selection round worked a treat, it became the default for all episodes.

Code: Select all

mintman@mintman-To-be-filled-by-O-E-M ~ $ cat /home/mintman/.bash_aliases
alias lost='cd ~/Desktop/shows/lost; ls && mplayer -aid 2 L*'
Appreciated :D
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: [solved] Wildcard, Video Audio ID.

Post by rene »

Darn it. The for loop so as to build the command line was much neater.
Locked

Return to “Scripts & Bash”