2017-02-20 14:01:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-02-20 13:02:31 +01:00
|
|
|
track_id=1
|
2017-02-20 18:04:09 +01:00
|
|
|
track_removed=0
|
2017-02-20 13:02:31 +01:00
|
|
|
for track in $(mpc playlist);
|
|
|
|
do
|
2017-02-20 14:01:31 +01:00
|
|
|
expires_on=$(echo $track | grep -oE 'expire(=|/)[0-9]*(&|/)' | tr -s '=' '/' | tr -s '&' '/' | cut -d '/' -f 2)
|
|
|
|
if [[ $((expires_on - $(date '+%s'))) -le 3600 ]];
|
|
|
|
then
|
|
|
|
mpc del $track_id
|
2017-02-20 18:04:09 +01:00
|
|
|
track_removed=$((track_removed+1))
|
2017-02-20 14:01:31 +01:00
|
|
|
else
|
|
|
|
track_id=$((track_id+1))
|
|
|
|
fi
|
2017-02-20 13:02:31 +01:00
|
|
|
done
|
2017-02-20 14:08:39 +01:00
|
|
|
|
2017-02-20 18:04:09 +01:00
|
|
|
echo "Removed $track_removed tracks"
|
2017-02-20 14:08:39 +01:00
|
|
|
mpc play
|