Unit3Dup 0.8.16__py3-none-any.whl → 0.8.17__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/command.py +1 -0
- common/settings.py +1 -1
- common/utility.py +1 -0
- unit3dup/__main__.py +1 -2
- unit3dup/media.py +0 -6
- unit3dup/media_manager/ContentManager.py +4 -4
- unit3dup/torrent.py +9 -8
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/METADATA +1 -1
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/RECORD +14 -15
- view/web_console.py +205 -0
- view/custom_console2.py +0 -139
- view/settings.py +0 -31
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/WHEEL +0 -0
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/entry_points.txt +0 -0
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/licenses/LICENSE +0 -0
- {unit3dup-0.8.16.dist-info → unit3dup-0.8.17.dist-info}/top_level.txt +0 -0
common/command.py
CHANGED
|
@@ -48,6 +48,7 @@ class CommandLine:
|
|
|
48
48
|
# optional
|
|
49
49
|
parser.add_argument("-dump", "--dump", action="store_true", help="Download all torrent titles")
|
|
50
50
|
parser.add_argument("-s", "--search", type=str, help="Search for torrent")
|
|
51
|
+
parser.add_argument("-db", "--dbsave", action="store_true", help="Save the search results")
|
|
51
52
|
parser.add_argument("-i", "--info", type=str, help="Get info on torrent")
|
|
52
53
|
parser.add_argument("-up", "--uploader", type=str, help="Search by uploader")
|
|
53
54
|
parser.add_argument("-desc", "--description", type=str, help="Search by description")
|
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.
|
|
16
|
+
version = "0.8.17"
|
|
17
17
|
|
|
18
18
|
if os.name == "nt":
|
|
19
19
|
PW_TORRENT_ARCHIVE_PATH: Path = Path(os.getenv("LOCALAPPDATA", ".")) / "Unit3Dup_config" / "pw_torrent_archive"
|
common/utility.py
CHANGED
unit3dup/__main__.py
CHANGED
unit3dup/media.py
CHANGED
|
@@ -14,7 +14,6 @@ class Media:
|
|
|
14
14
|
self.folder: str = folder
|
|
15
15
|
self.subfolder: str = subfolder
|
|
16
16
|
self.title: str = os.path.basename(os.path.join(self.folder, self.subfolder))
|
|
17
|
-
self._not_title_lang = False
|
|
18
17
|
|
|
19
18
|
# // Media
|
|
20
19
|
self._crew_list: list[str] | None = None
|
|
@@ -53,9 +52,6 @@ class Media:
|
|
|
53
52
|
self._igdb_id: int | None = None
|
|
54
53
|
self._generate_title: str | None = None
|
|
55
54
|
|
|
56
|
-
@property
|
|
57
|
-
def no_title_lang(self) -> bool:
|
|
58
|
-
return self._not_title_lang
|
|
59
55
|
|
|
60
56
|
@property
|
|
61
57
|
def title_sanitized(self)-> str:
|
|
@@ -283,8 +279,6 @@ class Media:
|
|
|
283
279
|
if converted_code := ManageTitles.convert_iso(code):
|
|
284
280
|
self._audio_languages = converted_code
|
|
285
281
|
return self._audio_languages
|
|
286
|
-
# no language found in title
|
|
287
|
-
self._not_title_lang = True
|
|
288
282
|
# get from the audio track
|
|
289
283
|
self._audio_languages = self.languages
|
|
290
284
|
return self._audio_languages
|
|
@@ -51,10 +51,6 @@ class ContentManager:
|
|
|
51
51
|
content = self.get_data(media=media)
|
|
52
52
|
if content:
|
|
53
53
|
contents.append(content)
|
|
54
|
-
|
|
55
|
-
# Add language to the title from the media file when it's absent
|
|
56
|
-
if not media._not_title_lang:
|
|
57
|
-
media.display_name = " ".join([media.display_name] + media.audio_languages)
|
|
58
54
|
return contents
|
|
59
55
|
|
|
60
56
|
def get_data(self, media: Media) -> Media | bool:
|
|
@@ -93,6 +89,10 @@ class ContentManager:
|
|
|
93
89
|
media.igdb_id = self.igdb_id
|
|
94
90
|
media.display_name = self.display_name
|
|
95
91
|
|
|
92
|
+
# Add language to the title from the media file when it's absent
|
|
93
|
+
for found_languages in media.audio_languages:
|
|
94
|
+
if found_languages not in media.display_name:
|
|
95
|
+
media.display_name = f"{media.display_name} {found_languages}"
|
|
96
96
|
return media
|
|
97
97
|
else:
|
|
98
98
|
return False
|
unit3dup/torrent.py
CHANGED
|
@@ -174,7 +174,7 @@ class View(Torrent):
|
|
|
174
174
|
f" -> {item['attributes']['name']}"
|
|
175
175
|
)
|
|
176
176
|
|
|
177
|
-
def print_normal(self, tracker_data: dict):
|
|
177
|
+
def print_normal(self, tracker_data: dict, save= False):
|
|
178
178
|
data = [item for item in tracker_data["data"]]
|
|
179
179
|
for item in data:
|
|
180
180
|
if item['attributes']['tmdb_id'] != 0:
|
|
@@ -192,13 +192,14 @@ class View(Torrent):
|
|
|
192
192
|
|
|
193
193
|
# Print a data to the console
|
|
194
194
|
custom_console.bot_log(f"\n {media} - {item['attributes']['name']}")
|
|
195
|
-
# Save torrent data into database
|
|
196
|
-
|
|
195
|
+
# Save torrent data into database by -db flag
|
|
196
|
+
if save:
|
|
197
|
+
self.database.write(item['attributes'])
|
|
197
198
|
|
|
198
199
|
|
|
199
|
-
def page_view(self, tracker_data: dict, tracker: pvtTracker, info=False, inkey=True):
|
|
200
|
+
def page_view(self, tracker_data: dict, tracker: pvtTracker, info=False, inkey=True, save=False):
|
|
200
201
|
|
|
201
|
-
self.print_normal(tracker_data) if not info else self.print_info(tracker_data)
|
|
202
|
+
self.print_normal(tracker_data,save=save) if not info else self.print_info(tracker_data)
|
|
202
203
|
page = 0
|
|
203
204
|
while True:
|
|
204
205
|
if not tracker_data["links"]["next"]:
|
|
@@ -219,16 +220,16 @@ class View(Torrent):
|
|
|
219
220
|
custom_console.rule(f"\n[bold blue]'Page -> {page}'", style="#ea00d9")
|
|
220
221
|
tracker_data = tracker.next(url=tracker_data["links"]["next"])
|
|
221
222
|
(
|
|
222
|
-
self.print_normal(tracker_data)
|
|
223
|
+
self.print_normal(tracker_data, save=save)
|
|
223
224
|
if not info
|
|
224
225
|
else self.print_info(tracker_data)
|
|
225
226
|
)
|
|
226
227
|
|
|
227
|
-
def view_search(self, keyword: str, info=False, inkey=True):
|
|
228
|
+
def view_search(self, keyword: str, info=False, inkey=True, save=False):
|
|
228
229
|
tracker_data = self.search(keyword=keyword)
|
|
229
230
|
custom_console.log(f"Searching.. '{keyword}'")
|
|
230
231
|
(
|
|
231
|
-
self.page_view(tracker_data=tracker_data, tracker=self.tracker,inkey=inkey)
|
|
232
|
+
self.page_view(tracker_data=tracker_data, tracker=self.tracker,inkey=inkey, save=save)
|
|
232
233
|
if not info
|
|
233
234
|
else self.page_view(
|
|
234
235
|
tracker_data=tracker_data, tracker=self.tracker, info=True
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
common/__init__.py,sha256=M82CDZm5KKWf8V3a10FKCy1wtFrJd1TMEhBib1Xtk1g,76
|
|
2
2
|
common/bdinfo_string.py,sha256=dfrU5T90fvkO_fklvVNWSoCgd5qvrVvqEZ_HKEsHAU8,3457
|
|
3
3
|
common/bittorrent.py,sha256=MPgMykWjmhGox7jf1MQn53Ew4NxpjzEc4FCF6oA2oYs,315
|
|
4
|
-
common/command.py,sha256=
|
|
4
|
+
common/command.py,sha256=ghSbeb4F53HwbpumsDYbE_Du6dlSzbDODd8edujQew0,6079
|
|
5
5
|
common/constants.py,sha256=tdflS7ZJwAcI1ZYUhBBb60QybVT7TmVS-EYxS4bNFp0,352
|
|
6
6
|
common/database.py,sha256=XOjh-X3XZBHjln9scRgzArpTlfgfR7P3ZlwahPbeUSU,3056
|
|
7
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=
|
|
11
|
+
common/settings.py,sha256=cLJNrx35Aicw_NQmCixNTUXjHp6qOyy0YhBNpwVk4Rs,32782
|
|
12
12
|
common/title.py,sha256=nFainfUBTYW9ML4Y-CB9ZFD_Es-OZXcAMPUo6D09u3k,3793
|
|
13
13
|
common/torrent_clients.py,sha256=NOIpYtLG_bA19HwcH9ahGFmGNtRkoMO6nAjma-JzDfs,12040
|
|
14
|
-
common/utility.py,sha256=
|
|
14
|
+
common/utility.py,sha256=TT-95yyfUFggH-zx6oxuI-VtgLFIKX_F-Y6RaBQlhfg,8687
|
|
15
15
|
common/external_services/__init__.py,sha256=rU7HPEcZ7WQFD8eqDzuye2xHPBjxXPwPqpt7IT08mkM,178
|
|
16
16
|
common/external_services/imageHost.py,sha256=BpdtGZUtZHl4QJwFKyJs_BI6z4gHI4wu_Beu-fnfkDw,9588
|
|
17
17
|
common/external_services/imdb.py,sha256=AIo8CO-SfP_uNocDeNY08hpvCAnuotoI7hYUytDiMQA,579
|
|
@@ -63,19 +63,19 @@ common/trackers/itt.py,sha256=cB0D5ZpMbGgEOAKloET9dS_fAFclhzwPPwRFt-LStX0,4019
|
|
|
63
63
|
common/trackers/sis.py,sha256=AahQH-FxAqS19vgEFylOJzeY0_SHr27_Tibs7lraSdI,3480
|
|
64
64
|
common/trackers/trackers.py,sha256=sts5l_x27V2Op1Y6Au5FoQujspSkWMPWyEYMfcmVYLA,1467
|
|
65
65
|
unit3dup/__init__.py,sha256=seXz3lHgdrUBiOnhC6Je47npS66UZ0c62VFuoH3z5Mk,78
|
|
66
|
-
unit3dup/__main__.py,sha256=
|
|
66
|
+
unit3dup/__main__.py,sha256=OR0GRGEeV54TRBj3lA2aKdnHLzjLllQSzgH672QgzFg,9070
|
|
67
67
|
unit3dup/automode.py,sha256=HIJrE8qEHp7DZQbppNtB_8jHY3Q94d6frp7BXnZuEac,4387
|
|
68
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
|
-
unit3dup/media.py,sha256=
|
|
71
|
+
unit3dup/media.py,sha256=u0N2Wu4yt_oCUq_FPwnFq0oV8_lHDYAeXW4uhqpgJAI,13677
|
|
72
72
|
unit3dup/pvtDocu.py,sha256=ZLMaal2fn6ZcFPLtET0LTmYEPjhJmLitEjkICHrm9CQ,4594
|
|
73
73
|
unit3dup/pvtTorrent.py,sha256=cItlsCpcUJL23iXQHy0YzrrvV3JSl54UlBgm8_UROAs,2559
|
|
74
74
|
unit3dup/pvtTracker.py,sha256=U4xMmhiqMNZaIOgEi3pnP-3H75e7Gagndh8GDFEP7Cs,18647
|
|
75
75
|
unit3dup/pvtVideo.py,sha256=w_T6wEeGrsHkuR3KObJc4mNpJgg9hhHh_9LoxFlaqjM,3900
|
|
76
|
-
unit3dup/torrent.py,sha256=
|
|
76
|
+
unit3dup/torrent.py,sha256=surV0royo_GCEvdlPIP1S9gvFvJb1u26XM11rZOGVEg,20064
|
|
77
77
|
unit3dup/upload.py,sha256=gjB8u2oP2FPXZ8t9SMIzkUEr52hKRy_zSR8OWJlW2xc,6075
|
|
78
|
-
unit3dup/media_manager/ContentManager.py,sha256=
|
|
78
|
+
unit3dup/media_manager/ContentManager.py,sha256=P6_qJd3nzmBlrkGs4HWa1sjDON2avKjnC8JYPqp2Tg8,7427
|
|
79
79
|
unit3dup/media_manager/DocuManager.py,sha256=oFt7jlxj-gIUty9PADBQV5a24bsv3yhjKhwI6niOhf4,3116
|
|
80
80
|
unit3dup/media_manager/GameManager.py,sha256=9EmPeNrirOwaVOj-vkLr29Xo7daIA4ssqrrt0WyMl30,4090
|
|
81
81
|
unit3dup/media_manager/MediaInfoManager.py,sha256=0NO9dgD7seJM67B3DRnwvRIdoy7bfquBUox-PnHInK8,1081
|
|
@@ -86,13 +86,12 @@ 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.
|
|
89
|
+
unit3dup-0.8.17.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
|
-
view/
|
|
93
|
-
|
|
94
|
-
unit3dup-0.8.
|
|
95
|
-
unit3dup-0.8.
|
|
96
|
-
unit3dup-0.8.
|
|
97
|
-
unit3dup-0.8.
|
|
98
|
-
unit3dup-0.8.16.dist-info/RECORD,,
|
|
92
|
+
view/web_console.py,sha256=YkxutJK5GqswMKEF77EllphPYQW0eb8OIBlplucHhvM,7697
|
|
93
|
+
unit3dup-0.8.17.dist-info/METADATA,sha256=iVLK-BKBT22LHEjCnMi2eLquQdMGytQBoAkKhBxFElc,4864
|
|
94
|
+
unit3dup-0.8.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
95
|
+
unit3dup-0.8.17.dist-info/entry_points.txt,sha256=fxXSyI6-r6jy9_v-C5ZHm03q1aC3tE9EvCQZxC1NQnI,52
|
|
96
|
+
unit3dup-0.8.17.dist-info/top_level.txt,sha256=19NVMnQNkJxBUKebRNaYCRs56A5CO4U1L67GMQCPiLU,21
|
|
97
|
+
unit3dup-0.8.17.dist-info/RECORD,,
|
view/web_console.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from rich.align import Align
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from rich.panel import Panel
|
|
5
|
+
from rich.text import Text
|
|
6
|
+
from rich.table import Table
|
|
7
|
+
from nicegui import ui
|
|
8
|
+
from common import config_settings
|
|
9
|
+
|
|
10
|
+
class CustomConsole(Console):
|
|
11
|
+
def __init__(self):
|
|
12
|
+
super().__init__(log_path=False)
|
|
13
|
+
|
|
14
|
+
ui.add_head_html('''
|
|
15
|
+
<style>
|
|
16
|
+
html, body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
height: 100%;
|
|
21
|
+
background-color: #002b36;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
''')
|
|
25
|
+
|
|
26
|
+
self.colors = {
|
|
27
|
+
'info': '#839496', # grigio chiaro
|
|
28
|
+
'cmd': '#93a1a1', # input comando
|
|
29
|
+
'success': '#859900', # verde
|
|
30
|
+
'error': '#dc322f', # rosso
|
|
31
|
+
'warning': '#b58900', # giallo
|
|
32
|
+
'highlight': '#268bd2', # blu
|
|
33
|
+
'log': '#586e75', # grigio scuro
|
|
34
|
+
'message': '#2aa198', # ciano tenue
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
self.container = ui.column().style(
|
|
38
|
+
'''
|
|
39
|
+
width: 90vw;
|
|
40
|
+
height: 90vh;
|
|
41
|
+
background-color: #002b36;
|
|
42
|
+
color: #839496;
|
|
43
|
+
font-family: 'Fira Code', 'Cascadia Code', monospace;
|
|
44
|
+
font-size: clamp(0.8rem, 1.5vw, 1rem);
|
|
45
|
+
padding: 1rem;
|
|
46
|
+
overflow-y: auto;
|
|
47
|
+
border: 1px solid #586e75;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
white-space: pre-wrap;
|
|
50
|
+
margin: auto;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
row-gap: 0;
|
|
54
|
+
'''
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def welcome_message(self):
|
|
58
|
+
title_panel = Panel(
|
|
59
|
+
Text(f"UNIT3Dup - An uploader for the Unit3D torrent tracker -\n{config_settings.console_options.WELCOME_MESSAGE}",
|
|
60
|
+
style=config_settings.console_options.WELCOME_MESSAGE_COLOR, justify="center"),
|
|
61
|
+
border_style=config_settings.console_options.WELCOME_MESSAGE_BORDER_COLOR,
|
|
62
|
+
title_align="center",
|
|
63
|
+
)
|
|
64
|
+
self.print(title_panel)
|
|
65
|
+
|
|
66
|
+
def panel_message(self, message: str):
|
|
67
|
+
title_panel = Panel(
|
|
68
|
+
Text(message, style=config_settings.console_options.PANEL_MESSAGE_COLOR, justify="center"),
|
|
69
|
+
border_style=config_settings.console_options.PANEL_MESSAGE_BORDER_COLOR,
|
|
70
|
+
title_align="center",
|
|
71
|
+
expand=False,
|
|
72
|
+
)
|
|
73
|
+
self.print(title_panel, justify="center")
|
|
74
|
+
|
|
75
|
+
def bot_log(self, message: str):
|
|
76
|
+
self.log(message, style=config_settings.console_options.NORMAL_COLOR)
|
|
77
|
+
self._print(message, self.colors['info'])
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def bot_error_log(self, message: str):
|
|
81
|
+
self.log(message, style=config_settings.console_options.ERROR_COLOR)
|
|
82
|
+
self._print(message, self.colors['error'])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def bot_warning_log(self, message: str):
|
|
86
|
+
self.log(message, style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
|
|
87
|
+
self._print(message, self.colors['warning'])
|
|
88
|
+
|
|
89
|
+
def bot_input_log(self, message: str):
|
|
90
|
+
self.print(f"{message} ", end="", style=config_settings.console_options.NORMAL_COLOR)
|
|
91
|
+
|
|
92
|
+
def bot_question_log(self, message: str):
|
|
93
|
+
self.print(message, end="", style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
|
|
94
|
+
|
|
95
|
+
def bot_counter_log(self, message: str):
|
|
96
|
+
self.print(message, end="\r", style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
|
|
97
|
+
|
|
98
|
+
def bot_process_table_log(self, content: list):
|
|
99
|
+
|
|
100
|
+
table = Table(
|
|
101
|
+
title="Here is your files list" if content else "There are no files here",
|
|
102
|
+
border_style="bold blue",
|
|
103
|
+
header_style="red blue",
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
table.add_column("Torrent Pack", style="dim")
|
|
107
|
+
table.add_column("Media", justify="left", style="bold green")
|
|
108
|
+
table.add_column("Path", justify="left", style="bold green")
|
|
109
|
+
|
|
110
|
+
for item in content:
|
|
111
|
+
pack = "Yes" if item.torrent_pack else "No"
|
|
112
|
+
table.add_row(
|
|
113
|
+
pack,
|
|
114
|
+
item.category,
|
|
115
|
+
item.torrent_path,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
self.print(Align.center(table))
|
|
119
|
+
|
|
120
|
+
def bot_process_table_pw(self, content: list):
|
|
121
|
+
|
|
122
|
+
table = Table(
|
|
123
|
+
title="Here is your files list" if content else "There are no files here",
|
|
124
|
+
border_style="bold blue",
|
|
125
|
+
header_style="red blue",
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
table.add_column("Category", style="dim")
|
|
129
|
+
table.add_column("Indexer", justify="left", style="bold green")
|
|
130
|
+
table.add_column("Title", justify="left", style="bold green")
|
|
131
|
+
table.add_column("Size", justify="left", style="bold green")
|
|
132
|
+
table.add_column("Seeders", justify="left", style="bold green")
|
|
133
|
+
|
|
134
|
+
for item in content:
|
|
135
|
+
table.add_row(
|
|
136
|
+
item.categories[0]['name'],
|
|
137
|
+
item.indexer,
|
|
138
|
+
item.title,
|
|
139
|
+
str(item.size),
|
|
140
|
+
str(item.seeders),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
self.print(Align.center(table))
|
|
144
|
+
|
|
145
|
+
def bot_tmdb_table_log(self, result, title: str, media_info_language: str):
|
|
146
|
+
|
|
147
|
+
self.print("\n")
|
|
148
|
+
media_info_audio_languages = (",".join(media_info_language)).upper()
|
|
149
|
+
self.panel_message(f"\nResults for {title.upper()}")
|
|
150
|
+
|
|
151
|
+
table = Table(border_style="bold blue")
|
|
152
|
+
table.add_column("TMDB ID", style="dim")
|
|
153
|
+
table.add_column("LANGUAGE", style="dim")
|
|
154
|
+
table.add_column("TMDB POSTER", justify="left", style="bold green")
|
|
155
|
+
table.add_column("TMDB BACKDROP", justify="left", style="bold green")
|
|
156
|
+
# table.add_column("TMDB KEYWORDS", justify="left", style="bold green")
|
|
157
|
+
table.add_row(
|
|
158
|
+
str(result.video_id),
|
|
159
|
+
media_info_audio_languages,
|
|
160
|
+
result.poster_path,
|
|
161
|
+
result.backdrop_path,
|
|
162
|
+
)
|
|
163
|
+
self.print(Align.center(table))
|
|
164
|
+
|
|
165
|
+
def wait_for_user_confirmation(self, message: str):
|
|
166
|
+
# Wait for user confirmation in case of validation failure
|
|
167
|
+
try:
|
|
168
|
+
self.bot_error_log(message=message)
|
|
169
|
+
input("> ")
|
|
170
|
+
except KeyboardInterrupt:
|
|
171
|
+
self.bot_error_log("\nOperation cancelled.Please update your config file")
|
|
172
|
+
exit(0)
|
|
173
|
+
|
|
174
|
+
def user_input(self,message: str)-> int:
|
|
175
|
+
try:
|
|
176
|
+
while True:
|
|
177
|
+
self.bot_input_log(message=message)
|
|
178
|
+
user_tmdb_id = input()
|
|
179
|
+
if user_tmdb_id.isdigit():
|
|
180
|
+
user_tmdb_id = int(user_tmdb_id)
|
|
181
|
+
return user_tmdb_id if user_tmdb_id < 9999999 else 0
|
|
182
|
+
except KeyboardInterrupt:
|
|
183
|
+
self.bot_error_log("\nOperation cancelled. Bye !")
|
|
184
|
+
exit(0)
|
|
185
|
+
|
|
186
|
+
def user_input_str(self,message: str)-> str:
|
|
187
|
+
try:
|
|
188
|
+
while True:
|
|
189
|
+
self.bot_input_log(message=message)
|
|
190
|
+
user_ = input()
|
|
191
|
+
return user_ if user_ else '0'
|
|
192
|
+
except KeyboardInterrupt:
|
|
193
|
+
self.bot_error_log("\nOperation cancelled. Bye !")
|
|
194
|
+
exit(0)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _print(self, text: str, color: str):
|
|
198
|
+
with self.container:
|
|
199
|
+
ui.label(text).style(f'color: {color}; font-family: monospace;')
|
|
200
|
+
|
|
201
|
+
# def print_cmd(self, text: str): self._print(text, self.colors['cmd'])
|
|
202
|
+
def print_success(self, text: str): self._print(text, self.colors['success'])
|
|
203
|
+
def print_highlight(self, text: str): self._print(text, self.colors['highlight'])
|
|
204
|
+
def print_srv_log(self, text: str): self._print(text, self.colors['log'])
|
|
205
|
+
def print_message(self, text: str): self._print(text, self.colors['message'])
|
view/custom_console2.py
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|