[17] Give each PMM a unique Identifier

This commit is contained in:
meisnate12 2022-04-21 00:39:38 -04:00
parent 1174499129
commit c523492b87
2 changed files with 17 additions and 3 deletions

View file

@ -1 +1 @@
1.16.5-develop16
1.16.5-develop17

View file

@ -1,4 +1,4 @@
import argparse, os, sys, time, traceback
import argparse, os, sys, time, traceback, uuid
from datetime import datetime
try:
@ -123,7 +123,21 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")) a
version = util.parse_version(line)
break
plexapi.BASE_HEADERS["X-Plex-Client-Identifier"] = "Plex-Meta-Manager"
uuid_file = os.path.join(default_dir, "UUID")
uuid_num = None
if os.path.exists(uuid_file):
with open(uuid_file) as handle:
for line in handle.readlines():
line = line.strip()
if len(line) > 0:
uuid_num = line
break
if not uuid_num:
uuid_num = uuid.uuid4()
with open(uuid_file, "w") as handle:
handle.write(str(uuid_num))
plexapi.BASE_HEADERS["X-Plex-Client-Identifier"] = str(uuid_num)
def start(attrs):
logger.add_main_handler()