Skip to content

Commit eb119ac

Browse files
committed
Updated README file, published release v2.1
1 parent 8dbc25b commit eb119ac

File tree

3 files changed

+44
-26
lines changed

3 files changed

+44
-26
lines changed

README.md

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55
**Molly** is an open source package for python helping handling with the booking process of CDUT Library's study.
66

7-
This branch is for python *3.7+*, If you are seeking for previous support for python 2.7+, please check out branch *v1.0+*.
7+
This branch is for python *3.7+*, If you are seeking for previous support for python 2.7+, please check out branch *v1.0+*, which still works but will not be maintained continuously.
88

99
## Installation
1010

1111
First, install all the dependencies that are required for this package.
1212
```
1313
python3 -m pip install terminaltables beautifulsoup4
1414
```
15-
Then clone all the files to your computer(mostly a server for continuous support).
15+
Then clone all the files to your computer(mostly a server to ensure availability).
1616

1717
## Contents
1818

1919
|File|Detail|
2020
|-|-|
2121
|**dinner.py**|main library file that contains all the methods that you need to handle the boring works|
22-
|**cafe.py**|main application file that automatically book a study for you in case you asked him to in advance|
22+
|**cafe.py**|main application file that automatically book a study for you in advance|
2323
|**porter.py**|application file that helps to generate booking configurations|
2424
|**kitchens.json**|the file containing all the information of the studies in CDUT library|
2525
|**credits.json**|the file containing login information|
@@ -39,7 +39,7 @@ Create a file named **credits.json** besides dinner.py with your login credentia
3939
}
4040
```
4141

42-
### dinner.py customizations
42+
### dinner.py customization
4343

4444
If you would like to use dinner directly in the terminal, simply navigate to the folder and import dinner, dinner.py will initialize itself automatically and then you are free to use all the methods.
4545

@@ -49,15 +49,18 @@ Otherwise, you may need to set `standbyMode` to `True` if you are using it in sc
4949

5050
### dinner.py api cheatsheet
5151

52+
This file contains quite a lot of methods that you may need for your application. Discover high-level usages yourself.
53+
5254
#### init()
5355

54-
Initialize the library, including checking connection to the system, loading room information from file and so on.
56+
Initialize the library, including checking the connection to the system interface, loading room information, login credits from file and so on.
5557

5658
|Parameter|Type|Default|Example|Detail|
5759
|-|-|-|-|-|
5860
|`ignoreConnectionFault`|bool|False|True|wether exit on connection failure|
61+
|`dynamicLoginCredits`|dict|None|{"user": 201906010101, "passwd": "010101"}|making the appplication more flexible|
5962

60-
Notice that if `standbyMode` is set to `True`, the script will not exit just as `ignoreConectionFault = True` will do.
63+
Notice that if `standbyMode` is set to `True`, the script will not exit just as `ignoreConectionFault = True` does.
6164

6265
|Return value|Type|Detail|
6366
|-|-|-|
@@ -173,9 +176,9 @@ Renew the room which is currently used for further 2 hours if not occupied by ot
173176

174177
|Parameter|Type|Default|Example|Detail|
175178
|-|-|-|-|-|
176-
|`bookingId`|int|`None`|393487|could be obtained using `getMyBookingInfo()`|
179+
|`bookingId`|int|`None`|393487|could be obtained using `getUserBookingInfo()`|
177180

178-
Cancel a room with the specific `bookingId` which could be got by using `getMyBookingInfo()` funcion.
181+
Cancel a room with the specific `bookingId` which could be got by using `getUserBookingInfo()` funcion.
179182
Return `True` if successful, or error message if failed.
180183

181184
|Return value|Type|Detail|
@@ -185,7 +188,7 @@ Return `True` if successful, or error message if failed.
185188
|`Exception_ConnectionTimeOut`|str|connection to remote server could not be established|
186189
|`<errorMessage>`|str|details of the failure|
187190

188-
#### getMyBookingInfo(prettified = False)
191+
#### getUserBookingInfo(prettified = False)
189192

190193
|Parameter|Type|Default|Example|Detail|
191194
|-|-|-|-|-|
@@ -194,7 +197,7 @@ Return `True` if successful, or error message if failed.
194197
Refresh the cookie and make the query, then return the booking information of the current user.
195198
Set parameter `prettified` to `True` to use terminal-tables which makes it easier to check the information returnded.
196199

197-
Notice that once you have signed up at the entrance of the study or the time(20 minutes) has passed without your signing-up, the entry will disappear from there. So you may have to use `getMyBookingHistory()` instead.
200+
Notice that once you have signed up at the entrance of the study or the time(20 minutes) has passed without your signing-up, the entry will disappear from there. So you may have to use `getUserBookingHistory()` instead.
198201

199202
|Return value|Type|Detail|
200203
|-|-|-|
@@ -203,7 +206,7 @@ Notice that once you have signed up at the entrance of the study or the time(20
203206
|`Exception_ConnectionTimeOut`|str|connection to remote server could not be established|
204207
|`Exception_DataStreamBroken`|str|process interrupted when handling data, retrying may help mostly|
205208

206-
#### getMyBookingHistory()
209+
#### getUserBookingHistory()
207210

208211
|Parameter|Type|Default|Example|Detail|
209212
|-|-|-|-|-|
@@ -217,7 +220,7 @@ Notice that once you have signed up at the entrance of the study or the time(20
217220
|`Exception_ConnectionTimeOut`|str|connection to remote server could not be established|
218221
|`Exception_DataStreamBroken`|str|process interrupted when handling data, retrying may help mostly|
219222

220-
### cafe.py automatic booking configurations
223+
### cafe.py: automatic-booking helper
221224

222225
Creat a new file named **recipe.json**, where you are free to present your booking tasks to cafe.py like this below:
223226

@@ -248,17 +251,18 @@ Creat a new file named **recipe.json**, where you are free to present your booki
248251
|Parameter|Type|Example|Detail|
249252
|-|-|-|-|
250253
|`roomId`|int|125|\|
251-
|`users`|dic|`[201906010326,201906010328]`|\|
254+
|`users`|dict|`[201906010326,201906010328]`|\|
252255
|`startAt`|str|`'2019-11-03 09:40:00'`|`startDate+" "+startTime`|
253256
|`endAt`|str|`'2019-11-03 13:40:00'`|`endDate+" "+endTime`|
254257
|`triggerAt`|str|`'2019-11-03 09:40:00'`|\|
255258

256259
The default basic configurations like debug mode, retry intervals are listed below, you are free to modify them in **cafe.py** file.
257260

258-
|Parameter|Type|Default|Detail|
261+
|Option|Type|Default|Detail|
259262
|-|-|-|-|
260-
|`recipeFileName`|str|`"recipe.json"`|\|
261-
|`refreshRecipeCycle`|int|`60`|\|
263+
|`debugMode`|bool|`True`|whether to display detailed logs|
264+
|`recipeFileName`|str|`"recipe.json"`|configuration file to import from|
265+
|`shelfDirectory`|str|`"./shelf/"`|configuration entries|
262266
|`retryTimes`|int|`5`|\|
263267
|`retryInterval`|int|`1`|\|
264268
|`standbyInterval`|int|`1`|\|
@@ -269,18 +273,32 @@ Since v2.0, cafe.py has the ability to recover its task queue after restarting,
269273

270274
All the essential process logs could be found in **beans.txt** for debugging purposes.
271275

276+
If you run cafe on server, suggesting using [supervisor](https://github.com/Supervisor/supervisor).
277+
278+
### porter.py: automatic-booking helper configurations generator
279+
280+
No documentation on this for you.
281+
272282
## Contributions
273283

274-
Notice: according to the license, you are required to make appropriate contributions to this project in case you run it. Check out [Toay's pre-mit license](https://toay.org/projects/pre-mit-license) for more information.
284+
2020/03/16, this repo is turned public.
275285

276-
You can make contributions to this project in the following ways.
286+
According to the license, you are expected to make appropriate contributions to this project in case you make use of it.
277287

288+
You can make contributions to this project in various ways.
289+
290+
* help with those listed in Todos
278291
* complete the library file **dinner.py** by add functions or making optimizations
279-
* complete the application file **cafe.py**
280-
* making your application using library **dinner.py** and publish your project using the same license
292+
* build your great application using library **dinner.py** and publish your project using the same license
293+
294+
Check out [Toay's pre-mit license](https://toay.org/projects/pre-mit-license) for more information.
295+
296+
### Todos
297+
298+
* package the project up using pypi standard and publish
281299

282300
## This and that
283301

284-
Thisn project is maintained by twikor at **[Toay laboratory](https://toay.org)**, a place where we enjoy making creative things. We hope the ones who think of themselves useful to a newly-founded non-profit studio for creators not to hesitate joining us.
302+
This project is maintained by twikor @ **[Toay laboratory](https://toay.org)**, a place where we enjoy making creative things. We hope the ones who think of themselves useful to a newly-founded non-profit studio for creators not to hesitate joining us.
285303

286-
For more information, please have a look at **[this](https://toay.org/about/signing-up)**.
304+
For more information, please have a look at **[this](https://toay.org/about/signing-up)**.

cafe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def bindFailure(details = None):
4343

4444
def sweetsOut(outputContent):
4545
if (debugMode == True):
46-
print("[MoCafe " + time.strftime('%m-%d %H:%M:%S',time.localtime(time.time())) + "] " + outputContent)
46+
print("[Molly " + time.strftime('%m-%d %H:%M:%S',time.localtime(time.time())) + "] " + outputContent)
4747

4848
# function: storing of the log data
4949

@@ -56,7 +56,7 @@ def beansOut(coffeeBeans):
5656
os.system('touch beans.txt')
5757

5858
coffeeBeansFile = open('beans.txt', 'a')
59-
contentLineToWrite = str("[MoCafe " + time.strftime('%m-%d %H:%M:%S',time.localtime(time.time())) + "] " + coffeeBeans + '\n')
59+
contentLineToWrite = str("[Molly " + time.strftime('%m-%d %H:%M:%S',time.localtime(time.time())) + "] " + coffeeBeans + '\n')
6060
coffeeBeansFile.write(contentLineToWrite)
6161
coffeeBeansFile.close()
6262

porter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
# basic settings
3030

31-
operationInitialDelay = 10
31+
operationInitialDelay = 10#minimal intervals between two operations, same trigger date
3232
shelfDirectory = "./shelf/"
3333
creditsFile = "./credits.json"
3434
recipeFile = "./recipe.json"
@@ -47,7 +47,7 @@
4747
4. port configurations to task queue\n\
4848
q. exit\n\
4949
ctrl + c to return to this menu\n\
50-
Force exit? try using duble ctrl + c twice\n\
50+
Force exit? try using ctrl + c twice\n\
5151
-----")
5252

5353
try:

0 commit comments

Comments
 (0)