plex baseurl written to .env at setup
MODIFY
config.json
config.json
{
- "base_url": "http://localhost:32400",
"log_debug_messages": false,
"sync": {
"liked_lists": true,

MODIFY
get_env_data.py
get_env_data.py
with open(env_file, 'w') as txt:
txt.write("PLEX_USERNAME=" + username + "\n")
txt.write("PLEX_TOKEN=" + token + "\n")
- print("Plex token for {} has been added in .env file: PLEX_TOKEN={}".format(username, token))
+ txt.write("PLEX_BASEURL=" + plex._baseurl + "\n")
+ print("Plex token for {} has been added in .env file:".format(username))
+ print("PLEX_TOKEN={}".format(token))
+ print("PLEX_BASEURL={}".format(plex._baseurl))
else:
with open(env_file, "w") as txt:
txt.write("PLEX_USERNAME=-\n")

MODIFY
main.py
main.py
@@ -298,11 +298,12 @@ def main():
logging.debug("Movie ratings from trakt: {}".format(ratings))
logging.info('Loaded Trakt lists.')
plex_token = getenv("PLEX_TOKEN")
+ plex_baseurl = getenv("PLEX_BASEURL")
if plex_token == '-':
plex_token = ""
with requests_cache.disabled():
plex = plexapi.server.PlexServer(
- token=plex_token, baseurl=CONFIG['base_url'])
+ token=plex_token, baseurl=plex_baseurl)
logging.info("Server version {} updated at: {}".format(
plex.version, plex.updatedAt))
logging.info("Recently added: {}".format(

plex baseurl written to .env at setup