Skip to content

Commit

Permalink
Merge pull request #47 from sepandhaghighi/dev
Browse files Browse the repository at this point in the history
Version 0.4
  • Loading branch information
sepandhaghighi authored May 12, 2021
2 parents cec1165 + 20bee34 commit 407bb9d
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 60 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: https://github.com/sepandhaghighi/nafas#show-your-support
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "01:30"
open-pull-requests-limit: 10
target-branch: dev
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ jobs:
python -m nafas test
- name: Install dev-requirements
run: |
pip install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt
python otherfiles/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Version check
run: |
python otherfiles/version_check.py
if: matrix.python-version == 3.7
- name: Test with pytest
run: |
python -m pytest test --cov=nafas --cov-report=term
Expand All @@ -41,6 +43,8 @@ jobs:
python -m vulture nafas/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r nafas -s B311
python -m pydocstyle --match-dir=nafas -v
if: matrix.python-version == 3.7
- name: Codecov
run: |
codecov
if: matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest'
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.4] - 2021-05-12
### Added
- `start.wav`
- `well_done.wav`
- `preparing.wav`
- `requirements-splitter.py`
- 4-7-8 program
- 7-11 program
### Changed
- Sound speaker changed
- Test system modified
- Menu optimized
## [0.3] - 2021-02-09
### Changed
- Sounds bug in pypi fixed
Expand Down Expand Up @@ -38,7 +50,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Anti-Appetite program
- Cigarette Replace program

