Skip to content

Commit

Permalink
Allow use, edit or discard uni3d description
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Aug 31, 2024
1 parent 722dbce commit e996820
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ pyoxipng
rich
Jinja2
pyotp
str2bool
str2bool
click
19 changes: 19 additions & 0 deletions src/trackers/COMMON.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
import re
import json
import click

from src.bbcode import BBCODE
from src.console import console
Expand Down Expand Up @@ -184,6 +185,21 @@ async def unit3d_torrent_info(self, tracker, torrent_url, search_url, id=None, f
bbcode = BBCODE()
description, imagelist = bbcode.clean_unit3d_description(description, torrent_url)
console.print(f"[green]Successfully grabbed description from {tracker}")

# Allow user to edit or discard the description
console.print("[cyan]Do you want to edit or discard the description?[/cyan]")
edit_choice = input("[cyan]Enter 'e' to edit, 'd' to discard, or press Enter to keep it as is: [/cyan]")

if edit_choice.lower() == 'e':
edited_description = click.edit(description)
if edited_description:
description = edited_description.strip()
console.print(f"[green]Final description after editing:[/green] {description}")
elif edit_choice.lower() == 'd':
description = None
console.print("[yellow]Description discarded.[/yellow]")
else:
console.print(f"[green]Keeping the original description.[/green]")
else:
console.print(f"[yellow]No description found for {tracker}.[/yellow]")
else:
Expand All @@ -193,6 +209,9 @@ async def unit3d_torrent_info(self, tracker, torrent_url, search_url, id=None, f
console.print_exception()
console.print(f"[yellow]Invalid Response from {tracker} API. Error: {str(e)}[/yellow]")

if description: # Ensure description is only printed if it's not None
console.print(f"[green]Final description to be returned:[/green] {description}")

return tmdb, imdb, tvdb, mal, description, category, infohash, imagelist, file_name

async def parseCookieFile(self, cookiefile):
Expand Down

0 comments on commit e996820

Please sign in to comment.