sane-bt-add: leave a TODO for fixing InvalidSchema exceptions

This commit is contained in:
Colin 2023-11-05 20:03:03 +00:00
parent f6eadd3696
commit 08dd4ca641

View File

@ -11,6 +11,19 @@ from sane_bt import MediaMeta, TransmissionApi
logger = logging.getLogger(__name__)
# TODO: handle 'InvalidSchema's when kat.ph redirects directly to the magnet:
#
# class MagnetAdapter:
# def send(self, req, **kwargs):
# resp = requests.Response()
# resp.history = [req.url]
# return resp
# s = requests.session()
# s.mount('magnet:', MagnetAdapter())
# resp = s.request('GET', uri)
# resp.history[-1] # contains the magnet: URI, if everything's proper
# except i think history gets overwritten, so may need to assign a different field
def resolve_torrent(uri: str) -> str:
"""
given a URI, coerce it into something native to transmission