2024-08-18 05:14:09 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
function collect () {
|
|
|
|
PREFIX="$1"
|
|
|
|
VID_TEMPLATE_FILE="templates/vid-template.txt"
|
|
|
|
TMP_FILE=$( mktemp )
|
|
|
|
|
|
|
|
echo "${TMP_FILE}"
|
|
|
|
|
2024-08-18 08:24:46 +03:00
|
|
|
cat ${PREFIX}-videoids/*.txt | xargs -I{} sed -e "s@###VID###@{}@g" "${VID_TEMPLATE_FILE}" >> "${TMP_FILE}"
|
2024-08-18 05:14:09 +03:00
|
|
|
cat ${PREFIX}-channels/*.txt | xargs -I{} sed -e "s@###VID###@{}@g" "${VID_TEMPLATE_FILE}" >> "${TMP_FILE}"
|
|
|
|
|
2024-08-18 08:01:36 +03:00
|
|
|
diff "${PREFIX}.txt" "${TMP_FILE}" >/dev/null
|
2024-08-18 05:14:09 +03:00
|
|
|
RES="$?"
|
|
|
|
|
|
|
|
if [ "${RES}" -gt "0" ]
|
|
|
|
then
|
|
|
|
mv -vf "${PREFIX}.txt" "${PREFIX}.txt.old" && \
|
|
|
|
cp -vf "${TMP_FILE}" "${PREFIX}.txt" && \
|
|
|
|
rm -vf "${PREFIX}.txt.old"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -vf "${TMP_FILE}"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
arr=("allowed" "blocked")
|
|
|
|
|
|
|
|
for i in "${arr[@]}"
|
|
|
|
do
|
|
|
|
collect "$i"
|
|
|
|
done
|