Annotation of plm/genpl, revision 1.3
1.1 snw 1: #!/usr/bin/env bash
2:
1.2 snw 3: #
1.3 ! snw 4: # $Id: genpl,v 1.2 2025/04/27 16:27:49 snw Exp $
1.2 snw 5: # Playlist generator for plm
6: #
7: # Copyright (C) 2025 Serena Willis
8: #
1.3 ! snw 9: # $Log: genpl,v $
! 10: # Revision 1.2 2025/04/27 16:27:49 snw
! 11: # Add CVS keywords
! 12: #
1.2 snw 13: #
14: # SPDX-FileCopyrightText: (C) 2025 Serena Willis
1.3 ! snw 15: # SPDX-License-Identifier: AGPL-3.0-or-later
1.2 snw 16:
1.1 snw 17:
18: if [[ $# != 1 ]]
19: then
20: echo "genpl: must specify specfile"
21: exit 1
22: fi
23:
24: LISTNAME="$1"
25: SPECFILE="${HOME}/.config/genpl/${LISTNAME}"
26:
27: if [[ ! -f "${SPECFILE}" ]]
28: then
29: echo "genpl: ${SPECFILE} not found"
30: exit 2
31: fi
32:
33: BASEDIR=$(cat "${SPECFILE}" | grep -E "^BASEDIR:" | cut -d: -f2)
34: BASELIST="BASE${LISTNAME}"
35: INLISTS=$(cat "${SPECFILE}" | grep -E "^LISTS:" | cut -d: -f2)
36:
37: if [[ -f "${BASELIST}" ]]
38: then
39: LISTS="${BASELIST},${INLISTS}"
40: else
41: LISTS="${INLISTS}"
42: fi
43:
44: IFS=","
45: for LIST in $LISTS
46: do
47: OLIST="${OLIST} ${LIST}.m3u"
48: done
49: unset IFS
50:
51: OLIST=$(echo "${OLIST}" | tr ' ' ',')
52: LISTS="${OLIST:1}"
53:
54: if [[ ! -d "${BASEDIR}" ]]
55: then
56: echo "genpl: ${BASEDIR} base directory not found"
57: exit 3
58: fi
59:
60: pushd "${BASEDIR}" &> /dev/null
61:
62: echo
63: echo "Creating playlist ${LISTNAME} from:"
64: for LIST in $(echo ${OLIST} | tr ',' ' ')
65: do
66: echo " * ${LIST}"
67: done
68:
69: pl --merge --input="${LISTS}" --output="${LISTNAME}.m3u" --overwrite
70:
71: popd &> /dev/null
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>