clean + script + .env

This commit is contained in:
√(noham)²
2024-03-10 18:04:27 +01:00
parent 828e481d1d
commit 8b57eae74f
3 changed files with 12 additions and 7 deletions

3
.gitignore vendored
View File

@@ -130,3 +130,6 @@ node_modules/
back/.users
user/.env
user/cmd
user/exemple.plist
user/test2.applescript

View File

@@ -1,6 +1,11 @@
![music player](Music-Player.gif)
![diagramme](Diagramme.drawio.png)
![test](Diagramme.drawio)
# To do :
- SHA-256
- not playing state (js)
- readme
- make script proper
- comment
tail -f logfile.log

View File

@@ -10,6 +10,7 @@ from dotenv import load_dotenv
load_dotenv()
USER = os.getenv("USER")
PASSWORD = os.getenv("PASSWORD")
URL_API = os.getenv("URL_API")
stdout_file = 'logfile.log'
stderr_file = 'error_logfile.log'
@@ -57,7 +58,7 @@ def post(currentsong):
currentsong['password'] = PASSWORD
data = json.dumps(currentsong)
try:
r = requests.post(url+'/music/set', data=data, headers=headers)
r = requests.post(URL_API+'/music/set', data=data, headers=headers)
if r.status_code != 200:
return r.status_code
else :
@@ -65,10 +66,6 @@ def post(currentsong):
except Exception as e:
print(f"An error occurred: {str(e)}", file=sys.stderr)
url = "https://api.noh.am" #RUN WEB
url = "http://127.0.0.1:5000" #DEV
url = "http://0.0.0.0:3005"
headers = {'Content-Type': 'application/json'}
def main():