Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix torrent creation PTP-HDB #205

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/trackers/HDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ async def upload(self, meta, disctype):

# Create a new torrent with piece size explicitly set to 16 MiB
new_torrent = prep.CustomTorrent(
meta=meta,
path=Path(meta['path']),
trackers=["https://fake.tracker"],
source="L4G",
Expand Down
10 changes: 7 additions & 3 deletions src/trackers/PTP.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,6 @@ async def edit_desc(self, meta):
prep = Prep(screens=meta['screens'], img_host=meta['imghost'], config=self.config)
base = open(f"{meta['base_dir']}/tmp/{meta['uuid']}/DESCRIPTION.txt", 'r', encoding="utf-8").read()
multi_screens = int(self.config['DEFAULT'].get('multiScreens', 2))
if multi_screens < 2:
multi_screens = 2
console.print("[yellow]PTP requires at least 2 screenshots for multi disc/file content, overriding config")

with open(f"{meta['base_dir']}/tmp/{meta['uuid']}/[{self.tracker}]DESCRIPTION.txt", 'w', encoding="utf-8") as desc:
images = meta['image_list']
Expand Down Expand Up @@ -659,6 +656,9 @@ async def edit_desc(self, meta):
elif len(discs) > 1:
if 'retry_count' not in meta:
meta['retry_count'] = 0
if multi_screens < 2:
multi_screens = 2
console.print("[yellow]PTP requires at least 2 screenshots for multi disc content, overriding config")
for i, each in enumerate(discs):
new_images_key = f'new_images_disc_{i}'
if each['type'] == "BDMV":
Expand Down Expand Up @@ -776,6 +776,9 @@ async def edit_desc(self, meta):

# Handle multiple files case
elif len(filelist) > 1:
if multi_screens < 2:
multi_screens = 2
console.print("[yellow]PTP requires at least 2 screenshots for multi disc/file content, overriding config")
for i in range(len(filelist)):
file = filelist[i]
if i == 0:
Expand Down Expand Up @@ -986,6 +989,7 @@ async def upload(self, meta, url, data, disctype):
from src.prep import Prep
prep = Prep(screens=meta['screens'], img_host=meta['imghost'], config=self.config)
new_torrent = prep.CustomTorrent(
meta=meta,
path=Path(meta['path']),
trackers=[self.announce_url],
source="L4G",
Expand Down
Loading