libxmp / xmp-cli

Command-line mod player using libxmp
GNU General Public License v2.0
75 stars 22 forks source link

Option to read a module playlist from a file/stdin? #25

Open AliceLR opened 3 years ago

AliceLR commented 3 years ago

Something I do a lot for getting aggregate data when testing fixes on more common module formats is I run checks on the ModLand or Mod Archive collections with a program that takes a list of newline-separated filenames. Doing a similar test with xmp --load-only would be useful to determine if anything new is rejected by libxmp after implementing a patch. If there's a way to do this with xmp without invoking multiple xmp processes, I missed it. (The ModLand 2016 dump I test with has >20k Impulse Tracker modules, for example, so while argv is fine for less common formats, it just isn't adequate in this case.)

Would a feature like this be generally useful?

narodnik commented 3 years ago

I'd like the ability to have a playlist. Right now I use this script:

#!/bin/bash

for i in $(fd --type f); do
    if rg $i played.txt; then
        echo "Skipping $i...";
    else
        xmp $i;
        echo $i >> played.txt
    fi
done
iskamag commented 2 years ago

I run "xmp ’shuf -n 100 modlist’" You can probably save your playlist with "shuf -n 100 modlist > playlist" then run either "xmp ’cat playlist’" or "xmp ’head -n 1 playlist’ && sed -i 1d" for each line. Scripting is awesome.

narodnik commented 3 months ago

I use these scripts:

#!/usr/bin/python
import os, glob, subprocess

HOME = os.environ["HOME"]
os.chdir(f"{HOME}/mus/shared/latest/")
files = glob.glob("**/*", recursive=True)
files = [f for f in files if os.path.isfile(f)]

played_files = open(f"{HOME}/mus/rec/all").read().split("\n")
files = [f for f in files if f not in played_files]
for file in files:
    with open(f"{HOME}/mus/rec/curr", "w") as f:
        f.write(file)
    process = subprocess.run(["xmp", file])
    with open(f"{HOME}/mus/rec/all", "a") as f:
        f.write(f"{file}\n")
#!/bin/sh
cat ~/mus/rec/curr >> ~/mus/rec/fav
echo >> ~/mus/rec/fav