Unit3Dup 0.8.15__py3-none-any.whl → 0.8.16__py3-none-any.whl

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.
common/settings.py CHANGED
@@ -13,7 +13,7 @@ from common.utility import ManageTitles
13
13
  from common import trackers
14
14
 
15
15
  config_file = "Unit3Dbot.json"
16
- version = "0.8.15"
16
+ version = "0.8.16"
17
17
 
18
18
  if os.name == "nt":
19
19
  PW_TORRENT_ARCHIVE_PATH: Path = Path(os.getenv("LOCALAPPDATA", ".")) / "Unit3Dup_config" / "pw_torrent_archive"
unit3dup/bot.py CHANGED
@@ -54,6 +54,10 @@ class Bot:
54
54
  """
55
55
  custom_console.panel_message("Analyzing your media files... Please wait")
56
56
 
57
+ if not os.path.exists(self.path):
58
+ custom_console.bot_error_log("Path doesn't exist")
59
+ return False
60
+
57
61
  # Get a Files list with basic attributes and create a content object for each
58
62
  self.content_manager: ContentManager = ContentManager(path=self.path, mode=self.mode, cli=self.cli)
59
63
  contents = self.content_manager.process()
@@ -63,10 +67,6 @@ class Bot:
63
67
  custom_console.bot_error_log("There are no Media to process")
64
68
  return False
65
69
 
66
- if not os.path.exists(self.path):
67
- custom_console.bot_error_log("Path doesn't exist")
68
- return False
69
-
70
70
  # we got a handled exception
71
71
  if contents is None:
72
72
  exit(1)
@@ -178,19 +178,6 @@ class Bot:
178
178
  custom_console.bot_log("Exiting...")
179
179
  return True
180
180
 
181
- def pw(self)-> bool:
182
- """
183
- Interacts with the PW service to search for torrent files
184
-
185
- This method performs a search query and logs the results for torrents with
186
- a certain number of seeders
187
- """
188
- # PW service
189
- pw_manager = PwManager(cli=self.cli)
190
- pw_manager.process()
191
- custom_console.panel_message("Searching... Please wait")
192
- return True
193
-
194
181
 
195
182
  def ftp(self)-> None:
196
183
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Unit3Dup
3
- Version: 0.8.15
3
+ Version: 0.8.16
4
4
  Summary: An uploader for the Unit3D torrent tracker
5
5
  Author: Parzival
6
6
  License-Expression: MIT
@@ -8,7 +8,7 @@ common/extractor.py,sha256=WKZwt2kQfKO2VJ1rtwE_j6Zl84zICnowZq_Ql16wmRc,4564
8
8
  common/frames.py,sha256=p_jsaXII5tZTVt5ymu-w1hk2c_UMeOn3PZeuVR-wXWY,7973
9
9
  common/mediainfo.py,sha256=U2r1jJejBsV8GP3iPk4O8_NkHO5RQ9Kkh2bKwVNUBmg,6229
10
10
  common/mediainfo_string.py,sha256=8vuWlF2bqWRKpDbn81bV2fPA7hbl7RwOnxN2i4E3zNE,3958
11
- common/settings.py,sha256=pGdw3qAC_fqSncyxqRNRYec3N75EhiUWTS5wy8JV8CE,32782
11
+ common/settings.py,sha256=Lpr3MRybihcsdh27bEnSg1VxCIXRrpKZMn39mtY1Gw8,32782
12
12
  common/title.py,sha256=nFainfUBTYW9ML4Y-CB9ZFD_Es-OZXcAMPUo6D09u3k,3793
13
13
  common/torrent_clients.py,sha256=NOIpYtLG_bA19HwcH9ahGFmGNtRkoMO6nAjma-JzDfs,12040
14
14
  common/utility.py,sha256=r5MuFrafAzSJbe7DLx8uMKSG1qQi8k6oA43Y_qJhH7A,8647
@@ -65,7 +65,7 @@ common/trackers/trackers.py,sha256=sts5l_x27V2Op1Y6Au5FoQujspSkWMPWyEYMfcmVYLA,1
65
65
  unit3dup/__init__.py,sha256=seXz3lHgdrUBiOnhC6Je47npS66UZ0c62VFuoH3z5Mk,78
66
66
  unit3dup/__main__.py,sha256=DBhzZdUi19N1-WTBQJbps9wQKNcNhwreaXwXQtFORHs,9088
67
67
  unit3dup/automode.py,sha256=HIJrE8qEHp7DZQbppNtB_8jHY3Q94d6frp7BXnZuEac,4387
68
- unit3dup/bot.py,sha256=dgmFaXHb_F992EF67tvXqHJ0nvfhpE2CwIjrGT-O9wo,9188
68
+ unit3dup/bot.py,sha256=2P24z_8UM58binKqrM0eIXxPTiWEduyK2bdfVkmxPEQ,8759
69
69
  unit3dup/duplicate.py,sha256=Ji1Y9vVLmhFQ5rgkUU-s7uXl-jC8akAa8OiQOfjFa9g,10428
70
70
  unit3dup/exceptions.py,sha256=DhlcbbZEuvEYk5VSZTnle8oRg5I8Pq6Y6fxXTdOOOfo,4078
71
71
  unit3dup/media.py,sha256=5suH2XeekB80zNoIAM8PERZBO746JDlpcIvHz-4jY9E,13888
@@ -86,11 +86,13 @@ unit3dup/media_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
86
86
  unit3dup/media_manager/common.py,sha256=hG2zOw7ocQfZyI1dhusbehxswpIrZK7T2aAbCNwULqA,10138
87
87
  unit3dup/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  unit3dup/web/main.py,sha256=BzjKDgAjKZMnoQwx7nDDbs_64kCrFO1VYpbHmsGiFVc,1267
89
- unit3dup-0.8.15.dist-info/licenses/LICENSE,sha256=GNAZDLhU0xz8QPbIyHAOYlVnQYDvKWk2N9fZJMhqaG8,1090
89
+ unit3dup-0.8.16.dist-info/licenses/LICENSE,sha256=GNAZDLhU0xz8QPbIyHAOYlVnQYDvKWk2N9fZJMhqaG8,1090
90
90
  view/__init__.py,sha256=XIzb6rl58HmYPnksD73cYMFF88dn6FHa3u7bOHFbChk,81
91
91
  view/custom_console.py,sha256=OITmkEoQH9N_uE5ElPaSdc8XvaLzE9wcwTbOHtcMvrI,5629
92
- unit3dup-0.8.15.dist-info/METADATA,sha256=wWNaUq7iZ_jCVHSHMNBDdQMaCSwlwORirOzhSi69nUg,4864
93
- unit3dup-0.8.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
94
- unit3dup-0.8.15.dist-info/entry_points.txt,sha256=fxXSyI6-r6jy9_v-C5ZHm03q1aC3tE9EvCQZxC1NQnI,52
95
- unit3dup-0.8.15.dist-info/top_level.txt,sha256=19NVMnQNkJxBUKebRNaYCRs56A5CO4U1L67GMQCPiLU,21
96
- unit3dup-0.8.15.dist-info/RECORD,,
92
+ view/custom_console2.py,sha256=ipNoZWz1YO5iOp-vIH3PrWoBzpiAxdW6gdsijKSEg7c,6137
93
+ view/settings.py,sha256=dSabnCfUGqPS8w1a2B_O_GF_eT9GsxBDRp7Yzf6RDF8,1289
94
+ unit3dup-0.8.16.dist-info/METADATA,sha256=6b9LonXp-zhs5cbxezMrA9RErDDuB4wvoDLsjAsNjRM,4864
95
+ unit3dup-0.8.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
96
+ unit3dup-0.8.16.dist-info/entry_points.txt,sha256=fxXSyI6-r6jy9_v-C5ZHm03q1aC3tE9EvCQZxC1NQnI,52
97
+ unit3dup-0.8.16.dist-info/top_level.txt,sha256=19NVMnQNkJxBUKebRNaYCRs56A5CO4U1L67GMQCPiLU,21
98
+ unit3dup-0.8.16.dist-info/RECORD,,
@@ -0,0 +1,139 @@
1
+ from nicegui import ui
2
+ from typing import List, Callable
3
+ from common import config_settings
4
+ from datetime import datetime
5
+
6
+
7
+ class NiceGUIConsole:
8
+ def __init__(self):
9
+ self.init_footer_log()
10
+ self.log_area = ui.column().style('max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px')
11
+ self.counter_label = ui.label()
12
+
13
+ def init_footer_log(self):
14
+ with ui.element('div').style('''
15
+ position: fixed;
16
+ bottom: 0;
17
+ left: 0;
18
+ width: 100%;
19
+ background-color: #2e3b4e;
20
+ text-align: center;
21
+ padding: 4px 8px; /* meno padding verticale */
22
+ font-size: 14px;
23
+ line-height: 18px;
24
+ z-index: 1000;
25
+ ''') as footer:
26
+ self.footer_label = ui.label("Ready.").style("color: white; margin: 0")
27
+
28
+ def log_message(self, message: str, color: str = "#ffffff"):
29
+ timestamp = datetime.now().strftime("%H:%M:%S")
30
+ """
31
+ with self.log_area:
32
+ ui.label(f"[{timestamp}] {message}").style(f'color: {color}; white-space: pre-wrap')
33
+ """
34
+ self.footer_label.text = f"${timestamp}$ {message}"
35
+ self.footer_label.style(f"color: {color}")
36
+
37
+
38
+ def panel_message(self, message: str, color: str = "#ccc"):
39
+ with ui.card().style(f'background-color: {color}; color: white'):
40
+ ui.label(message).style("text-align: center")
41
+
42
+ def bot_log(self, message: str):
43
+ self._add_log(message, config_settings.console_options.NORMAL_COLOR)
44
+
45
+ def bot_error_log(self, message: str):
46
+ self._add_log(f'❌ {message}', config_settings.console_options.ERROR_COLOR)
47
+
48
+ def bot_warning_log(self, message: str):
49
+ self._add_log(f'⚠️ {message}', config_settings.console_options.QUESTION_MESSAGE_COLOR)
50
+
51
+ def bot_input_log(self, message: str):
52
+ self._add_log(message, config_settings.console_options.NORMAL_COLOR)
53
+
54
+ def bot_question_log(self, message: str):
55
+ self._add_log(message, config_settings.console_options.QUESTION_MESSAGE_COLOR)
56
+
57
+ def bot_counter_log(self, message: str):
58
+ self.counter_label.set_text(message)
59
+ self.counter_label.style(f'color: {config_settings.console_options.QUESTION_MESSAGE_COLOR}')
60
+
61
+ def bot_process_table_log(self, content: List):
62
+ ui.label("Here is your files list" if content else "There are no files here")
63
+ ui.table(columns=[
64
+ {'name': 'pack', 'label': 'Torrent Pack', 'field': 'pack'},
65
+ {'name': 'category', 'label': 'Media', 'field': 'category'},
66
+ {'name': 'path', 'label': 'Path', 'field': 'path'},
67
+ ], rows=[
68
+ {
69
+ 'pack': 'Yes' if item.torrent_pack else 'No',
70
+ 'category': item.category,
71
+ 'path': item.torrent_path,
72
+ } for item in content
73
+ ])
74
+
75
+ def bot_process_table_pw(self, content: List):
76
+ ui.label("Here is your files list" if content else "There are no files here")
77
+ ui.table(columns=[
78
+ {'name': 'category', 'label': 'Category', 'field': 'category'},
79
+ {'name': 'indexer', 'label': 'Indexer', 'field': 'indexer'},
80
+ {'name': 'title', 'label': 'Title', 'field': 'title'},
81
+ {'name': 'size', 'label': 'Size', 'field': 'size'},
82
+ {'name': 'seeders', 'label': 'Seeders', 'field': 'seeders'},
83
+ ], rows=[
84
+ {
85
+ 'category': item.categories[0]['name'],
86
+ 'indexer': item.indexer,
87
+ 'title': item.title,
88
+ 'size': str(item.size),
89
+ 'seeders': str(item.seeders),
90
+ } for item in content
91
+ ])
92
+
93
+ def bot_tmdb_table_log(self, result, title: str, media_info_language: List[str]):
94
+ media_info_audio_languages = ", ".join(media_info_language).upper()
95
+ self.panel_message(f"Results for {title.upper()}")
96
+
97
+ ui.table(columns=[
98
+ {'name': 'tmdb_id', 'label': 'TMDB ID', 'field': 'tmdb_id'},
99
+ {'name': 'language', 'label': 'LANGUAGE', 'field': 'language'},
100
+ {'name': 'poster', 'label': 'TMDB POSTER', 'field': 'poster'},
101
+ {'name': 'backdrop', 'label': 'TMDB BACKDROP', 'field': 'backdrop'},
102
+ ], rows=[{
103
+ 'tmdb_id': str(result.video_id),
104
+ 'language': media_info_audio_languages,
105
+ 'poster': result.poster_path,
106
+ 'backdrop': result.backdrop_path,
107
+ }])
108
+
109
+ def wait_for_user_confirmation(self, message: str, on_confirm: Callable):
110
+ self.bot_error_log(message)
111
+ with ui.row():
112
+ ui.button("OK", on_click=on_confirm)
113
+ ui.button("Cancel",
114
+ on_click=lambda: self.bot_error_log("Operation cancelled. Please update your config file."))
115
+
116
+ def user_input(self, message: str, on_submit: Callable[[int], None]):
117
+ with ui.row():
118
+ input_field = ui.input(label=message, placeholder="Enter TMDB ID").props("type=number")
119
+ ui.button("Submit", on_click=lambda: self._validate_and_submit(input_field.value, on_submit))
120
+
121
+ def user_input_str(self, message: str, on_submit: Callable[[str], None]):
122
+ with ui.row():
123
+ input_field = ui.input(label=message, placeholder="Enter text")
124
+ ui.button("Submit", on_click=lambda: on_submit(input_field.value or "0"))
125
+
126
+ def _add_log(self, message: str, color: str = "#fff"):
127
+ timestamp = datetime.now().strftime("%H:%M:%S")
128
+ with self.log_area:
129
+ ui.label(f"[{timestamp}] {message}").style(f'color: {color}; white-space: pre-wrap')
130
+
131
+ def _validate_and_submit(self, value: str, on_submit: Callable[[int], None]):
132
+ try:
133
+ if value.isdigit():
134
+ user_id = int(value)
135
+ on_submit(user_id if user_id < 9999999 else 0)
136
+ else:
137
+ self.bot_error_log("Please enter a valid number.")
138
+ except Exception as e:
139
+ self.bot_error_log(f"Error: {str(e)}")
view/settings.py ADDED
@@ -0,0 +1,31 @@
1
+ from nicegui import ui
2
+
3
+ class SettingsPanel:
4
+ def __init__(self):
5
+ with ui.column().classes('items-center q-pa-xl'):
6
+
7
+ # Header
8
+ ui.label("Settings").style('font-size: 32px; font-weight: bold; color: #2e3b4e')
9
+
10
+ # Settings card
11
+ with ui.card().style('max-width: 400px; width: 100%; padding: 20px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1)'):
12
+
13
+ self._setting_group("Account Settings", [
14
+ ("Enable notifications", True),
15
+ ("Allow email updates", False),
16
+ ])
17
+
18
+ ui.separator().style("margin: 20px 0")
19
+
20
+ self._setting_group("Privacy", [
21
+ ("Location tracking", False),
22
+ ("Data sharing", True),
23
+ ])
24
+
25
+ def _setting_group(self, title: str, settings: list[tuple[str, bool]]):
26
+ ui.label(title).style('font-size: 18px; font-weight: 500; margin-bottom: 10px; color: #333')
27
+
28
+ for label_text, default_value in settings:
29
+ with ui.row().style('justify-content: space-between; align-items: center; margin-bottom: 12px'):
30
+ ui.label(label_text).style("font-size: 14px; color: #555")
31
+ ui.switch(value=default_value)