#!/bin/bash
# This Updates the RSS-Feed.
# License:
# ALL RIGHTS RESERVED
# This Code is very bad. It should not be used in production.
# Variables:
# Files:
source_file="Dev_Log/Dev_Log.html"
target_file="Feed/RSS.xml"
# Description getter Counter:
line_counter=0
# Initialize the counter value:
idsToUse=$(grep -o "
" "$source_file" | wc -l)
# CleanUP RSS-Feed:
> "$target_file"
# Prepair Feed:
echo "" >> "$target_file"
echo "" >> "$target_file"
echo " " >> "$target_file"
echo " REPOSSESSED - Development Log" >> "$target_file"
echo " https://REPOSSESSED.catwithcode.moe/Dev_Log/Dev_Log.html" >> "$target_file"
echo " Development Log for there upcoming Immersiv Sim REPOSSESSED." >> "$target_file"
# Initialize the titleDate value and it's formated version:
datePub=""
formatted_date=""
# Extract text between
and
and write to target file:
while IFS= read -r line; do
# Check if line is Title:
if [[ $line =~ \
(.*)\<\/h2\> ]]; then
# Extract the text between :
text="${BASH_REMATCH[1]}"
# Write to Tags:
echo " " >> "$target_file"
# Write actual Text:
echo " RE//POSSESSED - $text" >> "$target_file"
# Get PubDate:
date_string=${text:3:10}
formatted_date=$(date -d "${date_string//./-}" +"%a, %d %b %Y 00:00:00 GMT")
# Count Up:
idsToUse=$((idsToUse - 1))
# Write to Tags:
echo " https://REPOSSESSED.catwithcode.moe/Dev_Log/Dev_Log.html?item=${idsToUse}" >> "$target_file"
fi
# If just wrote Titel then:
if [[ $(tail -n 1 "$target_file") == " https://REPOSSESSED.catwithcode.moe/Dev_Log/Dev_Log.html?item=${idsToUse}" ]]; then
# Get actual Text:
line_counter=$((line_counter + 1))
# After 3 lines, write the current line to the target file:
if [ $line_counter -eq 3 ]; then
# Reset:
line_counter=0
# Write Disc. and Tags:
echo " $line" >> "$target_file"
echo " $formatted_date" >> "$target_file"
echo " " >> "$target_file"
# Clean Date:
datePub=""
formatted_date=""
fi
fi
done < "$source_file"
# Closing Tags:
echo "
" >> "$target_file"
echo "" >> "$target_file"
# Clean the target file by removing HTML-Tags:
# u:
sed -i 's///g; s/<\/u>//g' "$target_file"
# h3:
sed -i 's/