On Sun, 15 Jan 2017 22:34:18 +0100 Felix Van der Jeugt <felix.vanderje...@gmail.com> wrote:
> Excerpts from Mattias Andrée's message of 2017-01-15 > 16:54:46 +0100: > > On Sun, 15 Jan 2017 10:48:56 -0500 Alexander Keller > > <cont...@nycroth.com> wrote: > > > The simplest way I can imagine is to link them into a > > > directory temporarily and/or permanently with: > > > > > > mkdir playlist ln *some_glob_pattern* playlist > > > > > > Then use the vidir(1) program to edit the files to > > > number them sequentially the way you want. Then you > > > can either create a playlist and delete the directory > > > using some basic command line tools or just keep the > > > directory as a playlist. > > > > The problem with this approach is that I cannot edit > > the list whilst it is playing, except for removing > > files. > > Unless you didn't play that directory with `mpv > playlist/*`, but with a simple script which takes the > alphabetically first file, plays it, removes it when > played succesfully, and takes the next. `while mpv "$(ls > playlist | head -1)"; do true; done`, am I right? > > Sincerely, > Felix > > I wrote the following script that does most of what I want. The only thing it lacks is support for mass reorder. #!/bin/sh number=0 if test "$1" = -n; then number=1 shift 1 fi if test "$1" = --; then shift 1 fi if ! test $# = 0; then cd -- "$1" fi if test $number = 1; then n="$(ls -1 | wc -l)" i=1 ls -1 | while read f; do mv -- "$f" "00$(seq -w 0 $n | sed 1,${i}d | sed 1q)0000 - $f" i=$(expr $i + 1) done fi current="$(ls -1 | head -n 1)" while mpv -- "$current"; do index=$(ls -1 | grep -Fnx -- "$current" | cut -d : -f 1) index=$(expr $index) if test $index -ge $(ls -1 | wc -l); then break fi current="$(ls -1 | sed 1,${index}d | sed 1q)" done
pgpW054f2SwRp.pgp
Description: OpenPGP digital signature