-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Crucial-hash
committed
May 29, 2023
0 parents
commit 257a423
Showing
64 changed files
with
770 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Crucial | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!-- markdownlint-disable-next-line --> | ||
<p align="center"> | ||
<img width="250" src="/images/logo.png" alt="Kindle Paperwhite Logo"></a> | ||
<h1 align="center">Kindle Paperwhite Clock</h1> | ||
|
||
<h1 align="center">🕔 Kindle Paperwhite Clock is a small website optimised for Kindle Paperwhite 2's for displaying the time,the next Formula 1 Grand Prix, and the next Islamic Prayer time.</h1> | ||
|
||
- The main part of this project is the [Clock Design](/images/pixel-lockscreen-clock.png) which is inspired by Google's [Material You](https://material.io/blog/announcing-material-you) Design. The lock screen is where this clock's design is from, being called the "double line" clock. | ||
|
||
- I wanted to use up the display, so I added the next Formula 1 Grand Prix to the side, this is a nice feature for knowing the dates, track, country and sessions that will occur in that specific race weekend. The information is all pulled from the [Formula 1](https://www.formula1.com/en/racing/2023.html) website as well as the track images. A future project will be trying to use their API to pull race information rather than manually inputting the data myself. | ||
|
||
- The next prayer feature is useful for knowing when the next prayer is, at least for me, I could not connect the Kindle to the internet but only to a local network. This was undesirable, as I would not be able to use any sort of online API to pull the next prayer from. I have made a workaround but it is specific to me and you may need to change some things to get it to work on your side. I have made it so I am hosting the website on my server. This server runs a Python script that scrapes the website (API in future) and grabs the prayer time and name. This is then stored in the root and pulled using javascript. The website is hosted with a no-cache setting, and is not very ideal, however, this should be improved in the near future. I have also made a transparent button in front of the text that toggles the text colour so it makes it visible or not. | ||
|
||
|
||
|
||
|
||
## 🔑 Prerequisites | ||
|
||
- Kindle Paperwhite 2 (PW2) (You may be able to use other Kindle's but the website WILL NOT be optimised). | ||
- [Jailbroken Kindle](https://www.mobileread.com/forums/showthread.php?t=346037) with [Alpine Linux](https://github.com/thomaspreece/alpine_kindle/) installed. (This is a modified version with Midori browser instead of Chromium which works better on the PW2 but for other Kindle's it should work.). | ||
- Always-on Computer (Server), There may be ways to work around this but this is what I did to access the website. (Make sure to download [Python](https://www.python.org/) and download the libraries BeautifulSoup and requests if you need to use the prayer function and [Node.js](https://nodejs.org/en) with the http-server library to host the server. | ||
|
||
|
||
|
||
|
||
## 📄 Instructions | ||
|
||
- This will be very brief but should somewhat guide you to replicating this on your own. | ||
|
||
|
||
### 🖥️ Server | ||
|
||
- Download the zip for this repository and place the files in a folder for them to be hosted in. | ||
- Open a command prompt window and type this in, http-server -c-1 make sure this is in the folder BEFORE "clock" eg: Documents when clock is at Documents/Clock note the IP address. | ||
- Now you need to make [task scheduler run the VBS file](https://github.com/Crucial-hash/kindle-paperwhite-clock/blob/main/images/vbs-task-scheduler.png) in the background [every 10 seconds](https://superuser.com/questions/293445/windows-task-scheduler-schedule-task-to-run-once-every-10-seconds) that executes the python file, this will request the new timing for the prayer update and store it in 3 files. | ||
|
||
|
||
### 📖 Kindle Paperwhite | ||
|
||
- Before booting into Alpine Linux, in the search bar type ∼ds, this will disable the screensaver, therefore, stopping the screen from turning off. | ||
- This is optional but I prefer the backlight off, you can do this by changing the brightness to the minimum | ||
- Boot into Alpine Linux through KUAL and open Midori. | ||
- Use the IP address from before, you will see a directory window and click on the "clock" folder. | ||
- Click the fullscreen icon in the top right. | ||
|
||
|
||
|
||
|
||
## 🖼️ Images | ||
<img src="/images/with-prayer.jpg" width="50%"><img src="/images/without-prayer.jpg" width="50%"> | ||
|
||
|
||
|
||
|
||
## 💡 Other Information | ||
|
||
- This project may not be maintained and if so, not regularly. | ||
- If you feel like there is an issue or an improvement to be made please do so on the issues tab. | ||
- contributing to this project will be greatly appreciated. | ||
- Thank you for reading about this project! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cd C:\Users\Crucial\Downloads\clock | ||
adhan.pyw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
from bs4 import BeautifulSoup | ||
import requests | ||
from datetime import datetime, time | ||
|
||
|
||
website = 'https://www.halaltrip.com/prayertimes/muslim-salat-prayer-times/?name=Slough&f=Slough%2C+UK&l=Slough&s=&c=United+Kingdom&lat=51.4989355&lng=-0.5612772&no_days=7&cal_method=3&asr_method=2&higher_lat=2&cruising_height=11800' #Change the URL to the placve you live | ||
result = requests.get(website) | ||
content = result.text | ||
|
||
|
||
soup = BeautifulSoup(content, 'lxml') | ||
|
||
|
||
prayerTime = soup.find('ul', class_='tm-horizontal-listitem clearfix highlighted').get_text() | ||
|
||
|
||
lines = prayerTime.split('\n')[1:-1] | ||
lines = prayerTime.split('\n')[1:-1] | ||
lines = prayerTime.split('\n')[1:-1] | ||
del lines[0] | ||
lines = [line.replace(':00', ':0') for line in lines] | ||
|
||
|
||
fajrHour, fajrMin = map(int, lines[0].split(':')) | ||
sunriseHour, sunriseMin = map(int, lines[1].replace('00', '0').split(':')) | ||
zuhrHour, zuhrMin = map(int, lines[2].replace('00', '0').split(':')) | ||
asrHour, asrMin = map(int, lines[3].split(':')) | ||
maghribHour, maghribMin = map(int, lines[4].split(':')) | ||
ishaHour, ishaMin = map(int, lines[5].split(':')) | ||
|
||
|
||
lines = [line.lstrip('0') if line[0] == '0' else line for line in lines] | ||
lines = [line[:-2] + line[-1] if line[-2] == '0' else line for line in lines] | ||
|
||
|
||
fajrHour, fajrMin = map(int, lines[0].split(':')) | ||
sunriseHour, sunriseMin = map(int, lines[1].split(':')) | ||
zuhrHour, zuhrMin = map(int, lines[2].split(':')) | ||
asrHour, asrMin = map(int, lines[3].split(':')) | ||
maghribHour, maghribMin = map(int, lines[4].split(':')) | ||
ishaHour, ishaMin = map(int, lines[5].split(':')) | ||
|
||
|
||
current_time = datetime.now().time() | ||
|
||
|
||
fajr_time = time(fajrHour, fajrMin) | ||
sunrise_time = time(sunriseHour, sunriseMin) | ||
zuhr_time = time(zuhrHour, zuhrMin) | ||
asr_time = time(asrHour, asrMin) | ||
maghrib_time = time(maghribHour, maghribMin) | ||
isha_time = time(ishaHour, ishaMin) | ||
|
||
|
||
if current_time < fajr_time: | ||
next_prayer = "Fajr" | ||
next_prayer_hour = fajrHour | ||
next_prayer_min = fajrMin | ||
elif current_time < zuhr_time: | ||
next_prayer = "Zuhr" | ||
next_prayer_hour = zuhrHour | ||
next_prayer_min = zuhrMin | ||
elif current_time < asr_time: | ||
next_prayer = "Asr" | ||
next_prayer_hour = asrHour | ||
next_prayer_min = asrMin | ||
elif current_time < maghrib_time: | ||
next_prayer = "Maghrib" | ||
next_prayer_hour = maghribHour | ||
next_prayer_min = maghribMin | ||
elif current_time < isha_time: | ||
next_prayer = "Isha" | ||
next_prayer_hour = ishaHour | ||
next_prayer_min = ishaMin | ||
else: | ||
next_prayer = "Fajr" | ||
next_prayer_hour = fajrHour | ||
next_prayer_min = fajrMin | ||
|
||
|
||
diff = datetime.combine(datetime.today(), time(next_prayer_hour, next_prayer_min)) - datetime.combine(datetime.today(), current_time) | ||
diff_seconds = diff.total_seconds() | ||
diff_hour = int(diff_seconds // 3600) | ||
diff_minute = int((diff_seconds % 3600) // 60) | ||
|
||
|
||
if diff_hour < 0: | ||
diff_hour += 24 | ||
diff_minute *= 1 | ||
|
||
|
||
with open('name.txt', 'w') as file: | ||
file.write(f'{next_prayer}\n') | ||
|
||
with open('hours.txt', 'w') as file: | ||
file.write(f'{diff_hour}\n') | ||
|
||
with open('minutes.txt', 'w') as file: | ||
file.write(f'{diff_minute}\n') | ||
|
||
|
||
if current_time < sunrise_time: | ||
sun_state = "Sunrise" | ||
sun_state_hour = sunriseHour | ||
sun_state_min = sunriseMin | ||
elif current_time >= sunrise_time and current_time < maghrib_time: | ||
sun_state = "Sunset" | ||
sun_state_hour = maghribHour | ||
sun_state_min = maghribMin | ||
else: | ||
sun_state = "Sunrise" | ||
sun_state_hour = sunriseHour | ||
sun_state_min = sunriseMin | ||
|
||
|
||
diff2 = datetime.combine(datetime.today(), time(sun_state_hour, sun_state_min)) - datetime.combine(datetime.today(), current_time) | ||
diff_seconds2 = diff2.total_seconds() | ||
diff_hour2 = int(diff_seconds2 // 3600) | ||
diff_minute2 = int((diff_seconds2 % 3600) // 60) | ||
|
||
|
||
if diff_hour2 < 0: | ||
diff_hour2 += 24 | ||
diff_minute2 *= 1 | ||
|
||
|
||
with open('sunstate.txt', 'w') as file: | ||
file.write(f'{sun_state}\n') | ||
|
||
with open('sunhours.txt', 'w') as file: | ||
file.write(f'{diff_hour2}\n') | ||
|
||
with open('sunminutes.txt', 'w') as file: | ||
file.write(f'{diff_minute2}\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Set oShell = CreateObject ("Wscript.Shell") | ||
Dim strArgs | ||
strArgs = "cmd /c C:\Users\Crucial\Downloads\clock\adhan.bat" | ||
oShell.Run strArgs, 0, false |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Kindle Paperwhite Clock</title> | ||
<link rel="icon" type="image/x-icon" href="/clock/image/logo.png"> | ||
<script src="script.js" defer></script> | ||
<link rel="stylesheet" href="style.css" | ||
<head> | ||
<body> | ||
<div class="track"> | ||
</div> | ||
|
||
<div class="sessions"> | ||
<p id="session"></p> | ||
</div> | ||
|
||
<div class="flag"> | ||
</div> | ||
|
||
<div class="raceweekend"> | ||
<p id="raceweekendtime"></p> | ||
</div> | ||
|
||
<div class="container"> | ||
<span id="hours"></span> | ||
</div> | ||
|
||
<div class="container1"> | ||
<span id="minutes"></span> | ||
</div> | ||
|
||
<div class="tracknamediv"> | ||
<span id="trackname"></span> | ||
</div> | ||
|
||
<script src="moment.min.js"></script> | ||
|
||
<button id="prayerbutton"></button> | ||
|
||
<div class="prayertextdiv" | ||
<p id="prayertext"></p> | ||
</div> | ||
|
||
<div class="suntextdiv" | ||
<p id="suntext"></p> | ||
</div> | ||
</body> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
1h 30m after race has finished show next race | ||
|
||
border of all images are 34 pixels | ||
|
||
flags need to be 2560x1536 and tracks are 997x749 (tracks are off official f1 page) | ||
|
||
03051630 - bahrain (below this time) | ||
|
||
03051630 - bahrain to saudi | ||
|
||
03191830 - saudi to australia | ||
|
||
04020730 - australia to azerbaijan (sprint) | ||
|
||
04301330 - azerbaijan to miami | ||
|
||
05072200 - miami to imola | ||
|
||
05211530 - imola to monaco | ||
|
||
05281530 - monaco to spain | ||
|
||
06041530 - spain to canada | ||
|
||
06182030 - canada to austria (sprint) | ||
|
||
07021530 - austria to britain | ||
|
||
07091630 - britain to hungary | ||
|
||
07231530 - hungary to belgium (sprint) | ||
|
||
07301530 - belgium to netherlands | ||
|
||
08271530 - netherlands to italy | ||
|
||
09031530 - italy to singapore | ||
|
||
09171430 - singapore to japan | ||
|
||
09240730 - japan to qatar (sprint) | ||
|
||
10081630 - qatar to united states (sprint) | ||
|
||
10222130 - united states to mexico | ||
|
||
10292130 - mexico to brazil (sprint) | ||
|
||
11051830 - brazil to las vegas | ||
|
||
11190730 - las vegas to abu dhabi |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.