emotionweb 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. emotionweb-0.2.2/PKG-INFO +0 -0
  2. emotionweb-0.2.2/emotionweb/generator.py +146 -0
  3. emotionweb-0.2.2/emotionweb.egg-info/PKG-INFO +0 -0
  4. emotionweb-0.2.2/setup.py +73 -0
  5. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/views.py +28 -56
  6. emotionweb-0.2.0/PKG-INFO +0 -0
  7. emotionweb-0.2.0/emotionweb/generator.py +0 -95
  8. emotionweb-0.2.0/emotionweb.egg-info/PKG-INFO +0 -0
  9. emotionweb-0.2.0/setup.py +0 -35
  10. {emotionweb-0.2.0 → emotionweb-0.2.2}/README.md +0 -0
  11. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb/__init__.py +0 -0
  12. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb/themes.py +0 -0
  13. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb.egg-info/SOURCES.txt +0 -0
  14. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb.egg-info/dependency_links.txt +0 -0
  15. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb.egg-info/requires.txt +0 -0
  16. {emotionweb-0.2.0 → emotionweb-0.2.2}/emotionweb.egg-info/top_level.txt +0 -0
  17. {emotionweb-0.2.0 → emotionweb-0.2.2}/setup.cfg +0 -0
  18. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/__init__.py +0 -0
  19. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/core/__init__.py +0 -0
  20. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/core/asgi.py +0 -0
  21. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/core/settings.py +0 -0
  22. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/core/urls.py +0 -0
  23. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/core/wsgi.py +0 -0
  24. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/manage.py +0 -0
  25. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gif1.gif +0 -0
  26. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gif2.gif +0 -0
  27. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gif3.gif +0 -0
  28. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gif4.gif +0 -0
  29. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gif5.gif +0 -0
  30. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/gitf6.gif +0 -0
  31. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/kiss.jpg.mp4 +0 -0
  32. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/gifs/pleasese.jpg.mp4 +0 -0
  33. /emotionweb-0.2.0/webengine/static/uploads/img2.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img1.jpeg +0 -0
  34. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img1.jpg +0 -0
  35. /emotionweb-0.2.0/webengine/static/uploads/img1.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img2.jpeg +0 -0
  36. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img2.jpg +0 -0
  37. /emotionweb-0.2.0/webengine/static/uploads/img4.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img3.jpeg +0 -0
  38. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img3.jpg +0 -0
  39. /emotionweb-0.2.0/webengine/static/uploads/img3.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img4.jpeg +0 -0
  40. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img4.jpg +0 -0
  41. /emotionweb-0.2.0/webengine/static/uploads/img6.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img5.jpeg +0 -0
  42. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img5.jpg +0 -0
  43. /emotionweb-0.2.0/webengine/static/uploads/img5.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img6.jpeg +0 -0
  44. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img6.jpg +0 -0
  45. /emotionweb-0.2.0/webengine/static/uploads/img8.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img7.jpeg +0 -0
  46. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img7.jpg +0 -0
  47. /emotionweb-0.2.0/webengine/static/uploads/img7.jpeg → /emotionweb-0.2.2/webengine/static/uploads/img8.jpeg +0 -0
  48. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/static/uploads/img8.jpg +0 -0
  49. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/__init__.py +0 -0
  50. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/admin.py +0 -0
  51. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/apps.py +0 -0
  52. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/migrations/__init__.py +0 -0
  53. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/models.py +0 -0
  54. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/tests.py +0 -0
  55. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/surprise/urls.py +0 -0
  56. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/anniversary.html +0 -0
  57. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/birthday.html +0 -0
  58. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/farewell.html +0 -0
  59. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/index.html +0 -0
  60. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/love.html +0 -0
  61. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/loveletter.html +0 -0
  62. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/sorry.html +0 -0
  63. {emotionweb-0.2.0 → emotionweb-0.2.2}/webengine/templates/teachers_day.html +0 -0
