💾 Archived View for ait.place › dot › bin › mpvbtfs.txt captured on 2023-07-22 at 16:49:32.

View Raw

More Information

⬅️ Previous capture (2022-07-16)

-=-=-=-=-=-=-

#!/usr/bin/env bash

tmp=/tmp/btfs

mkdir -p $tmp
btfs "$1" $tmp || exit 1
echo "Mounted torrent in: $tmp"

#Check until a file shows up
until [ ! -z "$(ls $tmp)" ]; do
	sleep 0.5
	echo "Checking for files in: $tmp"
done

# Enclose the file names with quotes
#__findfiles | while read -r line; do
#	if [ -z "$things" ];then
#		things="\"$line\""
#	else
#		things="$things \"$line\""
#	fi
#done

list=$(find $tmp -type f | grep -e '.mkv' -e '.mp4' | sed "s/^.*$/\"&\"/g")
echo "Found files: $list"
echo $list | xargs mpv
fusermount -u $tmp && echo "Unmounted $tmp"