Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- cd /home/z/pogoda_tapeta/
- rm *.html
- rm *.png
- curl 'https://wttr.in/Tarn%C3%B3w' \
- -H 'authority: wttr.in' \
- -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
- -H 'accept-language: pl-PL,pl;q=0.6' \
- -H 'cache-control: max-age=0' \
- -H 'dnt: 1' \
- -H 'sec-ch-ua: "Brave";v="117", "Not;A=Brand";v="8", "Chromium";v="117"' \
- -H 'sec-ch-ua-mobile: ?0' \
- -H 'sec-ch-ua-platform: "Linux"' \
- -H 'sec-fetch-dest: document' \
- -H 'sec-fetch-mode: navigate' \
- -H 'sec-fetch-site: none' \
- -H 'sec-fetch-user: ?1' \
- -H 'sec-gpc: 1' \
- -H 'upgrade-insecure-requests: 1' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
- --compressed > p.html
- sed -i '/<link rel="stylesheet" type="text\/css" href="\/files\/style.css" \/>/i <style>\nbody {\n background: black;\n color: #bbbbbb;\n}\npre {\n font-family: "Source Code Pro", "DejaVu Sans Mono", Menlo, "Lucida Sans Typewriter", "Lucida Console", monaco, "Bitstream Vera Sans Mono", monospace;\n font-size: 75%;\n}\n</style>' p.html
- sed -i '349,360d' p.html
- sed -i '346d' p.html
- wkhtmltoimage p.html p.png
- convert p.png -resize 135% output.png
- feh --bg-center output.png
- rm /tmp/*.json
- rm /tmp/*.ics
- rm /tmp/*.txt
- echo "" > /home/z/zuzel.txt
- cd /tmp/
- if [ -e "basic.ics" ]; then
- echo "kalendarz istnieje"
- else
- sleep 5
- wget https://calendar.google.com/calendar/ical/xxxxxxxx/basic.ics
- ical2json basic.ics
- jq --arg today "$(date +'%Y%m%dT%H%M%SZ')" '.VCALENDAR[].VEVENT |= map(select(.DTSTART >= $today))' basic.json > basic2.json
- month=$(echo ".$(date +%m)") # Pobiera aktualny miesiąc jako dwucyfrową liczbę (np. 01 dla stycznia)
- cat basic2.json | jq '.VCALENDAR[0].VEVENT[] | "\(.DTSTART) - \(.SUMMARY)"' | sed 's/[\\\/"]//g' | tr -d '"' | sed 's/[\\\/"]//g' | tr -d '"' | cut -c 5- | sed 's/[\\\/"]//g' | tr -d '"' | cut -c 1-4,6- | sed 's/[\\\/"]//g' | tr -d '"' | cut -c 1-6,12- | cut -c1-4,7- | awk '{print substr($0,3,2) substr($0,1,2) substr($0,5)}' | sed 's/./&./2' | sort -n -k1,2 > /home/z/wydarzenia.txt
- fi
- ### ŻUŻEL
- if [ -e "zuzel.json" ]; then
- echo "kalendarz żużlowy istnieje"
- else
- sleep 2
- # Get the current date in the format YYYY-MM-DD
- current_date=$(date +"%Y-%m-%d")
- # Get the last day of the current month in the format YYYY-MM-DD
- last_day_of_month=$(date -d "$(date +'%Y-%m-01') +1 month -1 day" +"%Y-%m-%d")
- # Construct the URL with the current date and last day of the month
- url="https://stats.speedwayekstraliga.pl/api/v1/matches?f=$current_date&t=$last_day_of_month&filters=true"
- # Use curl to make the API request
- curl "$url" \
- -H 'authority: stats.speedwayekstraliga.pl' \
- -H 'accept: application/json, text/plain, */*' \
- -H 'accept-language: pl-PL,pl;q=0.9' \
- -H 'dnt: 1' \
- -H 'origin: https://speedwayekstraliga.pl' \
- -H 'referer: https://speedwayekstraliga.pl/' \
- -H 'sec-ch-ua: "Chromium";v="118", "Brave";v="118", "Not=A?Brand";v="99"' \
- -H 'sec-ch-ua-mobile: ?0' \
- -H 'sec-ch-ua-platform: "Linux"' \
- -H 'sec-fetch-dest: empty' \
- -H 'sec-fetch-mode: cors' \
- -H 'sec-fetch-site: same-site' \
- -H 'sec-gpc: 1' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36' \
- --compressed > zuzel.json
- jq -r '.data[] | "\(.datetime_schedule) - \(.name.pl)"' zuzel.json | while read -r line; do timestamp=$(echo "$line" | awk '{print $1/1000}'); date=$(date -d "@$timestamp" "+%d.%m"); echo "$date - $(echo "$line" | cut -d ' ' -f 2-) 🚴🏼"; done | grep -v odc. | sed 's/ - -/ -/g' | head -n 19 > /home/z/zuzel.txt
- sed -i '/Magazyn PGE Ekstraligi/d' /home/z/zuzel.txt
- sed -i '/kadry juniorów/d' /home/z/zuzel.txt
- sed -i 's/ORLEN OIL //g' /home/z/zuzel.txt
- sed -i 's/OK BEDMET //g' /home/z/zuzel.txt
- sed -i 's/EBUT.PL //g' /home/z/zuzel.txt
- sed -i 's/FOGO //g' /home/z/zuzel.txt
- sed -i 's/BETARD //g' /home/z/zuzel.txt
- sed -i 's/OPTIBET //g' /home/z/zuzel.txt
- sed -i 's/GRUDZIĄDZKIE MEBELKI //g' /home/z/zuzel.txt
- sed -i 's/ENEA //g' /home/z/zuzel.txt
- sed -i 's/ABRAMCZYK //g' /home/z/zuzel.txt
- sed -i 's/#ORZECHOWAOSADA //g' /home/z/zuzel.txt
- sed -i 's/TEXOM //g' /home/z/zuzel.txt
- sed -i 's/INNPRO //g' /home/z/zuzel.txt
- sed -i 's/NOVYHOTEL //g' /home/z/zuzel.txt
- sed -i 's/POLCOPPER AGROMIX //g' /home/z/zuzel.txt
- sed -i 's/GRUPA //g' /home/z/zuzel.txt
- sed -i 's/H.SKRZYDLEWSKA //g' /home/z/zuzel.txt
- sed -i 's/LOKOMOTIV //g' /home/z/zuzel.txt
- sed -i 's/ARGED //g' /home/z/zuzel.txt
- sed -i 's/CELLFAST //g' /home/z/zuzel.txt
- sed -i 's/TAURON //g' /home/z/zuzel.txt
- echo -e "\n" >> /home/z/zuzel.txt
- echo "Piłka ręczna:" >> /home/z/zuzel.txt
- curl -s https://www.unia-tarnow.pl/wp-json/sportspress/v2/calendars/19428 | jq -r --arg today "$(date +'%Y-%m-%d')" '.data[] | select(.post_date >= $today) | "\(.post_title) - \(.post_date)"' | tac | sed -E 's/([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/\3-\2-\1 \4:\5/' | sed 's/GRUPA AZOTY //g' | sed 's/TORUS //g' | sed 's/ORLEN //g' | sed 's/-2023/ g./g' | sed 's/-2024/ g./g' | sed 's/...$//' | head -n 4 | sed 's/$/ 🏐/' >> /home/z/zuzel.txt
- sed -i 's/PIOTRKOWIANIN PIOTRKÓW TRYBUNALSKI/PIOTRKÓW T./g' /home/z/zuzel.txt
- sed -i 's/UNIA TARNÓW/UNIA TRN./g' /home/z/zuzel.txt
- sed -i 's/ARGED KPR OSTROVIA OSTRÓW WLKP./OSTROVIA/g' /home/z/zuzel.txt
- fi
- #### PIŁKA RĘCZNA EVENTIM
- datetime=$(curl -s 'https://www.eventim.pl/artist/grupa-azoty-unia-tarnow/' \
- -H 'authority: www.eventim.pl' \
- -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
- -H 'accept-language: pl-PL,pl;q=0.5' \
- -H 'cache-control: max-age=0' \
- -H 'dnt: 1' \
- -H 'referer: https://www.eventim.pl/city/tarnow-2179/venues/' \
- -H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Brave";v="120"' \
- -H 'sec-ch-ua-mobile: ?0' \
- -H 'sec-ch-ua-platform: "Linux"' \
- -H 'sec-fetch-dest: document' \
- -H 'sec-fetch-mode: navigate' \
- -H 'sec-fetch-site: same-origin' \
- -H 'sec-fetch-user: ?1' \
- -H 'sec-gpc: 1' \
- -H 'upgrade-insecure-requests: 1' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
- --compressed | pup 'div.listing-item-wrapper-inside-card json{}' | sed -n '/"datetime":/p' | sed 's/.*"datetime":"\([^"]*\)".*/\1/' | head -n 1)
- if [[ -z "$datetime" ]]; then
- echo "Brak danych o czasie wydarzenia."
- else
- sleep 5
- # Pobieranie nazwy wydarzenia
- event_name=$(curl -s 'https://www.eventim.pl/artist/grupa-azoty-unia-tarnow/' \
- -H 'authority: www.eventim.pl' \
- -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
- -H 'accept-language: pl-PL,pl;q=0.5' \
- -H 'cache-control: max-age=0' \
- -H 'dnt: 1' \
- -H 'referer: https://www.eventim.pl/city/tarnow-2179/venues/' \
- -H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Brave";v="120"' \
- -H 'sec-ch-ua-mobile: ?0' \
- -H 'sec-ch-ua-platform: "Linux"' \
- -H 'sec-fetch-dest: document' \
- -H 'sec-fetch-mode: navigate' \
- -H 'sec-fetch-site: same-origin' \
- -H 'sec-fetch-user: ?1' \
- -H 'sec-gpc: 1' \
- -H 'upgrade-insecure-requests: 1' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
- --compressed | pup 'div.listing-item-wrapper-inside-card json{}' | sed -n '/"data-teaser-name":/p' | sed 's/.*"data-teaser-name":"\([^"]*\)".*/\1/' | head -n 1)
- # Formatowanie i dekodowanie nazwy wydarzenia (usunięcie kodowania HTML)
- event_name_decoded=$(echo $event_name | sed 's/\\u0026amp;oacute;/ó/g' | sed 's/data-teaser-name: //g' | sed 's/,//g')
- # Formatowanie daty
- formatted_date=$(echo $datetime | sed -E 's/([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):[0-9]{2}.*/\3.\2 g.\4:\5/')
- formatted_date=${formatted_date//'"datetime": "'/}
- event_name_decoded=$(echo $event_name_decoded | sed 's/"//g')
- event_name_decoded=${event_name_decoded//"data-teaser-name:"/}
- event_name_decoded=${event_name_decoded//" Grupa Azoty Unia Tarnów"/UNIA}
- # Wyświetlanie sformatowanej informacji o wydarzeniu
- echo "🤾🏻$event_name_decoded - $formatted_date🤾🏻" >> /home/z/zuzel.txt
- fi
- ###TAPETA EXTENDED
- cd /home/z/pogoda_tapeta/
- # Path to the original image
- original_image="output.png"
- # Path to the text file
- text_file="/home/z/zuzel.txt"
- convert output.png -gravity East -chop 160x0 cropped_output.png
- rm output.png
- mv cropped_output.png output.png
- # Original width and the additional width
- original_width=1382
- additional_width=700
- new_width=$((original_width + additional_width))
- height=826
- # Create a new blank image with additional width
- convert -size "${additional_width}x$height" xc:black blank.png
- # Add text from the file to the new blank image
- #convert blank.png -font "mononoki-Regular" -pointsize 17 -fill white -gravity northwest -annotate +10+10 "@$text_file" annotated_blank.png
- # Create a temporary file that combines both text files
- touch combined_text.txt
- cat "$text_file" > combined_text.txt
- echo -e "\n" >> combined_text.txt
- echo "Z kalendarza BOŻENKI:" >> combined_text.txt
- sort -t '.' -k2,2n -k1,1n ~/wydarzenia.txt | head -n 6 >> combined_text.txt
- # Add combined text from the new file to the blank image
- convert blank.png -font "mononoki-Regular" -pointsize 17 -fill white -gravity northwest -annotate +10+10 "@combined_text.txt" annotated_blank.png
- # Clean up the temporary file
- rm combined_text.txt
- # Append the new blank image with text to the right of the original image
- convert "$original_image" annotated_blank.png +append final_image.png
- # Clean up temporary images
- rm blank.png annotated_blank.png
- feh --bg-center final_image.png
Advertisement
Add Comment
Please, Sign In to add comment