You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
1.2 KiB

#!/bin/bash
########################################################################
# Author:
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
PREFIX="$1"
[[ $PREFIX == "" ]] && PREFIX="*"
FILTER="$2"
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
if [[ ! $FILTER ]]; then
# We use `grep -Ev "];;` to filter out videos without an ipns link
MY_VIDEOS=`cat /home/$YOU/.zen/ipfs/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;"`
SWARM_VIDEOS=`cat /home/$YOU/.zen/ipfs_swarm/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;"`
(echo "$SWARM_VIDEOS" && echo "$MY_VIDEOS") | tac
else
MY_VIDEOS=`cat /home/$YOU/.zen/ipfs/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;" | grep "$FILTER"`
SWARM_VIDEOS=`cat /home/$YOU/.zen/ipfs_swarm/.*/astroport/kodi/vstream/${PREFIX}ASTRXBIAN | grep -Ev "];;" | grep -Ev "CAT;TMDB;" | grep "$FILTER"`
(echo "$SWARM_VIDEOS" && echo "$MY_VIDEOS") | tac
fi