[Unreleased]: https://github.com/sepandhaghighi/nafas/compare/v0.3...dev
[Unreleased]: https://github.com/sepandhaghighi/nafas/compare/v0.4...dev
[0.4]: https://github.com/sepandhaghighi/nafas/compare/v0.3...v0.4
[0.3]: https://github.com/sepandhaghighi/nafas/compare/v0.2...v0.3
[0.2]: https://github.com/sepandhaghighi/nafas/compare/v0.1...v0.2
[0.1]: https://github.com/sepandhaghighi/nafas/compare/c58087a...v0.1
Expand Down
49 changes: 35 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* [References](https://github.com/sepandhaghighi/nafas#references)
* [Authors](https://github.com/sepandhaghighi/nafas/blob/master/AUTHORS.md)
* [License](https://github.com/sepandhaghighi/nafas/blob/master/LICENSE)
* [Donate](https://github.com/sepandhaghighi/nafas#donate-to-our-project)
* [Show Your Support](https://github.com/sepandhaghighi/nafas#show-your-support)
* [Changelog](https://github.com/sepandhaghighi/nafas/blob/master/CHANGELOG.md)
* [Code of Conduct](https://github.com/sepandhaghighi/nafas/blob/master/.github/CODE_OF_CONDUCT.md)

Expand Down Expand Up @@ -76,19 +76,19 @@ No need to walk away to take a break, just sit comfortably, run Nafas and let th
## Installation

### Source Code
- Download [Version 0.3](https://github.com/sepandhaghighi/nafas/archive/v0.3.zip) or [Latest Source ](https://github.com/sepandhaghighi/nafas/archive/dev.zip)
- Download [Version 0.4](https://github.com/sepandhaghighi/nafas/archive/v0.4.zip) or [Latest Source ](https://github.com/sepandhaghighi/nafas/archive/dev.zip)
- `pip install -r requirements.txt` or `pip3 install -r requirements.txt` (Need root access)
- `python3 setup.py install` or `python setup.py install` (Need root access)

### PyPI

- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- `pip install nafas==0.3` or `pip3 install nafas==0.3` (Need root access)
- `pip install nafas==0.4` or `pip3 install nafas==0.4` (Need root access)


### Exe Version (Only Windows)
- Download [Exe-Version 0.3](https://github.com/sepandhaghighi/nafas/releases/download/v0.3/NAFAS-0.3.exe)
- Run `NAFAS-0.3.exe`
- Download [Exe-Version 0.4](https://github.com/sepandhaghighi/nafas/releases/download/v0.4/NAFAS-0.4.exe)
- Run `NAFAS-0.4.exe`


## Usage
Expand Down Expand Up @@ -135,20 +135,41 @@ or send an email to [[email protected]](mailto:[email protected] "[email protected]").

<blockquote>6- Bujatti, M., and P. Biederer. "Serotonin, noradrenaline, dopamine metabolites in transcendental meditation-technique." Journal of Neural Transmission 39, no. 3 (1976): 257-267. </blockquote>

<blockquote>7- Martarelli, Daniele, Mario Cocchioni, Stefania Scuri, and Pierluigi Pompei. "Diaphragmatic breathing reduces exercise-induced oxidative stress." Evidence-Based Complementary and Alternative Medicine 2011 (2011). </blockquote>

<blockquote>8- <a href="https://ttsmp3.com/">Free Text-To-Speech and Text-to-MP3 for US English</a> </blockquote>
<blockquote>7- Martarelli, Daniele, Mario Cocchioni, Stefania Scuri, and Pierluigi Pompei. "Diaphragmatic breathing reduces exercise-induced oxidative stress." Evidence-Based Complementary and Alternative Medicine 2011 (2011). </blockquote>

<blockquote>8- <a href="https://www.drweil.com/health-wellness/body-mind-spirit/stress-anxiety/breathing-three-exercises/">DrWeil, Integrative Medicine & Healthy Living</a> </blockquote>

## Donate to our project
<blockquote>9- <a href="https://www.hgi.org.uk/resources/delve-our-extensive-library/resources-and-techniques/7-11-breathing-how-does-deep">Human Givens Institute</a> </blockquote>
<blockquote>10- <a href="https://ttsmp3.com/">Free Text-To-Speech and Text-to-MP3 for US English</a> </blockquote>

<h3>Bitcoin :</h3>

```1XGr9qbZjBpUQJJSB6WtgBQbDTgrhPLPA```
## Show your support
<h3>Star this repo</h3>

Give a ⭐️ if this project helped you!

<h3>Donate to our project</h3>

<h3>Payping (For Iranian citizens) :</h3>
<h4>Bitcoin</h4>
1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
<h4>Ethereum</h4>
0xcD4Db18B6664A9662123D4307B074aE968535388
<h4>Litecoin</h4>
Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
<h4>Doge</h4>
DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
<h4>Tron</h4>
TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
<h4>Ripple</h4>
rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
<h4>Binance Coin</h4>
bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
<h4>Tether</h4>
0xcD4Db18B6664A9662123D4307B074aE968535388
<h4>Dash</h4>
Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
<h4>Stellar</h4>

<a href="http://www.payping.net/sepandhaghighi" target="__blank"><img src="http://www.qpage.ir/images/payping.png" height=100px width=100px></a>
GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
3 changes: 2 additions & 1 deletion nafas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
program_name, level, program_data = get_program_data(filtered_data)
program_description_print(program_name, level, program_data)
run(program_data)
INPUTINDEX = str(input("Press [R] to restart or any other key to exit."))
INPUTINDEX = str(
input("Press [R] to restart or any other key to exit."))
if INPUTINDEX.upper() != "R":
EXIT_FLAG = True
36 changes: 20 additions & 16 deletions nafas/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""nafas functions."""

import time
from nafas.params import DESCRIPTION, STANDARD_MENU, STEP_MAP, PROGRAMS, PROGRAM_DESCRIPTION, SOUND_MAP, SOUND_ERROR_MESSAGE
from nafas.params import NAFAS_DESCRIPTION, NAFAS_NOTICE, STANDARD_MENU, STEP_MAP, PROGRAMS, PROGRAM_DESCRIPTION, SOUND_MAP, SOUND_ERROR_MESSAGE, STEP_TEMPLATE, CYCLE_TEMPLATE
import playsound
import threading
import os
Expand Down Expand Up @@ -92,8 +92,8 @@ def description_print():
:return: None
"""
print("\n".join(justify(DESCRIPTION.split(), 100)))
print("\n")
print("\n".join(justify(NAFAS_DESCRIPTION.split(), 100)))
print(NAFAS_NOTICE)


def program_description_print(program_name, level, program_data):
Expand Down Expand Up @@ -261,29 +261,33 @@ def run(program_data):
ratio = program_data["ratio"]
unit = program_data["unit"]
pre = program_data["pre"]
print("Preparing ", end="")
print("Preparing ", end="", flush=True)
sound_thread = play_sound(get_sound_path(SOUND_MAP['Prepare']))
graphic_counter(pre)
line()
time.sleep(unit / 2)
print("Start")
time.sleep(unit / 2)
time.sleep(1)
sound_thread.join()
sound_thread = play_sound(get_sound_path(SOUND_MAP['Start']))
print("Start", flush=True)
time.sleep(1)
sound_thread.join()
line()
time.sleep(unit / 2)
time.sleep(1)
for i in range(cycle):
print("Cycle : " + str(i + 1))
time.sleep(unit / 2)
print(CYCLE_TEMPLATE.format(str(i + 1), str(cycle - i - 1)))
time.sleep(1)
for index, item in enumerate(ratio):
if item != 0:
item_name = STEP_MAP[index]
sound_thread = play_sound(get_sound_path(SOUND_MAP[item_name]))
print(
"- " +
item_name +
" for {0} sec".format(
unit *
item))
STEP_TEMPLATE.format(
item_name, str(
unit * item)), flush=True)
graphic_counter(item * unit)
sound_thread.join()
time.sleep(1)
line()
print("End!")
sound_thread = play_sound(get_sound_path(SOUND_MAP['End']))
print("Well done!", flush=True)
sound_thread.join()
94 changes: 89 additions & 5 deletions nafas/params.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# -*- coding: utf-8 -*-
"""nafas parameters."""

DESCRIPTION = """
NAFAS_DESCRIPTION = """
Breathing gymnastics is a system of breathing exercises that focuses on the treatment of various diseases and general health promotion.
Nafas is a collection of breathing gymnastics designed to reduce the exhaustion of long working hours.
With multiple breathing patterns, Nafas helps you find your way to a detoxified energetic workday and also improves your concentration by increasing the oxygen level.
No need to walk away to take a break, just sit comfortably, run Nafas and let the journey begin.
"""

NAFAS_VERSION = "0.3"
NAFAS_NOTICE = """
Please consider the following :
1. Inhaling is only done through the nose
2. Exhaling, you can use both nose and mouth
3. When exhaling through your mouth, it is recommended to fold the lips
"""

NAFAS_VERSION = "0.4"

SOUND_ERROR_MESSAGE = "ERROR : Unable to play sound."

Expand All @@ -25,6 +33,10 @@
Sequence : {4}
"""

CYCLE_TEMPLATE = "Cycle : {0} (Remaining : {1})"

STEP_TEMPLATE = "- {0} for {1} sec"

STANDARD_MENU = {
"program": {
1: "Clear Mind",
Expand All @@ -34,7 +46,9 @@
5: "Harmony",
6: "Anti-Stress",
7: "Anti-Appetite",
8: "Cigarette Replace"},
8: "Cigarette Replace",
9: "4-7-8(Relaxing Breath)",
10: "7-11(Relaxing Breath)"},
"level": {
1: "Beginner",
2: "Medium",
Expand Down Expand Up @@ -72,6 +86,66 @@

HARMONY_ADVANCED = {"ratio": [1, 5, 2, 1], "unit": 3, "pre": 3, "cycle": 16}

FOUR_SEVEN_EIGHT_BEGINNER = {
"ratio": [
4,
7,
8,
0],
"unit": 1,
"pre": 3,
"cycle": 4}

FOUR_SEVEN_EIGHT_MEDIUM = {
"ratio": [
4,
7,
8,
0],
"unit": 1,
"pre": 3,
"cycle": 8}

FOUR_SEVEN_EIGHT_ADVANCED = {
"ratio": [
4,
7,
8,
0],
"unit": 1,
"pre": 3,
"cycle": 12}

SEVEN_ELEVEN_BEGINNER = {
"ratio": [
7,
0,
11,
0],
"unit": 1,
"pre": 3,
"cycle": 15}

SEVEN_ELEVEN_MEDIUM = {
"ratio": [
7,
0,
11,
0],
"unit": 1,
"pre": 3,
"cycle": 20}

SEVEN_ELEVEN_ADVANCED = {
"ratio": [
7,
0,
11,
0],
"unit": 1,
"pre": 3,
"cycle": 24}

ANTI_STRESS_BEGINNER = {
"ratio": [
3,
Expand Down Expand Up @@ -186,12 +260,22 @@
"Advanced": CIGARETTE_REPLACE_ADVANCED},
"Harmony": {"Beginner": HARMONY_BEGINNER,
"Medium": HARMONY_MEDIUM,
"Advanced": HARMONY_ADVANCED}}
"Advanced": HARMONY_ADVANCED},
"4-7-8(Relaxing Breath)": {"Beginner": FOUR_SEVEN_EIGHT_BEGINNER,
"Medium": FOUR_SEVEN_EIGHT_MEDIUM,
"Advanced": FOUR_SEVEN_EIGHT_ADVANCED},
"7-11(Relaxing Breath)": {"Beginner": SEVEN_ELEVEN_BEGINNER,
"Medium": SEVEN_ELEVEN_MEDIUM,
"Advanced": SEVEN_ELEVEN_ADVANCED}
}


SOUND_MAP = {
"Start": "start.wav",
"Prepare": "preparing.wav",
"Inhale": "inhale.wav",
"Exhale": "exhale.wav",
"Retain": "retain.wav",
"Sustain": "sustain.wav"
"Sustain": "sustain.wav",
"End": "well_done.wav",
}
Binary file modified nafas/sounds/exhale.wav
Binary file not shown.
Binary file modified nafas/sounds/inhale.wav
Binary file not shown.
Binary file added nafas/sounds/preparing.wav
Binary file not shown.
Binary file modified nafas/sounds/retain.wav
Binary file not shown.
Binary file added nafas/sounds/start.wav
Binary file not shown.
Binary file modified nafas/sounds/sustain.wav
Binary file not shown.
Binary file added nafas/sounds/well_done.wav
Binary file not shown.
8 changes: 4 additions & 4 deletions otherfiles/Version.rc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VSVersionInfo(
ffi=FixedFileInfo(
filevers=(0, 3, 0, 0),
prodvers=(0, 3, 0, 0),
filevers=(0, 4, 0, 0),
prodvers=(0, 4, 0, 0),
mask=0x3f,
flags=0x0,
OS=0x40004,
Expand All @@ -16,12 +16,12 @@ VSVersionInfo(
u'040904B0',
[StringStruct(u'CompanyName', u'Sepand Haghighi'),
StringStruct(u'FileDescription', u'NAFAS.exe'),
StringStruct(u'FileVersion', u'0.3.0.0'),
StringStruct(u'FileVersion', u'0.4.0.0'),
StringStruct(u'InternalName', u'NAFAS.exe'),
StringStruct(u'LegalCopyright', u'Copyright (c) 2021 Sepand Haghighi'),
StringStruct(u'OriginalFilename', u'NAFAS.exe'),
StringStruct(u'ProductName', u'NAFAS'),
StringStruct(u'ProductVersion', u'0, 3, 0, 0')])
StringStruct(u'ProductVersion', u'0, 4, 0, 0')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
Expand Down
Binary file modified otherfiles/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 407bb9d

Please sign in to comment.