Skip to content

Commit

Permalink
Add config option to skip MTV if require rehash
Browse files Browse the repository at this point in the history
  • Loading branch information
Audionut committed Dec 20, 2024
1 parent 1d40730 commit 458cc1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/example-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
'announce_url': "get from https://www.morethantv.me/upload.php",
# 'anon': False,
# 'otp_uri' : 'OTP URI, read the following for more information https://github.com/google/google-authenticator/wiki/Key-Uri-Format'
'skip_if_rehash': False # Skip uploading to MTV if it would require a torrent rehash because existing piece size > 8 MiB
},
"NBL": {
"api_key": "NBL api key",
Expand Down
16 changes: 16 additions & 0 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,22 @@ async def process_tracker(tracker_name, meta):
tracker_status[tracker_name]['dupe'] = True
elif meta['skipping']:
tracker_status[tracker_name]['skipped'] = True
if tracker_name == "MTV":
tracker_config = self.config['TRACKERS'].get(tracker_name, {})
if str(tracker_config.get('skip_if_rehash', 'false')).lower() == "true":
torrent_path = os.path.abspath(f"{meta['base_dir']}/tmp/{meta['uuid']}/BASE.torrent")
if not os.path.exists(torrent_path):
check_torrent = await client.find_existing_torrent(meta)
if check_torrent:
console.print(f"[yellow]Existing torrent found on {check_torrent}[/yellow]")
self.create_base_from_existing_torrent(check_torrent, meta['base_dir'], meta['uuid'])
torrent = Torrent.read(torrent_path)
if torrent.piece_size > 8388608:
tracker_status[tracker_name]['skipped'] = True
elif os.path.exists(torrent_path):
torrent = Torrent.read(torrent_path)
if torrent.piece_size > 8388608:
tracker_status[tracker_name]['skipped'] = True
if meta.get('skipping') is None and not is_dupe and tracker_name == "PTP":
if meta.get('imdb_info', {}) == {}:
meta['imdb_info'] = self.get_imdb_info_api(meta['imdb_id'], meta)
Expand Down

0 comments on commit 458cc1e

Please sign in to comment.