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

Enable description parsing from Unit3D trackers #45

Closed
azulu opened this issue Sep 13, 2024 · 2 comments
Closed

Enable description parsing from Unit3D trackers #45

azulu opened this issue Sep 13, 2024 · 2 comments

Comments

@azulu
Copy link

azulu commented Sep 13, 2024

Currently, passing the -BLU/--BLU argument works very well for copying the torrent description from BLU (I don't have access to PTP or HDB, so can't speak for those).

I noticed in this fork also has the options for other Unit3D trackers (AITHER, LST, OE+) mentioned in the help section. However, from my limited testing, it doesn't do anything.

As an example, I ran python upload.py movie.mkv -LST site_ID and it didn't parse anything, nor was there any error displayed. Here are the relevant parts of the output:

Gathering info for movie.mkv
No ID found in meta for BLU, searching by file name
Searching BLU by file name: movie.mkv
No valid data found on BLU
No matches found on any trackers.
Edition After Manual Edition:
Repack after Checks:
Skipping upload because images are already uploaded to imgbb. Existing images: 0, Required: 0
Prep material saved to Upload-Assistant/tmp/movie.mkv

So neither did it automatically find the torrent on the tracker, nor with my exact input of the torrent ID on the site (as it works with BLU).

I wouldn't mind implementing/fixing this myself, but from looking at the code, I'm not exactly sure why it's not working 😅

So, in src/prep.py, we have the gather_prep function which has

if not meta.get('image_list'):
	# \\\
	if search_term:			
		# \\\
		if specific_tracker:
			# \\\
			console.print(f"[blue]Processing only the {specific_tracker} tracker based on meta.[/blue]")
			elif specific_tracker == 'BLU' and str(self.config['TRACKERS'].get('BLU', {}).get('useAPI')).lower() == "true":
				blu = BLU(config=self.config)
				meta, match = await self.update_metadata_from_tracker('BLU', blu, meta, search_term, search_file_folder)
				if match:
					found_match = True
			# \\\
			elif specific_tracker == 'LST' and str(self.config['TRACKERS'].get('LST', {}).get('useAPI')).lower() == "true":
				lst = LST(config=self.config)
				meta, match = await self.update_metadata_from_tracker('LST', lst, meta, search_term, search_file_folder)
				if match:
					found_match = True

Which looks analogous for BLU and LST (and the other mentioned Unit3D trackers) for manual calling.
But then, it also continues with

		else:
			# Process all trackers if no specific tracker is set in meta
			default_trackers = self.config['TRACKERS'].get('default_trackers', "").split(", ")
			# \\\
			if "BLU" in default_trackers and not found_match:
				if str(self.config['TRACKERS'].get('BLU', {}).get('useAPI')).lower() == "true":
					blu = BLU(config=self.config)
					meta, match = await self.update_metadata_from_tracker('BLU', blu, meta, search_term, search_file_folder)
					if match:
						found_match = True

with only the original 3 trackers from L4G's original repo (PTP, BLU and HDB).
There's also this part in the actual gen_desc function

with open(f"{meta['base_dir']}/tmp/{meta['uuid']}/DESCRIPTION.txt", 'w', newline="", encoding='utf8') as description:
	description.seek(0)
	if (desclink, descfile, meta['desc']) == (None, None, None):
		if meta.get('ptp_manual') is not None:
			desc_source.append('PTP')
		if meta.get('blu_manual') is not None:
			desc_source.append('BLU')
		if len(desc_source) != 1:
			desc_source = None
		else:
			desc_source = desc_source[0]
        # \\\
		if ptp_desc == "" and meta.get('blu_desc', '').rstrip() not in [None, ''] and desc_source in ['BLU', None]:
			if meta.get('blu_desc', '').strip().replace('\r\n', '').replace('\n', '') != '':
				description.write(meta['blu_desc'])
				meta['description'] = 'BLU'

which I don't fully understand. Especially the last part, where the BLU description is tied to PTP being empty.

As for the specific tracker configs in src/trackers/ and their search_existing functions, they look pretty much identical, so I don't think the problem's there.

@Audionut
Copy link
Owner

You'll need to use lowercase for the argument.

It was saving the description to the meta, but not correctly updating the description.txt, thanks for pointing that out.

@Audionut
Copy link
Owner

with only the original 3 trackers from L4G's original repo (PTP, BLU and HDB). There's also this part in the actual gen_desc function

#28

Feel free to push extra sites for ID searching, but I'm not keen on any other sites being auto searched unless they are known for quality descriptions.

Audionut added a commit that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants