Closed andrewmk closed 6 months ago
Both android_heights and web_heights variables should already be None if their respective request failed. Could you provide full traceback and command used when you get this error?
Command and stack trace as follows:
C:\Users\xxx\local-git\freevine>c:\apps\python310\python.exe freevine.py get --episode https://www.channel4.com/programmes/ultraviolet/on-demand/24459-001 --no-cache --sub-no-mux
❯_freevine v1.1.8
17:49:12.588 INFO : ALL4
17:49:12.588 INFO : + Adding service profile
17:49:12.608 INFO : Using cached tokens
17:49:12.961 INFO : Requesting ANDROID assets...
17:49:13.064 WARNING : Request for Android endpoint returned <Response [404]>, attempting proxy request...
17:49:13.064 INFO : + Adding Hola proxy location: UK
17:49:14.291 WARNING : Proxy attempt failed
17:49:14.292 INFO : Requesting WEB assets...
Traceback (most recent call last):
File "C:\Users\xxx\local-git\freevine\freevine.py", line 15, in <module>
cli()
File "c:\apps\python310\lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "c:\apps\python310\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "c:\apps\python310\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\apps\python310\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\apps\python310\lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "C:\Users\xxx\local-git\freevine\utils\commands.py", line 90, in get
Service(config, **kwargs)
File "C:\Users\xxx\local-git\freevine\services\channel4\channel4.py", line 73, in __init__
self.get_options()
File "C:\Users\xxx\local-git\freevine\services\channel4\channel4.py", line 455, in get_options
self.download(download, title, bearer)
File "C:\Users\xxx\local-git\freevine\services\channel4\channel4.py", line 458, in download
self.res, manifest, token, subtitle = self.get_mediainfo(
File "C:\Users\xxx\local-git\freevine\services\channel4\channel4.py", line 376, in get_mediainfo
heights, manifest, lic_token, subtitle = self.sort_assets(
File "C:\Users\xxx\local-git\freevine\services\channel4\channel4.py", line 357, in sort_assets
if not android_heights and not web_heights:
UnboundLocalError: local variable 'android_heights' referenced before assignment
C:\Users\xxx\local-git\freevine>
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
On Windows 11
Yeah, you were right. Clumsy mistake on my part.
I appreciate the contribution, but considering this is more of a bug report, I feel like it really should've been opened as an issue instead and I'll probably address this in a regular commit.
Feel free to open an issue if you want, for this or any other bugs you find.
Thanks!
I just thought I'd try to be helpful and fix the problem not just report it.
I was getting an error where Python complained that you were trying to use android_heights and web_heights variables before they'd been assigned. This patch seems to fix it. Or I guess you could assign both variables to be None at the start of the method.