Binary file
@@ -0,0 +1,146 @@
1
+ import json
2
+ import webbrowser
3
+ import shutil
4
+ import os
5
+ import subprocess
6
+ import time
7
+ from pathlib import Path
8
+
9
+
10
+ class Surprise:
11
+
12
+ def __init__(
13
+ self,
14
+ type,
15
+ name,
16
+ message,
17
+ images,
18
+ caption,
19
+ ):
20
+ self.type = type
21
+ self.name = name
22
+ self.message = message
23
+ self.images = images
24
+ self.caption = caption
25
+
26
+ # Location of installed emotionweb package
27
+ self.package_dir = Path(__file__).resolve().parent
28
+
29
+ # Location of bundled webengine package
30
+ self.webengine_dir = (
31
+ self.package_dir.parent / "webengine"
32
+ )
33
+
34
+ # data.json inside bundled webengine
35
+ self.data_file = (
36
+ self.webengine_dir / "data.json"
37
+ )
38
+
39
+ # Images inside bundled webengine
40
+ self.upload_folder = (
41
+ self.webengine_dir
42
+ / "static"
43
+ / "uploads"
44
+ )
45
+
46
+ def generate(self):
47
+
48
+ # Make sure upload directory exists
49
+ self.upload_folder.mkdir(
50
+ parents=True,
51
+ exist_ok=True
52
+ )
53
+
54
+ copied = []
55
+
56
+ # Copy user images
57
+ for i, image in enumerate(self.images):
58
+
59
+ image_path = Path(image)
60
+
61
+ if not image_path.exists():
62
+
63
+ raise FileNotFoundError(
64
+ f"Image not found: {image}"
65
+ )
66
+
67
+ extension = image_path.suffix
68
+
69
+ new_name = (
70
+ f"img{i + 1}{extension}"
71
+ )
72
+
73
+ destination = (
74
+ self.upload_folder
75
+ / new_name
76
+ )
77
+
78
+ shutil.copy2(
79
+ image_path,
80
+ destination
81
+ )
82
+
83
+ copied.append(new_name)
84
+
85
+ # Create website data
86
+ data = {
87
+ "type": self.type,
88
+ "name": self.name,
89
+ "message": self.message,
90
+ "images": copied,
91
+ "caption": self.caption,
92
+ }
93
+
94
+ # Write data.json using UTF-8
95
+ with open(
96
+ self.data_file,
97
+ "w",
98
+ encoding="utf-8"
99
+ ) as file:
100
+
101
+ json.dump(
102
+ data,
103
+ file,
104
+ indent=4,
105
+ ensure_ascii=False
106
+ )
107
+
108
+ # Check that Django exists
109
+ manage_file = (
110
+ self.webengine_dir / "manage.py"
111
+ )
112
+
113
+ if not manage_file.exists():
114
+
115
+ raise FileNotFoundError(
116
+ "EmotionWeb Django engine not found:\n"
117
+ f"{manage_file}"
118
+ )
119
+
120
+ # Start Django in a new Windows terminal
121
+ subprocess.Popen(
122
+ [
123
+ "cmd",
124
+ "/c",
125
+ "start",
126
+ "cmd",
127
+ "/k",
128
+ "python",
129
+ str(manage_file),
130
+ "runserver",
131
+ "127.0.0.1:2039",
132
+ ],
133
+ cwd=str(self.webengine_dir)
134
+ )
135
+
136
+ # Give Django time to start
137
+ time.sleep(3)
138
+
139
+ # Open browser
140
+ webbrowser.open(
141
+ "http://127.0.0.1:2039"
142
+ )
143
+
144
+ print(
145
+ "Website generated successfully!"
146
+ )
@@ -0,0 +1,73 @@
1
+ from setuptools import setup, find_packages
2
+
3
+
4
+ with open("README.md", "r", encoding="utf-8") as file:
5
+ long_description = file.read()
6
+
7
+
8
+ setup(
9
+ name="emotionweb",
10
+
11
+ version="0.2.2",
12
+
13
+ description=(
14
+ "Create personalized and interactive surprise websites "
15
+ "with Python, customizable messages, images, captions, "
16
+ "and a Django-powered web engine."
17
+ ),
18
+
19
+ long_description=long_description,
20
+ long_description_content_type="text/markdown",
21
+
22
+ author="Aniket Vishwakarma",
23
+ author_email="aniketvishwa39@gmail.com",
24
+
25
+ url="https://github.com/aniketvishwakarma39/emotionweb",
26
+
27
+ project_urls={
28
+ "GitHub": "https://github.com/aniketvishwakarma39/emotionweb",
29
+ "LinkedIn": "https://lnkd.in/p/dhGgA-cK",
30
+ "PyPI": "https://pypi.org/project/emotionweb/",
31
+ },
32
+
33
+ packages=find_packages(),
34
+
35
+ include_package_data=True,
36
+
37
+ package_data={
38
+ "webengine": [
39
+ "templates/*.html",
40
+ "static/gifs/*",
41
+ "static/uploads/*",
42
+ ],
43
+ },
44
+
45
+ install_requires=[
46
+ "Django>=4.2",
47
+ ],
48
+
49
+ python_requires=">=3.10",
50
+
51
+ classifiers=[
52
+ "Development Status :: 4 - Beta",
53
+ "Intended Audience :: Developers",
54
+ "Topic :: Software Development :: Libraries :: Python Modules",
55
+ "Programming Language :: Python :: 3",
56
+ "Programming Language :: Python :: 3.10",
57
+ "Programming Language :: Python :: 3.11",
58
+ "Programming Language :: Python :: 3.12",
59
+ "Framework :: Django",
60
+ "License :: OSI Approved :: MIT License",
61
+ ],
62
+
63
+ keywords=[
64
+ "python",
65
+ "django",
66
+ "python-library",
67
+ "python-package",
68
+ "pypi",
69
+ "surprise-websites",
70
+ "personalized-websites",
71
+ "web-development",
72
+ ],
73
+ )
@@ -1,75 +1,60 @@
1
1
  import json
