Skip to content

Commit

Permalink
fixes: 1. discarded use of 'cairosvg' module due to exe compilation i…
Browse files Browse the repository at this point in the history
…ssues

2. added binary convert.exe to convert SVG to PNG
3. added TOC to readme
  • Loading branch information
divagicha committed May 24, 2021
1 parent 2df81b8 commit 21e7243
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 30 deletions.
30 changes: 17 additions & 13 deletions CovidVaccineChecker/captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@
# from reportlab.graphics import renderPM
import PySimpleGUI as simpleGUI
import re
from PIL import Image
from cairosvg import svg2png
import os
# from PIL import Image
# from cairosvg import svg2png
# from anticaptchaofficial.imagecaptcha import imagecaptcha

captcha_svgFile = './captcha/captcha.svg'
captcha_pngFile = './captcha/captcha.png'
# captcha_pngFile = './captcha/captcha.png'
captcha_gifFile = './captcha/captcha.gif'
convert_utility = './utilities/convert.exe'


def captcha_builder(resp):
# with open(captcha_svgFile, 'w') as f:
# f.write(re.sub('(<path d=)(.*?)(fill="none"/>)', '', resp['captcha']))
#
with open(captcha_svgFile, 'w') as f:
f.write(re.sub('(<path d=)(.*?)(fill="none"/>)', '', resp['captcha']))

# drawing = svg2rlg(captcha_svgFile)
# renderPM.drawToFile(drawing, captcha_pngFile, fmt="PNG")
#
# im = Image.open(captcha_pngFile)
# im = im.convert('RGB').convert('P', palette=Image.ADAPTIVE)
# im.save(captcha_gifFile)

captcha_svg_code = re.sub('(<path d=)(.*?)(fill="none"/>)', '', resp['captcha'])
svg2png(bytestring=captcha_svg_code, write_to=captcha_pngFile)
command = f'"{convert_utility}" "{captcha_svgFile}" "{captcha_gifFile}"'
# print(f"command: {command}")
proc = os.popen(command).read()

im = Image.open(captcha_pngFile)
white_bg = Image.new("RGB", im.size, (255, 255, 255))
white_bg.paste(im, im)
white_bg.save(captcha_gifFile)
# captcha_svg_code = re.sub('(<path d=)(.*?)(fill="none"/>)', '', resp['captcha'])
# svg2png(bytestring=captcha_svg_code, write_to=captcha_pngFile)
# im = Image.open(captcha_pngFile)
# white_bg = Image.new("RGB", im.size, (255, 255, 255))
# white_bg.paste(im, im)
# white_bg.save(captcha_gifFile)

