Rewrite the kodi-scan script in Python.
The Transmission daemon image uses Alpine linux as the base which uses busybox. realpath supports different switches in Busybox. Instead of testing things on Alpine and Busybox, rewrite it in Python (sort of modern Perl replacement).