2
+ from pathlib import Path
3
+
2
4
  from django.shortcuts import render
3
5
 
6
+
4
7
  def surprise(request):
5
8
 
6
- with open("../data.json", "r",encoding="utf-8") as file:
9
+ data_file = Path(__file__).resolve().parent.parent / "data.json"
10
+
11
+ with open(
12
+ data_file,
13
+ "r",
14
+ encoding="utf-8"
15
+ ) as file:
7
16
 
8
17
  data = json.load(file)
9
18
 
10
19
  if data.get("type") == "love":
11
20
 
12
21
  return render(
13
-
14
22
  request,
15
-
16
23
  "love.html",
17
-
18
24
  {
19
-
20
25
  "name": data["name"],
21
-
22
26
  "message": data["message"],
23
-
24
27
  "images": data["images"],
25
-
26
28
  "caption": data["caption"]
27
-
28
29
  }
29
-
30
30
  )
31
31
 
32
32
  elif data.get("type") == "birthday":
33
33
 
34
34
  return render(
35
-
36
35
  request,
37
-
38
36
  "birthday.html",
39
-
40
37
  {
41
-
42
38
  "name": data["name"],
43
-
44
39
  "message": data["message"],
45
-
46
40
  "images": data["images"],
47
-
48
41
  "caption": data["caption"]
49
-
50
42
  }
51
-
52
43
  )
53
- elif data["type"] == "anniversary":
54
44
 
55
- return render(
56
-
57
- request,
58
-
59
- "anniversary.html",
60
-
61
- {
62
-
63
- "name": data["name"],
64
-
65
- "message": data["message"],
66
-
67
- "images": data["images"],
45
+ elif data["type"] == "anniversary":
68
46
 
69
- "caption": data["caption"]
47
+ return render(
48
+ request,
49
+ "anniversary.html",
50
+ {
51
+ "name": data["name"],
52
+ "message": data["message"],
53
+ "images": data["images"],
54
+ "caption": data["caption"]
55
+ }
56
+ )
70
57
 
71
- }
72
- )
73
58
  elif data["type"] == "loveletter":
74
59
 