layout = [[simpleGUI.Image(captcha_gifFile)],
[simpleGUI.Text("Enter Captcha Below")],
Expand Down
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,28 @@
<a href="mailto:[email protected]">Request Feature</a>
</p>

--------------------------------

# Table of Contents
- [About The Project](#about-the-project)
- [Customizable Options in the Program](#customizable-options-in-the-program)
- [Screenshots](#screenshots)
- [Prerequisites](#prerequisites)
- [Installation (via ZIP file)](#installation-via-zip-file)
- [Installation (via EXE file)](#installation-via-exe-file) ![for windows users only](https://img.shields.io/badge/Operating%20System-Windows-green?style=plastic)
- [Contributing](#contributing)
- [Contact](#contact)


<!-- ABOUT -->
<a name="about-the-project"></a>
## About The Project

As it's a difficult task to schedule an appointment for CoVid-Vaccine with only limited slots available for each day, this script automates the whole process of checking availability of slots every 3 seconds and also books it as soon as it becomes available. Just do a **one-time configuration** by entering your preferences initially **(pincode, district, centre preference, slot timing, etc.)** and let this script do the rest.



### Customizable Options in the Program
<a name="customizable-options-in-the-program"></a>
## Customizable Options in the Program

1. State ID / Name
2. District ID / Name
Expand All @@ -62,8 +74,8 @@ As it's a difficult task to schedule an appointment for CoVid-Vaccine with only
10. Min Age Limit *(minimum age limit of the selected beneficiaries. All selected beneficiaries must belong to the same minimum age group, either 18+ or 45+)*



### Screenshots
<a name="screenshots"></a>
## Screenshots

![](./images/screenshots/1.png)

Expand All @@ -84,13 +96,15 @@ As it's a difficult task to schedule an appointment for CoVid-Vaccine with only


<!-- PREREQUISITES -->
### Prerequisites
<a name="prerequisites"></a>
## Prerequisites

This project requires **Python (3.6 or higher)** to be installed on the user system.



<!-- INSTALLATION -->
<a name="installation-via-zip-file"></a>
### Installation (via ZIP file)

1. Install **Python (3.6 or higher)** and **Git CLI (OPTIONAL)** on the system by searching for respective setups for your operaing system on Google
Expand All @@ -115,16 +129,18 @@ This project requires **Python (3.6 or higher)** to be installed on the user sys


<!-- INSTALLATION -->
### Installation (via EXE file) ![only for windows](https://img.shields.io/badge/Note-For%20Windows%20Users%20Only-green?style=plastic)
<a name="installation-via-exe-file"></a>
### Installation (via EXE file)

1. Navigate to the **'dist'** directory for the setup file or click [here](https://github.com/DivAgicha/CoWIN-Vaccine-Appointment-Booking/raw/master/dist/CovidVaccinationAppointmentScheduler-Setup-v1.1.exe) to download the same for Windows.
1. Navigate to the **'dist'** directory for the setup file or click [here](https://github.com/DivAgicha/CoWIN-Vaccine-Appointment-Booking/raw/master/dist/CovidVaccinationAppointmentScheduler-Setup-v1.2.exe) to download the same for Windows.
2. Double-click the installer file and follow the instructions to install the program.
3. Upon successful installation you will find `Covid Vaccination Appointment Scheduler` folder in your `C:\Program Files (x86)\` directory.
4. Open the folder and run `schedule_vaccination_appointment.exe` file.



<!-- CONTRIBUTING -->
<a name="contributing"></a>
## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Expand All @@ -138,6 +154,7 @@ Contributions are what make the open source community such an amazing place to l


<!-- CONTACT -->
<a name="contact"></a>
## Contact

Name - Divyansh Agicha - [[email protected]](mailto:[email protected])
Expand Down
Binary file not shown.
11 changes: 1 addition & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
cairocffi==1.2.0
CairoSVG==2.5.2
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
cssselect2==0.4.1
defusedxml==0.7.1
idna==2.10
lxml==4.6.3
Pillow==8.2.0
pycparser==2.20
PySimpleGUI==4.41.2
PySimpleGUI==4.43.0
requests==2.25.1
tabulate==0.8.9
tinycss2==1.1.0
urllib3==1.26.4
webencodings==0.5.1
Binary file added utilities/convert.exe
Binary file not shown.
102 changes: 102 additions & 0 deletions utilities/delegates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0"?>
<!DOCTYPE delegatemap [
<!ELEMENT delegatemap (delegate)+>
<!ELEMENT delegate (#PCDATA)>
<!ATTLIST delegate decode CDATA #IMPLIED>
<!ATTLIST delegate encode CDATA #IMPLIED>
<!ATTLIST delegate mode CDATA #IMPLIED>
<!ATTLIST delegate spawn CDATA #IMPLIED>
<!ATTLIST delegate stealth CDATA #IMPLIED>
<!ATTLIST delegate thread-support CDATA #IMPLIED>
<!ATTLIST delegate command CDATA #REQUIRED>
]>
<!--
Delegate command file.
Commands which specify
decode="in_format" encode="out_format"
specify the rules for converting from in_format to out_format These
rules may be used to translate directly between formats.
Commands which specify only
decode="in_format"
specify the rules for converting from in_format to some format that
ImageMagick will automatically recognize. These rules are used to
decode formats.
Commands which specify only
encode="out_format"
specify the rules for an "encoder" which may accept any input format.
For delegates other than ps:alpha, ps:color, ps:mono, and mpeg-encode the
substitution rules are as follows:
%i input image filename
%o output image filename
%u unique temporary filename
%# input image signature
%b image file size
%c input image comment
%g image geometry
%h image rows (height)
%k input image number colors
%l image label
%m input image format
%p page number
%q input image depth
%s scene number
%w image columns (width)
%x input image x resolution
%y input image y resolution
-->
<delegatemap>
<delegate decode="bpg" command="cmd.exe /c (&quot;bpgdec&quot; -b 16 -o &quot;%o.png&quot; &quot;%i&quot;) &amp; (move &quot;%o.png&quot; &quot;%o&quot; >nul)"/>
<delegate decode="png" encode="bpg" command="&quot;bpgenc&quot; -b 12 -q %~ -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="browse" stealth="True" spawn="True" command="cmd.exe /c start &quot;&quot; https://imagemagick.org/"/>
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -W -O &quot;%u.ppm&quot; &quot;%i&quot;"/>
<delegate decode="dot" command="dot -Tps &quot;%i&quot; -o &quot;%o&quot;"/>
<delegate decode="dvi" command="dvips -q -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="edit" stealth="True" command="notepad &quot;%o&quot;"/>
<delegate decode="eps" encode="pdf" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=pdfwrite &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="eps" encode="ps" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=ps2write &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="hpg" command="hp2xx -q -m eps -f &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="hpgl" command="hp2xx -q -m eps -f &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="htm" command="html2ps -U -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="html" command="html2ps -U -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="jxr" command="cmd.exe /c (move &quot;%i&quot; &quot;%i.jxr&quot; >nul) &amp; (&quot;JXRDecApp.exe&quot; -i &quot;%i.jxr&quot; -o &quot;%o.pnm&quot;) &amp; (move &quot;%i.jxr&quot; &quot;%i&quot; >nul) &amp; (move &quot;%o.pnm&quot; &quot;%o&quot; >nul)"/>
<delegate decode="pcl:cmyk" stealth="True" command="&quot;pcl6.exe&quot; -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pamcmyk32&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="pcl:color" stealth="True" command="&quot;pcl6.exe&quot; -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=ppmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="pcl:mono" stealth="True" command="&quot;pcl6.exe&quot; -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pbmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="pdf" encode="eps" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -sDEVICE=eps2write &quot;-sPDFPassword=%a&quot; &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="pdf" encode="ps" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=ps2write -&quot;sPDFPassword=%a&quot; &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="pgp" command="pgpv -fq &quot;%i&quot;"/>
<delegate decode="png" encode="launch" spawn="True" mode="encode" command="imdisplay &quot;%i&quot;" />
<delegate decode="png" encode="show" spawn="True" mode="encode" command="imdisplay &quot;%i&quot;" />
<delegate decode="png" encode="win" spawn="True" mode="encode" command="imdisplay &quot;%i&quot;" />
<delegate decode="pnm" encode="ilbm" mode="encode" command="ppmtoilbm -24if &quot;%i&quot; &gt; &quot;%o&quot;"/>
<delegate decode="pnm" encode="jxr" command="cmd.exe /c (move &quot;%i&quot; &quot;%i.pnm&quot; >nul) &amp; (&quot;JXREncApp.exe&quot; -i &quot;%i.pnm&quot; -o &quot;%o.jxr&quot;) &amp; (move &quot;%i.pnm&quot; &quot;%i&quot; >nul) &amp; (move &quot;%o.jxr&quot; &quot;%o&quot; >nul)"/>
<delegate decode="pnm" encode="wdp" command="cmd.exe /c (move &quot;%i&quot; &quot;%i.pnm&quot; >nul) &amp; (&quot;JXREncApp.exe&quot; -i &quot;%i.pnm&quot; -o &quot;%o.jxr&quot;) &amp; (move &quot;%i.pnm&quot; &quot;%i&quot; >nul) &amp; (move &quot;%o.jxr&quot; &quot;%o&quot; >nul)"/>
<delegate decode="ps:alpha" stealth="True" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pngalpha&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>
<delegate decode="ps:cmyk" stealth="True" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pamcmyk32&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>
<delegate decode="ps:color" stealth="True" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pnmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>
<delegate decode="ps" encode="eps" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=eps2write &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="ps" encode="pdf" mode="bi" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=pdfwrite &quot;-sOutputFile=%o&quot; -- &quot;%i&quot;"/>
<delegate decode="ps:mono" stealth="True" command="&quot;@PSDelegate@&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pnmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;-f%s&quot; &quot;-f%s&quot;"/>
<delegate decode="shtml" command="html2ps -U -o &quot;%o&quot; &quot;%i&quot;"/>
<delegate decode="svg" command="&quot;rsvg-convert&quot; -o &quot;%o&quot; &quot;%i&quot;"/>
<!-- Remove the extra space in - -export in the line below when you want to use inkscape -->
<!--<delegate decode="svg:decode" stealth="True" command="&quot;inkscape&quot; &quot;%s&quot; - -export-eps=&quot;%s&quot; - -export-dpi=&quot;%s&quot; - -export-background=&quot;%s&quot; - -export-background-opacity=&quot;%s&quot; &gt; &quot;%s&quot; 2&gt;&amp;1"/>-->
<delegate decode="wdp" command="cmd.exe /c (move &quot;%i&quot; &quot;%i.jxr&quot; >nul) &amp; (&quot;JXRDecApp.exe&quot; -i &quot;%i.jxr&quot; -o &quot;%o.pnm&quot;) &amp; (move &quot;%i.jxr&quot; &quot;%i&quot; >nul) &amp; (move &quot;%o.pnm&quot; &quot;%o&quot; >nul)"/>
<delegate decode="xps:cmyk" stealth="True" command="&quot;gxps.exe&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pamcmyk32&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="xps:color" stealth="True" command="&quot;gxps.exe&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pnmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="xps:mono" stealth="True" command="&quot;gxps.exe&quot; -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 &quot;-sDEVICE=pbmraw&quot; -dTextAlphaBits=%u -dGraphicsAlphaBits=%u &quot;-r%s&quot; %s &quot;-sOutputFile=%s&quot; &quot;%s&quot;"/>
<delegate decode="video:decode" command="&quot;ffmpeg.exe&quot; -nostdin -v -1 -i &quot;%i&quot; -vframes %S -vcodec pam -an -f rawvideo -y &quot;%u.pam&quot;"/>
<delegate encode="video:encode" stealth="True" command="&quot;ffmpeg.exe&quot; -nostdin -loglevel error -i &quot;%s%%d.pam&quot; %s &quot;%s.%s&quot;"/>
</delegatemap>

0 comments on commit 21e7243

Please sign in to comment.