A macOS application that automatically downloads cases in your reading lists from LawNet. The latest release can be found here. For the Windows version, please proceed to the Microsoft Store.
Use of the LRLD shall be subject to approval as may be required by the universities' administrators.
Presently, only Singapore Management University (SMU) accounts are supported. In the future, support may be extended to National University of Singapore (NUS) accounts.
Start screen | Downloading cases |
---|---|
Built by the law students from SMU: Gabriel Tan, Ng Jun Xuan, Wan Ding Yao
- Make sure the dependencies in requirements.txt are installed and you have Python 3.6 or higher. The dependencies should be installed in a virtual environment e.g. using
virtualenv
. - Install PySide2==5.9 with
python -m pip install --index-url=http://download.qt.io/snapshots/ci/pyside/5.9/latest pyside2 --trusted-host download.qt.io
Run mainapp.py
in your terminal
In the project directory, run:
pyi-makespec mainapp.py --onefile --windowed
This will generate a mainapp.spec
file in your project directory which provides compilation instructions to PyInstaller.
For the app to have its own name and icon, also make sure mainapp.spec
contains the following:
app = BUNDLE(exe,
name='LawNet Reading List Downloader (LRLD).app',
icon='icon.icns',
bundle_identifier=None,
info_plist={'NSPrincipalClass':'NSApplication',
'NSHighResolutionCapable': 'True'}
)
Next, go into your virtualenv folder and find the site-packages
directory. Make the following 2 changes within site-packages
:
- In the
pdfminer
folder, openpdfdocument.py
and replace all mentions of Crypto to Cryptodome. - In the
xhtml2pdf
folder, opentags.py
and replacefrom reportlab.graphics.barcode import createBarcodeDrawing
with
try:
from reportlab.graphics.barcode import createBarcodeDrawing
except:
pass
Finally, go back to the project directory and run:
pyinstaller mainapp.spec
The binaries will be located in the dist
folder.
Testing is done using the PyTest framework. VCR.py is used to save the http responses, to minimise hits to the LawNet servers. On the first testing run, a folder cassettes
will be created inside the tests
folder. Delete this folder if you want the tests to make real requests to the LawNet servers.
- Make sure to install the testing dependencies as provided inside requirements.txt.
- Create a file
credentials.py
inside thetests
folder. This file should contain 2 dicts calledlogin
andfalse_login
. Each dict should contain 2 keysusername
andpassword
.login
dict should contain correct credentials, whilefalse_login
should contain fake credentials. - Run the tests from the project root with
python -m pytest tests
.
The tests use SHA 256 to compare the downloaded files. Helper methods are provided inside tests/sha_helpers.py
to generate and write the sha to a file.