75
60
  return render(
@@ -77,40 +62,27 @@ def surprise(request):
77
62
  "loveletter.html",
78
63
  {
79
64
  "name": data["name"],
80
-
81
- "message": data["message"],
82
-
83
- "images": data["images"],
65
+ "message": data["message"],
66
+ "images": data["images"],
84
67
  }
85
68
  )
86
- elif data["type"] == "apology":
87
-
88
- return render(
89
69
 
90
- request,
91
-
92
- "sorry.html",
70
+ elif data["type"] == "apology":
93
71
 
72
+ return render(
73
+ request,
74
+ "sorry.html",
75
+ )
94
76
 
95
- )
96
77
  else:
97
78
 
98
79
  return render(
99
-
100
80
  request,
101
-
102
81
  "love.html",
103
-
104
82
  {
105
-
106
83
  "name": data["name"],
107
-
108
84
  "message": data["message"],
109
-
110
85
  "images": data["images"],
111
-
112
86
  "caption": data["caption"]
113
-
114
87
  }
115
-
116
88
  )
emotionweb-0.2.0/PKG-INFO DELETED
Binary file
@@ -1,95 +0,0 @@
1
- import json
2
- import webbrowser
3
- import shutil
4
- import os
5
- import subprocess
6
- import time
7
-
8
-
9
- class Surprise:
10
-
11
- def __init__(
12
- self,
13
- type,
14
- name,
15
- message,
16
- images,
17
- caption,
18
- ):
19
- self.type = type
20
- self.name = name
21
- self.message = message
22
- self.images = images
23
- self.caption = caption
24
-
25
- def generate(self):
26
-
27
- upload_folder = "webengine/static/uploads"
28
-
29
- os.makedirs(
30
- upload_folder,
31
- exist_ok=True
32
- )
33
-
34
- copied = []
35
-
36
- for i, image in enumerate(self.images):
37
-
38
- ext = image.split(".")[-1]
39
-
40
- new_name = f"img{i+1}.{ext}"
41
-
42
- shutil.copy(
43
- image,
44
- f"{upload_folder}/{new_name}"
45
- )
46
-
47
- copied.append(
48
- new_name
49
- )
50
-
51
- data = {
52
- "type": self.type,
53
- "name": self.name,
54
- "message": self.message,
55
- "images": copied,
56
- "caption": self.caption,
57
- }
58
-
59
- with open(
60
- "data.json",
61
- "w",
62
- encoding="utf-8"
63
- ) as file:
64
-
65
- json.dump(
66
- data,
67
- file,
68
- indent=4,
69
- ensure_ascii=False
70
- )
71
-
72
- # Start Django server in a new terminal
73
- subprocess.Popen(
74
- [
75
- "cmd",
76
- "/c",
77
- "start",
78
- "cmd",
79
- "/k",
80
- "python manage.py runserver 127.0.0.1:2039"
81
- ],
82
- cwd="webengine"
83
- )
84
-
85
- # Give Django a moment to start
86
- time.sleep(3)
87
-
88
- # Open website
89
- webbrowser.open(
90
- "http://127.0.0.1:2039"
91
- )
92
-
93
- print(
94
- "Website generated successfully!"
95
- )
emotionweb-0.2.0/setup.py DELETED
@@ -1,35 +0,0 @@
1
- from pathlib import Path
2
- from setuptools import setup, find_packages
3
-
4
-
5
- BASE_DIR = Path(__file__).parent
6
- README = (BASE_DIR / "README.md").read_text(encoding="utf-8")
7
-
8
-
9
- setup(
10
- name="emotionweb",
11
- version="0.2.0",
12
-
13
- description="Generate personalized surprise websites using Python and Django.",
14
-
15
- long_description=README,
16
- long_description_content_type="text/markdown",
17
-
18
- author="Aniket Vishwakarma",
19
- author_email="aniketvishwa39@gmail.com",
20
-
21
- packages=find_packages(),
22
-
23
- install_requires=[
24
- "Django>=4.2",
25
- ],
26
-
27
- package_data={
28
- "webengine": [
29
- "templates/*.html",
30
- "static/**/*",
31
- ],
32
- },
33
-
34
- include_package_data=True,
35
- )
File without changes
File without changes