Skip to content

use persistent names for data directory#98

Merged
johang merged 1 commit intojohang:masterfrom
nivkner:persistant_names
Jun 19, 2025
Merged

use persistent names for data directory#98
johang merged 1 commit intojohang:masterfrom
nivkner:persistant_names

Conversation

@nivkner
Copy link
Contributor

@nivkner nivkner commented Jun 16, 2025

fixes #74 by using the v1 info hash of the torrent as a stable and unique identifier of the torrent.

@nivkner nivkner force-pushed the persistant_names branch 2 times, most recently from 032b634 to 3100445 Compare June 16, 2025 18:51
@johang johang requested a review from Copilot June 17, 2025 23:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates directory handling to use the torrent’s v1 info-hash as a stable identifier and ensures metadata’s info_hashes is populated before use.

  • Modified populate_target to take a directory name and removed mkdtemp in favor of a deterministic subfolder.
  • Ensured p.info_hashes is explicitly set after loading metadata.
  • Refactored main to compute the v1 hash string, call populate_target, and set up p.save_path accordingly.
Comments suppressed due to low confidence (1)

src/btfs.cc:876

  • The magnet-URI branch relies on parse_magnet_uri to populate info_hashes. Verify that info_hashes.v1 is always valid (or explicitly assign it) before using it for directory naming.
		p.info_hashes = p.ti->info_hashes();

@johang
Copy link
Owner

johang commented Jun 17, 2025

Sorry, just trying out some Github features...

@nivkner nivkner force-pushed the persistant_names branch 4 times, most recently from d5dd48f to f9f74d3 Compare June 18, 2025 16:36
@nivkner nivkner force-pushed the persistant_names branch from f9f74d3 to e27f941 Compare June 18, 2025 16:41
@johang johang merged commit f4cf643 into johang:master Jun 19, 2025
3 checks passed
@johang
Copy link
Owner

johang commented Jun 19, 2025

Thanks for the patch!

@nivkner nivkner deleted the persistant_names branch September 13, 2025 09:09
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

Successfully merging this pull request may close these issues.

Always download same torrrent to same subdirectory

3 participants