Files
claudetools/projects/radio-show/audio-processor/download_test_episodes.py
Mike Swanson 7bb683a3ed sync: auto-sync from GURU-BEAST-ROG at 2026-04-27 14:42:18
Author: Mike Swanson
Machine: GURU-BEAST-ROG
Timestamp: 2026-04-27 14:42:18
2026-04-27 14:42:25 -07:00

39 lines
1.5 KiB
Python

import os
import sys
import paramiko
password = os.environ.get('IX_PASSWORD')
if not password:
print('IX_PASSWORD env var not set', file=sys.stderr)
sys.exit(1)
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('172.16.3.10', username='root', password=password,
look_for_keys=False, allow_agent=False, timeout=30)
sftp = client.open_sftp()
os.makedirs('test-data/episodes', exist_ok=True)
downloads = [
('/home/gurushow/public_html/archive/2011/3-12-11 HR 1.mp3', 'test-data/episodes/2011-03-12-hr1.mp3'),
('/home/gurushow/public_html/archive/2012/3 - March/3-10-12HR1.mp3', 'test-data/episodes/2012-03-10-hr1.mp3'),
('/home/gurushow/public_html/archive/2012/6 - June/6-9-12-HR1.mp3', 'test-data/episodes/2012-06-09-hr1.mp3'),
('/home/gurushow/public_html/archive/2014/06/s6e19.mp3', 'test-data/episodes/2014-s6e19.mp3'),
('/home/gurushow/public_html/archive/2016/06/s8e43.mp3', 'test-data/episodes/2016-s8e43.mp3'),
('/home/gurushow/public_html/archive/2017/04/s9e30.mp3', 'test-data/episodes/2017-s9e30.mp3'),
]
for remote, local in downloads:
if os.path.exists(local):
print(f'[skip] {local} already exists')
continue
size_mb = sftp.stat(remote).st_size / 1024 / 1024
print(f'Downloading {local} ({size_mb:.1f} MB)...', flush=True)
sftp.get(remote, local)
print(' done', flush=True)
sftp.close()
client.close()
print('All downloads complete.')