Guest User

wallpaper gen

a guest
May 14th, 2024
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.92 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. cd /home/z/pogoda_tapeta/
  5. rm *.html
  6. rm *.png
  7.  
  8.  
  9. curl 'https://wttr.in/Tarn%C3%B3w' \
  10. -H 'authority: wttr.in' \
  11. -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
  12. -H 'accept-language: pl-PL,pl;q=0.6' \
  13. -H 'cache-control: max-age=0' \
  14. -H 'dnt: 1' \
  15. -H 'sec-ch-ua: "Brave";v="117", "Not;A=Brand";v="8", "Chromium";v="117"' \
  16. -H 'sec-ch-ua-mobile: ?0' \
  17. -H 'sec-ch-ua-platform: "Linux"' \
  18. -H 'sec-fetch-dest: document' \
  19. -H 'sec-fetch-mode: navigate' \
  20. -H 'sec-fetch-site: none' \
  21. -H 'sec-fetch-user: ?1' \
  22. -H 'sec-gpc: 1' \
  23. -H 'upgrade-insecure-requests: 1' \
  24. -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' \
  25. --compressed > p.html
  26.  
  27. 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
  28.  
  29. sed -i '349,360d' p.html
  30. sed -i '346d' p.html
  31.  
  32. wkhtmltoimage p.html p.png
  33. convert p.png -resize 135% output.png
  34. feh --bg-center output.png
  35.  
  36.  
  37. rm /tmp/*.json
  38. rm /tmp/*.ics
  39. rm /tmp/*.txt
  40. echo "" > /home/z/zuzel.txt
  41.  
  42. cd /tmp/
  43.  
  44.  
  45.  
  46. if [ -e "basic.ics" ]; then
  47. echo "kalendarz istnieje"
  48. else
  49. sleep 5
  50. wget https://calendar.google.com/calendar/ical/xxxxxxxx/basic.ics
  51. ical2json basic.ics
  52. jq --arg today "$(date +'%Y%m%dT%H%M%SZ')" '.VCALENDAR[].VEVENT |= map(select(.DTSTART >= $today))' basic.json > basic2.json
  53.  
  54. month=$(echo ".$(date +%m)") # Pobiera aktualny miesiąc jako dwucyfrową liczbę (np. 01 dla stycznia)
  55.  
  56. 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
  57.  
  58. fi
  59.  
  60.  
  61. ### ŻUŻEL
  62.  
  63. if [ -e "zuzel.json" ]; then
  64. echo "kalendarz żużlowy istnieje"
  65. else
  66. sleep 2
  67.  
  68. # Get the current date in the format YYYY-MM-DD
  69. current_date=$(date +"%Y-%m-%d")
  70.  
  71. # Get the last day of the current month in the format YYYY-MM-DD
  72. last_day_of_month=$(date -d "$(date +'%Y-%m-01') +1 month -1 day" +"%Y-%m-%d")
  73.  
  74. # Construct the URL with the current date and last day of the month
  75. url="https://stats.speedwayekstraliga.pl/api/v1/matches?f=$current_date&t=$last_day_of_month&filters=true"
  76.  
  77. # Use curl to make the API request
  78. curl "$url" \
  79. -H 'authority: stats.speedwayekstraliga.pl' \
  80. -H 'accept: application/json, text/plain, */*' \
  81. -H 'accept-language: pl-PL,pl;q=0.9' \
  82. -H 'dnt: 1' \
  83. -H 'origin: https://speedwayekstraliga.pl' \
  84. -H 'referer: https://speedwayekstraliga.pl/' \
  85. -H 'sec-ch-ua: "Chromium";v="118", "Brave";v="118", "Not=A?Brand";v="99"' \
  86. -H 'sec-ch-ua-mobile: ?0' \
  87. -H 'sec-ch-ua-platform: "Linux"' \
  88. -H 'sec-fetch-dest: empty' \
  89. -H 'sec-fetch-mode: cors' \
  90. -H 'sec-fetch-site: same-site' \
  91. -H 'sec-gpc: 1' \
  92. -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36' \
  93. --compressed > zuzel.json
  94.  
  95.  
  96. 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
  97.  
  98.  
  99. sed -i '/Magazyn PGE Ekstraligi/d' /home/z/zuzel.txt
  100. sed -i '/kadry juniorów/d' /home/z/zuzel.txt
  101. sed -i 's/ORLEN OIL //g' /home/z/zuzel.txt
  102. sed -i 's/OK BEDMET //g' /home/z/zuzel.txt
  103. sed -i 's/EBUT.PL //g' /home/z/zuzel.txt
  104. sed -i 's/FOGO //g' /home/z/zuzel.txt
  105. sed -i 's/BETARD //g' /home/z/zuzel.txt
  106. sed -i 's/OPTIBET //g' /home/z/zuzel.txt
  107. sed -i 's/GRUDZIĄDZKIE MEBELKI //g' /home/z/zuzel.txt
  108. sed -i 's/ENEA //g' /home/z/zuzel.txt
  109. sed -i 's/ABRAMCZYK //g' /home/z/zuzel.txt
  110. sed -i 's/#ORZECHOWAOSADA //g' /home/z/zuzel.txt
  111. sed -i 's/TEXOM //g' /home/z/zuzel.txt
  112. sed -i 's/INNPRO //g' /home/z/zuzel.txt
  113. sed -i 's/NOVYHOTEL //g' /home/z/zuzel.txt
  114. sed -i 's/POLCOPPER AGROMIX //g' /home/z/zuzel.txt
  115. sed -i 's/GRUPA //g' /home/z/zuzel.txt
  116. sed -i 's/H.SKRZYDLEWSKA //g' /home/z/zuzel.txt
  117. sed -i 's/LOKOMOTIV //g' /home/z/zuzel.txt
  118. sed -i 's/ARGED //g' /home/z/zuzel.txt
  119. sed -i 's/CELLFAST //g' /home/z/zuzel.txt
  120. sed -i 's/TAURON //g' /home/z/zuzel.txt
  121.  
  122.  
  123. echo -e "\n" >> /home/z/zuzel.txt
  124. echo "Piłka ręczna:" >> /home/z/zuzel.txt
  125.  
  126.  
  127.  
  128. 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
  129.  
  130. sed -i 's/PIOTRKOWIANIN PIOTRKÓW TRYBUNALSKI/PIOTRKÓW T./g' /home/z/zuzel.txt
  131. sed -i 's/UNIA TARNÓW/UNIA TRN./g' /home/z/zuzel.txt
  132. sed -i 's/ARGED KPR OSTROVIA OSTRÓW WLKP./OSTROVIA/g' /home/z/zuzel.txt
  133.  
  134.  
  135. fi
  136.  
  137.  
  138.  
  139. #### PIŁKA RĘCZNA EVENTIM
  140. datetime=$(curl -s 'https://www.eventim.pl/artist/grupa-azoty-unia-tarnow/' \
  141. -H 'authority: www.eventim.pl' \
  142. -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
  143. -H 'accept-language: pl-PL,pl;q=0.5' \
  144. -H 'cache-control: max-age=0' \
  145. -H 'dnt: 1' \
  146. -H 'referer: https://www.eventim.pl/city/tarnow-2179/venues/' \
  147. -H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Brave";v="120"' \
  148. -H 'sec-ch-ua-mobile: ?0' \
  149. -H 'sec-ch-ua-platform: "Linux"' \
  150. -H 'sec-fetch-dest: document' \
  151. -H 'sec-fetch-mode: navigate' \
  152. -H 'sec-fetch-site: same-origin' \
  153. -H 'sec-fetch-user: ?1' \
  154. -H 'sec-gpc: 1' \
  155. -H 'upgrade-insecure-requests: 1' \
  156. -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
  157. --compressed | pup 'div.listing-item-wrapper-inside-card json{}' | sed -n '/"datetime":/p' | sed 's/.*"datetime":"\([^"]*\)".*/\1/' | head -n 1)
  158.  
  159. if [[ -z "$datetime" ]]; then
  160. echo "Brak danych o czasie wydarzenia."
  161. else
  162. sleep 5
  163.  
  164. # Pobieranie nazwy wydarzenia
  165. event_name=$(curl -s 'https://www.eventim.pl/artist/grupa-azoty-unia-tarnow/' \
  166. -H 'authority: www.eventim.pl' \
  167. -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8' \
  168. -H 'accept-language: pl-PL,pl;q=0.5' \
  169. -H 'cache-control: max-age=0' \
  170. -H 'dnt: 1' \
  171. -H 'referer: https://www.eventim.pl/city/tarnow-2179/venues/' \
  172. -H 'sec-ch-ua: "Not_A Brand";v="8", "Chromium";v="120", "Brave";v="120"' \
  173. -H 'sec-ch-ua-mobile: ?0' \
  174. -H 'sec-ch-ua-platform: "Linux"' \
  175. -H 'sec-fetch-dest: document' \
  176. -H 'sec-fetch-mode: navigate' \
  177. -H 'sec-fetch-site: same-origin' \
  178. -H 'sec-fetch-user: ?1' \
  179. -H 'sec-gpc: 1' \
  180. -H 'upgrade-insecure-requests: 1' \
  181. -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' \
  182. --compressed | pup 'div.listing-item-wrapper-inside-card json{}' | sed -n '/"data-teaser-name":/p' | sed 's/.*"data-teaser-name":"\([^"]*\)".*/\1/' | head -n 1)
  183.  
  184. # Formatowanie i dekodowanie nazwy wydarzenia (usunięcie kodowania HTML)
  185. event_name_decoded=$(echo $event_name | sed 's/\\u0026amp;oacute;/ó/g' | sed 's/data-teaser-name: //g' | sed 's/,//g')
  186.  
  187. # Formatowanie daty
  188. 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/')
  189. formatted_date=${formatted_date//'"datetime": "'/}
  190.  
  191. event_name_decoded=$(echo $event_name_decoded | sed 's/"//g')
  192. event_name_decoded=${event_name_decoded//"data-teaser-name:"/}
  193. event_name_decoded=${event_name_decoded//" Grupa Azoty Unia Tarnów"/UNIA}
  194.  
  195.  
  196. # Wyświetlanie sformatowanej informacji o wydarzeniu
  197. echo "🤾🏻$event_name_decoded - $formatted_date🤾🏻" >> /home/z/zuzel.txt
  198. fi
  199.  
  200.  
  201.  
  202.  
  203. ###TAPETA EXTENDED
  204. cd /home/z/pogoda_tapeta/
  205.  
  206. # Path to the original image
  207. original_image="output.png"
  208.  
  209. # Path to the text file
  210. text_file="/home/z/zuzel.txt"
  211.  
  212.  
  213. convert output.png -gravity East -chop 160x0 cropped_output.png
  214. rm output.png
  215. mv cropped_output.png output.png
  216.  
  217. # Original width and the additional width
  218. original_width=1382
  219. additional_width=700
  220. new_width=$((original_width + additional_width))
  221. height=826
  222.  
  223. # Create a new blank image with additional width
  224. convert -size "${additional_width}x$height" xc:black blank.png
  225.  
  226. # Add text from the file to the new blank image
  227. #convert blank.png -font "mononoki-Regular" -pointsize 17 -fill white -gravity northwest -annotate +10+10 "@$text_file" annotated_blank.png
  228.  
  229.  
  230. # Create a temporary file that combines both text files
  231. touch combined_text.txt
  232.  
  233. cat "$text_file" > combined_text.txt
  234.  
  235. echo -e "\n" >> combined_text.txt
  236.  
  237. echo "Z kalendarza BOŻENKI:" >> combined_text.txt
  238.  
  239. sort -t '.' -k2,2n -k1,1n ~/wydarzenia.txt | head -n 6 >> combined_text.txt
  240.  
  241.  
  242.  
  243. # Add combined text from the new file to the blank image
  244. convert blank.png -font "mononoki-Regular" -pointsize 17 -fill white -gravity northwest -annotate +10+10 "@combined_text.txt" annotated_blank.png
  245.  
  246. # Clean up the temporary file
  247. rm combined_text.txt
  248.  
  249.  
  250. # Append the new blank image with text to the right of the original image
  251. convert "$original_image" annotated_blank.png +append final_image.png
  252.  
  253. # Clean up temporary images
  254. rm blank.png annotated_blank.png
  255.  
  256. feh --bg-center final_image.png
Advertisement
Add Comment
Please, Sign In to add comment