-
Notifications
You must be signed in to change notification settings - Fork 122
/
upload.py
570 lines (533 loc) · 26.8 KB
/
upload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
import requests
from src.args import Args
from src.clients import Clients
from src.prep import Prep
from src.trackers.COMMON import COMMON
from src.trackers.HUNO import HUNO
from src.trackers.BLU import BLU
from src.trackers.BHD import BHD
from src.trackers.AITHER import AITHER
from src.trackers.STC import STC
from src.trackers.R4E import R4E
from src.trackers.THR import THR
from src.trackers.STT import STT
from src.trackers.HP import HP
from src.trackers.PTP import PTP
from src.trackers.SN import SN
from src.trackers.ACM import ACM
from src.trackers.HDB import HDB
from src.trackers.LCD import LCD
from src.trackers.TTG import TTG
from src.trackers.LST import LST
from src.trackers.FL import FL
from src.trackers.LT import LT
from src.trackers.NBL import NBL
from src.trackers.ANT import ANT
from src.trackers.PTER import PTER
from src.trackers.MTV import MTV
from src.trackers.JPTV import JPTV
from src.trackers.TL import TL
from src.trackers.TDC import TDC
from src.trackers.HDT import HDT
from src.trackers.RF import RF
from src.trackers.OE import OE
from src.trackers.BHDTV import BHDTV
from src.trackers.RTF import RTF
import json
from pathlib import Path
import asyncio
import os
import sys
import platform
import multiprocessing
import logging
import shutil
import glob
import cli_ui
from src.console import console
from rich.markdown import Markdown
from rich.style import Style
cli_ui.setup(color='always', title="L4G's Upload Assistant")
import traceback
base_dir = os.path.abspath(os.path.dirname(__file__))
try:
from data.config import config
except:
if not os.path.exists(os.path.abspath(f"{base_dir}/data/config.py")):
try:
if os.path.exists(os.path.abspath(f"{base_dir}/data/config.json")):
with open(f"{base_dir}/data/config.json", 'r', encoding='utf-8-sig') as f:
json_config = json.load(f)
f.close()
with open(f"{base_dir}/data/config.py", 'w') as f:
f.write(f"config = {json.dumps(json_config, indent=4)}")
f.close()
cli_ui.info(cli_ui.green, "Successfully updated config from .json to .py")
cli_ui.info(cli_ui.green, "It is now safe for you to delete", cli_ui.yellow, "data/config.json", "if you wish")
from data.config import config
else:
raise NotImplementedError
except:
cli_ui.info(cli_ui.red, "We have switched from .json to .py for config to have a much more lenient experience")
cli_ui.info(cli_ui.red, "Looks like the auto updater didnt work though")
cli_ui.info(cli_ui.red, "Updating is just 2 easy steps:")
cli_ui.info(cli_ui.red, "1: Rename", cli_ui.yellow, os.path.abspath(f"{base_dir}/data/config.json"), cli_ui.red, "to", cli_ui.green, os.path.abspath(f"{base_dir}/data/config.py") )
cli_ui.info(cli_ui.red, "2: Add", cli_ui.green, "config = ", cli_ui.red, "to the beginning of", cli_ui.green, os.path.abspath(f"{base_dir}/data/config.py"))
exit()
else:
console.print(traceback.print_exc())
client = Clients(config=config)
parser = Args(config)
async def do_the_thing(base_dir):
meta = dict()
meta['base_dir'] = base_dir
paths = []
for each in sys.argv[1:]:
if os.path.exists(each):
paths.append(os.path.abspath(each))
else:
break
meta, help, before_args = parser.parse(tuple(' '.join(sys.argv[1:]).split(' ')), meta)
if meta['cleanup'] and os.path.exists(f"{base_dir}/tmp"):
shutil.rmtree(f"{base_dir}/tmp")
console.print("[bold green]Sucessfully emptied tmp directory")
if not meta['path']:
exit(0)
path = meta['path']
path = os.path.abspath(path)
if path.endswith('"'):
path = path[:-1]
queue = []
if os.path.exists(path):
meta, help, before_args = parser.parse(tuple(' '.join(sys.argv[1:]).split(' ')), meta)
queue = [path]
else:
# Search glob if dirname exists
if os.path.exists(os.path.dirname(path)) and len(paths) <= 1:
escaped_path = path.replace('[', '[[]')
globs = glob.glob(escaped_path)
queue = globs
if len(queue) != 0:
md_text = "\n - ".join(queue)
console.print("\n[bold green]Queuing these files:[/bold green]", end='')
console.print(Markdown(f"- {md_text.rstrip()}\n\n", style=Style(color='cyan')))
console.print("\n\n")
else:
console.print(f"[red]Path: [bold red]{path}[/bold red] does not exist")
elif os.path.exists(os.path.dirname(path)) and len(paths) != 1:
queue = paths
md_text = "\n - ".join(queue)
console.print("\n[bold green]Queuing these files:[/bold green]", end='')
console.print(Markdown(f"- {md_text.rstrip()}\n\n", style=Style(color='cyan')))
console.print("\n\n")
elif not os.path.exists(os.path.dirname(path)):
split_path = path.split()
p1 = split_path[0]
for i, each in enumerate(split_path):
try:
if os.path.exists(p1) and not os.path.exists(f"{p1} {split_path[i+1]}"):
queue.append(p1)
p1 = split_path[i+1]
else:
p1 += f" {split_path[i+1]}"
except IndexError:
if os.path.exists(p1):
queue.append(p1)
else:
console.print(f"[red]Path: [bold red]{p1}[/bold red] does not exist")
if len(queue) >= 1:
md_text = "\n - ".join(queue)
console.print("\n[bold green]Queuing these files:[/bold green]", end='')
console.print(Markdown(f"- {md_text.rstrip()}\n\n", style=Style(color='cyan')))
console.print("\n\n")
else:
# Add Search Here
console.print(f"[red]There was an issue with your input. If you think this was not an issue, please make a report that includes the full command used.")
exit()
base_meta = {k: v for k, v in meta.items()}
for path in queue:
meta = {k: v for k, v in base_meta.items()}
meta['path'] = path
meta['uuid'] = None
try:
with open(f"{base_dir}/tmp/{os.path.basename(path)}/meta.json") as f:
saved_meta = json.load(f)
for key, value in saved_meta.items():
overwrite_list = [
'trackers', 'dupe', 'debug', 'anon', 'category', 'type', 'screens', 'nohash', 'manual_edition', 'imdb', 'tmdb_manual', 'mal', 'manual',
'hdb', 'ptp', 'blu', 'no_season', 'no_aka', 'no_year', 'no_dub', 'no_tag', 'no_seed', 'client', 'desclink', 'descfile', 'desc', 'draft', 'region', 'freeleech',
'personalrelease', 'unattended', 'season', 'episode', 'torrent_creation', 'qbit_tag', 'qbit_cat', 'skip_imghost_upload', 'imghost', 'manual_source', 'webdv', 'hardcoded-subs'
]
if meta.get(key, None) != value and key in overwrite_list:
saved_meta[key] = meta[key]
meta = saved_meta
f.close()
except FileNotFoundError:
pass
console.print(f"[green]Gathering info for {os.path.basename(path)}")
if meta['imghost'] == None:
meta['imghost'] = config['DEFAULT']['img_host_1']
if not meta['unattended']:
ua = config['DEFAULT'].get('auto_mode', False)
if str(ua).lower() == "true":
meta['unattended'] = True
console.print("[yellow]Running in Auto Mode")
prep = Prep(screens=meta['screens'], img_host=meta['imghost'], config=config)
meta = await prep.gather_prep(meta=meta, mode='cli')
meta['name_notag'], meta['name'], meta['clean_name'], meta['potential_missing'] = await prep.get_name(meta)
if meta.get('image_list', False) in (False, []) and meta.get('skip_imghost_upload', False) == False:
return_dict = {}
meta['image_list'], dummy_var = prep.upload_screens(meta, meta['screens'], 1, 0, meta['screens'],[], return_dict)
if meta['debug']:
console.print(meta['image_list'])
# meta['uploaded_screens'] = True
elif meta.get('skip_imghost_upload', False) == True and meta.get('image_list', False) == False:
meta['image_list'] = []
if not os.path.exists(os.path.abspath(f"{meta['base_dir']}/tmp/{meta['uuid']}/BASE.torrent")):
reuse_torrent = None
if meta.get('rehash', False) == False:
reuse_torrent = await client.find_existing_torrent(meta)
if reuse_torrent != None:
prep.create_base_from_existing_torrent(reuse_torrent, meta['base_dir'], meta['uuid'])
if meta['nohash'] == False and reuse_torrent == None:
prep.create_torrent(meta, Path(meta['path']), "BASE", meta.get('piece_size_max', 0))
if meta['nohash']:
meta['client'] = "none"
elif os.path.exists(os.path.abspath(f"{meta['base_dir']}/tmp/{meta['uuid']}/BASE.torrent")) and meta.get('rehash', False) == True and meta['nohash'] == False:
prep.create_torrent(meta, Path(meta['path']), "BASE", meta.get('piece_size_max', 0))
if int(meta.get('randomized', 0)) >= 1:
prep.create_random_torrents(meta['base_dir'], meta['uuid'], meta['randomized'], meta['path'])
if meta.get('trackers', None) != None:
trackers = meta['trackers']
else:
trackers = config['TRACKERS']['default_trackers']
if "," in trackers:
trackers = trackers.split(',')
with open (f"{meta['base_dir']}/tmp/{meta['uuid']}/meta.json", 'w') as f:
json.dump(meta, f, indent=4)
f.close()
confirm = get_confirmation(meta)
while confirm == False:
# help.print_help()
editargs = cli_ui.ask_string("Input args that need correction e.g.(--tag NTb --category tv --tmdb 12345)")
editargs = (meta['path'],) + tuple(editargs.split())
if meta['debug']:
editargs = editargs + ("--debug",)
meta, help, before_args = parser.parse(editargs, meta)
# meta = await prep.tmdb_other_meta(meta)
meta['edit'] = True
meta = await prep.gather_prep(meta=meta, mode='cli')
meta['name_notag'], meta['name'], meta['clean_name'], meta['potential_missing'] = await prep.get_name(meta)
confirm = get_confirmation(meta)
if isinstance(trackers, list) == False:
trackers = [trackers]
trackers = [s.strip().upper() for s in trackers]
if meta.get('manual', False):
trackers.insert(0, "MANUAL")
####################################
####### Upload to Trackers #######
####################################
common = COMMON(config=config)
api_trackers = ['BLU', 'AITHER', 'STC', 'R4E', 'STT', 'RF', 'ACM','LCD','LST','HUNO', 'SN', 'LT', 'NBL', 'ANT', 'JPTV', 'TDC', 'OE', 'BHDTV', 'RTF']
http_trackers = ['HDB', 'TTG', 'FL', 'PTER', 'HDT', 'MTV']
tracker_class_map = {
'BLU' : BLU, 'BHD': BHD, 'AITHER' : AITHER, 'STC' : STC, 'R4E' : R4E, 'THR' : THR, 'STT' : STT, 'HP' : HP, 'PTP' : PTP, 'RF' : RF, 'SN' : SN,
'ACM' : ACM, 'HDB' : HDB, 'LCD': LCD, 'TTG' : TTG, 'LST' : LST, 'HUNO': HUNO, 'FL' : FL, 'LT' : LT, 'NBL' : NBL, 'ANT' : ANT, 'PTER': PTER, 'JPTV' : JPTV,
'TL' : TL, 'TDC' : TDC, 'HDT' : HDT, 'MTV': MTV, 'OE': OE, 'BHDTV': BHDTV, 'RTF':RTF}
for tracker in trackers:
if meta['name'].endswith('DUPE?'):
meta['name'] = meta['name'].replace(' DUPE?', '')
tracker = tracker.replace(" ", "").upper().strip()
if meta['debug']:
debug = "(DEBUG)"
else:
debug = ""
if tracker in api_trackers:
tracker_class = tracker_class_map[tracker](config=config)
if meta['unattended']:
upload_to_tracker = True
else:
upload_to_tracker = cli_ui.ask_yes_no(f"Upload to {tracker_class.tracker}? {debug}", default=meta['unattended'])
if upload_to_tracker:
console.print(f"Uploading to {tracker_class.tracker}")
if check_banned_group(tracker_class.tracker, tracker_class.banned_groups, meta):
continue
dupes = await tracker_class.search_existing(meta)
dupes = await common.filter_dupes(dupes, meta)
# note BHDTV does not have search implemented.
meta = dupe_check(dupes, meta)
if meta['upload'] == True:
await tracker_class.upload(meta)
if tracker == 'SN':
await asyncio.sleep(16)
await client.add_to_client(meta, tracker_class.tracker)
if tracker in http_trackers:
tracker_class = tracker_class_map[tracker](config=config)
if meta['unattended']:
upload_to_tracker = True
else:
upload_to_tracker = cli_ui.ask_yes_no(f"Upload to {tracker_class.tracker}? {debug}", default=meta['unattended'])
if upload_to_tracker:
console.print(f"Uploading to {tracker}")
if check_banned_group(tracker_class.tracker, tracker_class.banned_groups, meta):
continue
if await tracker_class.validate_credentials(meta) == True:
dupes = await tracker_class.search_existing(meta)
dupes = await common.filter_dupes(dupes, meta)
meta = dupe_check(dupes, meta)
if meta['upload'] == True:
await tracker_class.upload(meta)
await client.add_to_client(meta, tracker_class.tracker)
if tracker == "MANUAL":
if meta['unattended']:
do_manual = True
else:
do_manual = cli_ui.ask_yes_no(f"Get files for manual upload?", default=True)
if do_manual:
for manual_tracker in trackers:
if manual_tracker != 'MANUAL':
manual_tracker = manual_tracker.replace(" ", "").upper().strip()
tracker_class = tracker_class_map[manual_tracker](config=config)
if manual_tracker in api_trackers:
await common.unit3d_edit_desc(meta, tracker_class.tracker, tracker_class.signature)
else:
await tracker_class.edit_desc(meta)
url = await prep.package(meta)
if url == False:
console.print(f"[yellow]Unable to upload prep files, they can be found at `tmp/{meta['uuid']}")
else:
console.print(f"[green]{meta['name']}")
console.print(f"[green]Files can be found at: [yellow]{url}[/yellow]")
if tracker == "BHD":
bhd = BHD(config=config)
draft_int = await bhd.get_live(meta)
if draft_int == 0:
draft = "Draft"
else:
draft = "Live"
if meta['unattended']:
upload_to_bhd = True
else:
upload_to_bhd = cli_ui.ask_yes_no(f"Upload to BHD? ({draft}) {debug}", default=meta['unattended'])
if upload_to_bhd:
console.print("Uploading to BHD")
if check_banned_group("BHD", bhd.banned_groups, meta):
continue
dupes = await bhd.search_existing(meta)
dupes = await common.filter_dupes(dupes, meta)
meta = dupe_check(dupes, meta)
if meta['upload'] == True:
await bhd.upload(meta)
await client.add_to_client(meta, "BHD")
if tracker == "THR":
if meta['unattended']:
upload_to_thr = True
else:
upload_to_thr = cli_ui.ask_yes_no(f"Upload to THR? {debug}", default=meta['unattended'])
if upload_to_thr:
console.print("Uploading to THR")
#Unable to get IMDB id/Youtube Link
if meta.get('imdb_id', '0') == '0':
imdb_id = cli_ui.ask_string("Unable to find IMDB id, please enter e.g.(tt1234567)")
meta['imdb_id'] = imdb_id.replace('tt', '').zfill(7)
if meta.get('youtube', None) == None:
youtube = cli_ui.ask_string("Unable to find youtube trailer, please link one e.g.(https://www.youtube.com/watch?v=dQw4w9WgXcQ)")
meta['youtube'] = youtube
thr = THR(config=config)
try:
with requests.Session() as session:
console.print("[yellow]Logging in to THR")
session = thr.login(session)
console.print("[yellow]Searching for Dupes")
dupes = thr.search_existing(session, meta.get('imdb_id'))
dupes = await common.filter_dupes(dupes, meta)
meta = dupe_check(dupes, meta)
if meta['upload'] == True:
await thr.upload(session, meta)
await client.add_to_client(meta, "THR")
except:
console.print(traceback.print_exc())
if tracker == "PTP":
if meta['unattended']:
upload_to_ptp = True
else:
upload_to_ptp = cli_ui.ask_yes_no(f"Upload to {tracker}? {debug}", default=meta['unattended'])
if upload_to_ptp:
console.print(f"Uploading to {tracker}")
if meta.get('imdb_id', '0') == '0':
imdb_id = cli_ui.ask_string("Unable to find IMDB id, please enter e.g.(tt1234567)")
meta['imdb_id'] = imdb_id.replace('tt', '').zfill(7)
ptp = PTP(config=config)
if check_banned_group("PTP", ptp.banned_groups, meta):
continue
try:
console.print("[yellow]Searching for Group ID")
groupID = await ptp.get_group_by_imdb(meta['imdb_id'])
if groupID == None:
console.print("[yellow]No Existing Group found")
if meta.get('youtube', None) == None or "youtube" not in str(meta.get('youtube', '')):
youtube = cli_ui.ask_string("Unable to find youtube trailer, please link one e.g.(https://www.youtube.com/watch?v=dQw4w9WgXcQ)", default="")
meta['youtube'] = youtube
meta['upload'] = True
else:
console.print("[yellow]Searching for Existing Releases")
dupes = await ptp.search_existing(groupID, meta)
dupes = await common.filter_dupes(dupes, meta)
meta = dupe_check(dupes, meta)
if meta.get('imdb_info', {}) == {}:
meta['imdb_info'] = await prep.get_imdb_info(meta['imdb_id'], meta)
if meta['upload'] == True:
ptpUrl, ptpData = await ptp.fill_upload_form(groupID, meta)
await ptp.upload(meta, ptpUrl, ptpData)
await asyncio.sleep(5)
await client.add_to_client(meta, "PTP")
except:
console.print(traceback.print_exc())
if tracker == "TL":
tracker_class = tracker_class_map[tracker](config=config)
if meta['unattended']:
upload_to_tracker = True
else:
upload_to_tracker = cli_ui.ask_yes_no(f"Upload to {tracker_class.tracker}? {debug}", default=meta['unattended'])
if upload_to_tracker:
console.print(f"Uploading to {tracker_class.tracker}")
if check_banned_group(tracker_class.tracker, tracker_class.banned_groups, meta):
continue
await tracker_class.upload(meta)
await client.add_to_client(meta, tracker_class.tracker)
def get_confirmation(meta):
if meta['debug'] == True:
console.print("[bold red]DEBUG: True")
console.print(f"Prep material saved to {meta['base_dir']}/tmp/{meta['uuid']}")
console.print()
cli_ui.info_section(cli_ui.yellow, "Database Info")
cli_ui.info(f"Title: {meta['title']} ({meta['year']})")
console.print()
cli_ui.info(f"Overview: {meta['overview']}")
console.print()
cli_ui.info(f"Category: {meta['category']}")
if int(meta.get('tmdb', 0)) != 0:
cli_ui.info(f"TMDB: https://www.themoviedb.org/{meta['category'].lower()}/{meta['tmdb']}")
if int(meta.get('imdb_id', '0')) != 0:
cli_ui.info(f"IMDB: https://www.imdb.com/title/tt{meta['imdb_id']}")
if int(meta.get('tvdb_id', '0')) != 0:
cli_ui.info(f"TVDB: https://www.thetvdb.com/?id={meta['tvdb_id']}&tab=series")
if int(meta.get('mal_id', 0)) != 0:
cli_ui.info(f"MAL : https://myanimelist.net/anime/{meta['mal_id']}")
console.print()
if int(meta.get('freeleech', '0')) != 0:
cli_ui.info(f"Freeleech: {meta['freeleech']}")
if meta['tag'] == "":
tag = ""
else:
tag = f" / {meta['tag'][1:]}"
if meta['is_disc'] == "DVD":
res = meta['source']
else:
res = meta['resolution']
cli_ui.info(f"{res} / {meta['type']}{tag}")
if meta.get('personalrelease', False) == True:
cli_ui.info("Personal Release!")
console.print()
if meta.get('unattended', False) == False:
get_missing(meta)
ring_the_bell = "\a" if config['DEFAULT'].get("sfx_on_prompt", True) == True else "" # \a rings the bell
cli_ui.info_section(cli_ui.yellow, f"Is this correct?{ring_the_bell}")
cli_ui.info(f"Name: {meta['name']}")
confirm = cli_ui.ask_yes_no("Correct?", default=False)
else:
cli_ui.info(f"Name: {meta['name']}")
confirm = True
return confirm
def dupe_check(dupes, meta):
if not dupes:
console.print("[green]No dupes found")
meta['upload'] = True
return meta
else:
console.print()
dupe_text = "\n".join(dupes)
console.print()
cli_ui.info_section(cli_ui.bold, "Are these dupes?")
cli_ui.info(dupe_text)
if meta['unattended']:
if meta.get('dupe', False) == False:
console.print("[red]Found potential dupes. Aborting. If this is not a dupe, or you would like to upload anyways, pass --skip-dupe-check")
upload = False
else:
console.print("[yellow]Found potential dupes. --skip-dupe-check was passed. Uploading anyways")
upload = True
console.print()
if not meta['unattended']:
if meta.get('dupe', False) == False:
upload = cli_ui.ask_yes_no("Upload Anyways?", default=False)
else:
upload = True
if upload == False:
meta['upload'] = False
else:
meta['upload'] = True
for each in dupes:
if each == meta['name']:
meta['name'] = f"{meta['name']} DUPE?"
return meta
# Return True if banned group
def check_banned_group(tracker, banned_group_list, meta):
if meta['tag'] == "":
return False
else:
q = False
for tag in banned_group_list:
if isinstance(tag, list):
if meta['tag'][1:].lower() == tag[0].lower():
console.print(f"[bold yellow]{meta['tag'][1:]}[/bold yellow][bold red] was found on [bold yellow]{tracker}'s[/bold yellow] list of banned groups.")
console.print(f"[bold red]NOTE: [bold yellow]{tag[1]}")
q = True
else:
if meta['tag'][1:].lower() == tag.lower():
console.print(f"[bold yellow]{meta['tag'][1:]}[/bold yellow][bold red] was found on [bold yellow]{tracker}'s[/bold yellow] list of banned groups.")
q = True
if q:
if not cli_ui.ask_yes_no(cli_ui.red, "Upload Anyways?", default=False):
return True
return False
def get_missing(meta):
info_notes = {
'edition' : 'Special Edition/Release',
'description' : "Please include Remux/Encode Notes if possible (either here or edit your upload)",
'service' : "WEB Service e.g.(AMZN, NF)",
'region' : "Disc Region",
'imdb' : 'IMDb ID (tt1234567)',
'distributor' : "Disc Distributor e.g.(BFI, Criterion, etc)"
}
missing = []
if meta.get('imdb_id', '0') == '0':
meta['imdb_id'] = '0'
meta['potential_missing'].append('imdb_id')
if len(meta['potential_missing']) > 0:
for each in meta['potential_missing']:
if str(meta.get(each, '')).replace(' ', '') in ["", "None", "0"]:
if each == "imdb_id":
each = 'imdb'
missing.append(f"--{each} | {info_notes.get(each)}")
if missing != []:
cli_ui.info_section(cli_ui.yellow, "Potentially missing information:")
for each in missing:
if each.split('|')[0].replace('--', '').strip() in ["imdb"]:
cli_ui.info(cli_ui.red, each)
else:
cli_ui.info(each)
console.print()
return
if __name__ == '__main__':
pyver = platform.python_version_tuple()
if int(pyver[0]) != 3:
console.print("[bold red]Python2 Detected, please use python3")
exit()
else:
if int(pyver[1]) <= 6:
console.print("[bold red]Python <= 3.6 Detected, please use Python >=3.7")
loop = asyncio.get_event_loop()
loop.run_until_complete(do_the_thing(base_dir))
else:
asyncio.run(do_the_thing(base_dir))