Move files to folders

This commit is contained in:
2022-01-03 20:40:02 +01:00
parent 1e0da31c99
commit d060c67197
6 changed files with 27 additions and 29 deletions

39
.vscode/launch.json vendored
View File

@ -1,21 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: FastAPI",
"type": "python",
"request": "launch",
"module": "uvicorn",
"args": [
"main:app"
],
"env": {
"DOMAIN": "http://127.0.0.1:8000/"
},
"jinja": true
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: FastAPI",
"type": "python",
"request": "launch",
"module": "uvicorn",
"args": ["discord_embed.main:app"],
"env": {
"DOMAIN": "http://127.0.0.1:8000/",
"UPLOAD_FOLDER": "uploads"
},
"jinja": true
}
]
}

View File

@ -0,0 +1 @@
__version__ = "0.1.0"

View File

@ -1,8 +1,3 @@
"""Website for uploading files, creating .HTMLs, and thumbnails.
This was created for Discord. You can use this to embed videos in Discord.
"""
import sys
from datetime import datetime
from pathlib import Path
@ -16,7 +11,7 @@ from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import guess_lexer
from settings import Settings
from discord_embed.settings import Settings
hook = Webhook(Settings.webhook_url)
app = FastAPI(
@ -61,8 +56,6 @@ def video_file_uploaded(file: UploadFile) -> Dict[str, str]:
Returns:
Dict[str, str]: Returns URL for video.
"""
# Make custom html for video files.
# Create folder if it doesn't exist.
Path(f"{Settings.upload_folder}/video").mkdir(parents=True, exist_ok=True)
@ -102,7 +95,7 @@ def text_file_uploaded(file: UploadFile) -> Dict[str, str]:
lines = file_object.read()
colored_text = highlight(
lines,
guess_lexer(lines), # Guess
guess_lexer(lines),
HtmlFormatter(
style="fruity", # Dark style
linenos="table", # Output line numbers as a table w/ two cells, one with line numbers, other with code

0
tests/__init__.py Normal file
View File

View File

@ -0,0 +1,5 @@
from discord_embed import __version__
def test_version():
assert __version__ == "0.1.0"