Skip to content

Commit

Permalink
Few Updates and Fixes (#257)
Browse files Browse the repository at this point in the history
* --no-seed option added

* exit after -cleaup

* --no-seed option added

* thumbnail preview of screenshots

* Only exit on -cleanup if no path was provided

---------

Co-authored-by: L4GSP1KE <[email protected]>
  • Loading branch information
sirius-sama and L4GSP1KE authored Oct 11, 2023
1 parent 3aeb95c commit 33548f4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def parse(self, args, meta):
parser.add_argument('--no-aka', dest='no_aka', action='store_true', required=False, help="Remove AKA from title")
parser.add_argument('--no-dub', dest='no_dub', action='store_true', required=False, help="Remove Dubbed from title")
parser.add_argument('--no-tag', dest='no_tag', action='store_true', required=False, help="Remove Group Tag from title")
parser.add_argument('-ns', '--no-seed', action='store_true', required=False, help="Do not add torrent to the client")
parser.add_argument('-year', '--year', dest='manual_year', nargs='?', required=False, help="Year", type=int, default=0)
parser.add_argument('-ptp', '--ptp', nargs='*', required=False, help="PTP torrent id/permalink", type=str)
parser.add_argument('-blu', '--blu', nargs='*', required=False, help="BLU torrent id/link", type=str)
Expand Down
4 changes: 4 additions & 0 deletions src/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def __init__(self, config):

async def add_to_client(self, meta, tracker):
torrent_path = f"{meta['base_dir']}/tmp/{meta['uuid']}/[{tracker}]{meta['clean_name']}.torrent"
if meta.get('no_seed', False) == True:
console.print(f"[bold red]--no-seed was passed, so the torrent will not be added to the client")
console.print(f"[bold yellow]Add torrent manually to the client")
return
if os.path.exists(torrent_path):
torrent = Torrent.read(torrent_path)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/trackers/HDT.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ async def edit_desc(self, meta):
# Add Screenshots
images = meta['image_list']
if len(images) > 0:
for each in range(len(images)):
for each in range(min(2, len(images))):
img_url = images[each]['img_url']
raw_url = images[each]['raw_url']
descfile.write(f"[url={raw_url}][img]{img_url}[/img][/url]\n")
descfile.write(f'<a href="{raw_url}"><img src="{img_url}" height=137></a> ')

descfile.close()

8 changes: 5 additions & 3 deletions upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ async def do_the_thing(base_dir):
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('"'):
Expand Down Expand Up @@ -164,7 +166,7 @@ async def do_the_thing(base_dir):
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', 'client', 'desclink', 'descfile', 'desc', 'draft', 'region', 'freeleech',
'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:
Expand All @@ -185,13 +187,13 @@ async def do_the_thing(base_dir):
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) == False and meta.get('skip_imghost_upload', False) == False:
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):
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")):
Expand Down

0 comments on commit 33548f4

Please sign in to comment.