python3 update changes and bug fix

added update function to setup script
fixed a scheduling bug
This commit is contained in:
Moe Fwacky
2021-05-09 01:04:53 -07:00
committed by GitHub
parent bd51c40ca4
commit 5830dfccb7
6 changed files with 232 additions and 58 deletions

View File

@@ -1514,7 +1514,7 @@ if __name__ == '__main__':
#dates_list = [datetime.datetime.strptime(''.join(str(date[8])), pseudo_channel.APP_TIME_FORMAT_STR) for date in daily_schedule] #dates_list = [datetime.datetime.strptime(''.join(str(date[8])), pseudo_channel.APP_TIME_FORMAT_STR) for date in daily_schedule]
now = datetime.datetime.now() now = datetime.datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
#closest_media = nearest(dates_list, now) #closest_media = nearest(dates_list, now)
#print closest_media #print closest_media
prevItem = None prevItem = None
@@ -1559,7 +1559,7 @@ if __name__ == '__main__':
print(str("NOTICE: Readying media: '{}'".format(item[3])).encode('UTF-8')) print(str("NOTICE: Readying media: '{}'".format(item[3])).encode('UTF-8'))
next_start_time = datetime.datetime.strptime(item[8], pseudo_channel.APP_TIME_FORMAT_STR) next_start_time = datetime.datetime.strptime(item[8], pseudo_channel.APP_TIME_FORMAT_STR)
now = datetime.datetime.now() now = datetime.datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
time_diff = next_start_time - now time_diff = next_start_time - now
nat_start = datetime.datetime.strptime(item[9], '%Y-%m-%d %H:%M:%S.%f') - datetime.timedelta(milliseconds=item[7]) nat_start = datetime.datetime.strptime(item[9], '%Y-%m-%d %H:%M:%S.%f') - datetime.timedelta(milliseconds=item[7])
schedule_offset = nat_start - datetime.datetime.strptime(item[8], pseudo_channel.APP_TIME_FORMAT_STR) schedule_offset = nat_start - datetime.datetime.strptime(item[8], pseudo_channel.APP_TIME_FORMAT_STR)
@@ -1606,7 +1606,7 @@ if __name__ == '__main__':
print("NOTICE: Generating Memory Schedule.") print("NOTICE: Generating Memory Schedule.")
now = datetime.datetime.now() now = datetime.datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
pseudo_cache = pseudo_channel.get_daily_schedule_cache_as_json() pseudo_cache = pseudo_channel.get_daily_schedule_cache_as_json()
prev_end_time_to_watch_for = None prev_end_time_to_watch_for = None
if pseudo_channel.USE_OVERRIDE_CACHE and isforupdate: if pseudo_channel.USE_OVERRIDE_CACHE and isforupdate:

View File

@@ -51,30 +51,34 @@ class PseudoChannelCommercial():
curr_item_start_time = datetime.strptime(now_ep.start_time, '%H:%M:%S') curr_item_start_time = datetime.strptime(now_ep.start_time, '%H:%M:%S')
else: else:
curr_item_start_time = reset_time curr_item_start_time = reset_time
if(curr_item_start_time < prev_item_end_time): curr_item_start_time += timedelta(days=1)
curr_item_start_time = curr_item_start_time.replace(day=1) #if(curr_item_start_time < reset_time):
else: #curr_item_start_time = curr_item_start_time.replace(day=1)
curr_item_start_time = curr_item_start_time.replace(day=2) #else:
#curr_item_start_time = curr_item_start_time.replace(day=2)
# mutto233 has added some logic at this point # mutto233 has added some logic at this point
# - All dates are now changed to 1/1/90 so midnight doesn't cause issues # - All dates are now changed to 1/1/90 so midnight doesn't cause issues
# - Issues with day skips again being adressed # - Issues with day skips again being adressed
now = datetime.now() now = datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
midnight = now.replace(hour=0,minute=0,second=0) midnight = now.replace(hour=0,minute=0,second=0)
if(curr_item_start_time < reset_time): if(curr_item_start_time < reset_time):
curr_item_start_time = curr_item_start_time.replace(day=2) #curr_item_start_time = curr_item_start_time.replace(day=2)
curr_item_start_time += timedelta(days=1)
if(prev_item_end_time < reset_time): if(prev_item_end_time < reset_time):
prev_item_end_time = prev_item_end_time.replace(day=2) #prev_item_end_time = prev_item_end_time.replace(day=2)
else: prev_item_end_time += timedelta(days=1)
prev_item_end_time = prev_item_end_time.replace(day=1) #else:
#prev_item_end_time = prev_item_end_time.replace(day=1)
time_diff = (curr_item_start_time - prev_item_end_time) time_diff = (curr_item_start_time - prev_item_end_time)
if prev_item_end_time.replace(microsecond=0) > curr_item_start_time and strict_time == "false": if prev_item_end_time.replace(microsecond=0) > curr_item_start_time and strict_time == "false":
# NOTE: This is just for the logic of this function, I have noticed that this # NOTE: This is just for the logic of this function, I have noticed that this
# may cause other issues in other functions, since now the day is off. # may cause other issues in other functions, since now the day is off.
print("NOTICE: WE MUST BE SKIPPING A DAY, ADDING A DAY TO THE START TIME") print("NOTICE: WE MUST BE SKIPPING A DAY, ADDING A DAY TO THE START TIME")
curr_item_start_time = curr_item_start_time.replace(day=2) #curr_item_start_time = curr_item_start_time.replace(day=2)
curr_item_start_time += timedelta(days=1)
print("INFO: Last Item End Time - %s" % prev_item_end_time.replace(microsecond=0)) print("INFO: Last Item End Time - %s" % prev_item_end_time.replace(microsecond=0))

View File

@@ -321,9 +321,13 @@ class PseudoChannelDatabase():
raise e raise e
def add_media_to_daily_schedule(self, media): def add_media_to_daily_schedule(self, media):
try: try:
print(str("{}: {} - {}".format(media.start_time, media.title, media.custom_section_name)).encode('UTF-8')) mediaPrint = media.start_time + ": " + media.show_series_title + " - " + media.title + " | " + media.custom_section_name
except:
mediaPrint = media.start_time + ": " + media.title + " | " + media.custom_section_name
try:
print(mediaPrint)
#print(str("{}: {} - {}".format(media.start_time, media.title, media.custom_section_name)).encode('UTF-8'))
except: except:
print("ERROR: Not outputting media info due to ascii code issues.") print("ERROR: Not outputting media info due to ascii code issues.")

View File

@@ -294,7 +294,7 @@ class PseudoDailyScheduleController():
def get_html_from_daily_schedule(self, currentTime, bgImageURL, datalist, nowPlayingTitle): def get_html_from_daily_schedule(self, currentTime, bgImageURL, datalist, nowPlayingTitle):
now = datetime.now() now = datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
midnight = now.replace(hour=23, minute=59, second=59) midnight = now.replace(hour=23, minute=59, second=59)
#mutto233 put this here, because to be honest, isn't the current time always now? #mutto233 put this here, because to be honest, isn't the current time always now?
if currentTime != None: if currentTime != None:
@@ -399,19 +399,19 @@ class PseudoDailyScheduleController():
continue continue
numberIncrease += 1 numberIncrease += 1
with tag('tbody'): with tag('tbody'):
if currentTime != None: #if currentTime != None:
currentTime = currentTime.replace(year=1900, month=1, day=1) #currentTime = currentTime.replace(year=1900, month=1, day=1)
try: try:
timeBStart = datetime.strptime(row[8], '%I:%M:%S %p') timeBStart = datetime.strptime(row[8], '%I:%M:%S %p')
except: except:
timeBStart = datetime.strptime(row[8], '%H:%M:%S') timeBStart = datetime.strptime(row[8], '%H:%M:%S')
timeBStart = timeBStart.replace(year=1900, month=1, day=1) #timeBStart = timeBStart.replace(year=1900, month=1, day=1)
try: try:
timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f') timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f')
timeBEnd = timeBEnd.replace(day=1) #timeBEnd = timeBEnd.replace(day=1)
except: except:
timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S') timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S')
timeBEnd = timeBEnd.replace(day=1) #timeBEnd = timeBEnd.replace(day=1)
if currentTime == None: if currentTime == None:
with tag('tr'): with tag('tr'):
with tag('th', scope='row'): with tag('th', scope='row'):
@@ -799,7 +799,7 @@ class PseudoDailyScheduleController():
def manually_get_now_playing_bg_image(self, currentTime, datalist): def manually_get_now_playing_bg_image(self, currentTime, datalist):
now = datetime.now() now = datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
midnight = now.replace(hour=23, minute=59, second=59) midnight = now.replace(hour=23, minute=59, second=59)
increase_var = 0 increase_var = 0
@@ -812,13 +812,13 @@ class PseudoDailyScheduleController():
timeBStart = datetime.strptime(row[8], '%I:%M:%S %p') timeBStart = datetime.strptime(row[8], '%I:%M:%S %p')
except: except:
timeBStart = datetime.strptime(row[8], '%H:%M:%S') timeBStart = datetime.strptime(row[8], '%H:%M:%S')
timeBStart = timeBStart.replace(year=1900, month=1, day=1) #timeBStart = timeBStart.replace(year=1900, month=1, day=1)
try: try:
timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f') timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f')
timeBEnd = timeBEnd.replace(day=1) #timeBEnd = timeBEnd.replace(day=1)
except: except:
timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S') timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S')
timeBEnd = timeBEnd.replace(day=1) #timeBEnd = timeBEnd.replace(day=1)
if ((currentTime - timeBStart).total_seconds() >= 0 and \ if ((currentTime - timeBStart).total_seconds() >= 0 and \
(timeBEnd - currentTime).total_seconds() >= 0) or \ (timeBEnd - currentTime).total_seconds() >= 0) or \
((timeBStart - timeBEnd).total_seconds() >= 0 and \ ((timeBStart - timeBEnd).total_seconds() >= 0 and \
@@ -847,7 +847,7 @@ class PseudoDailyScheduleController():
def manually_get_now_playing_title(self, currentTime, datalist): def manually_get_now_playing_title(self, currentTime, datalist):
now = datetime.now() now = datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
midnight = now.replace(hour=23, minute=59, second=59) midnight = now.replace(hour=23, minute=59, second=59)
increase_var = 0 increase_var = 0
@@ -858,7 +858,7 @@ class PseudoDailyScheduleController():
timeBStart = datetime.strptime(row[8], '%I:%M:%S %p') timeBStart = datetime.strptime(row[8], '%I:%M:%S %p')
except: except:
timeBStart = datetime.strptime(row[8], '%H:%M:%S') timeBStart = datetime.strptime(row[8], '%H:%M:%S')
timeBStart = timeBStart.replace(year=1900, month=1, day=1) #timeBStart = timeBStart.replace(year=1900, month=1, day=1)
try: try:
timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f') timeBEnd = datetime.strptime(row[9], '%Y-%m-%d %H:%M:%S.%f')
timeBEnd = timeBEnd.replace(day=1) timeBEnd = timeBEnd.replace(day=1)
@@ -892,7 +892,7 @@ class PseudoDailyScheduleController():
print("NOTICE: ", "Writing XML / HTML to file.") print("NOTICE: ", "Writing XML / HTML to file.")
now = datetime.now() now = datetime.now()
now = now.replace(year=1900, month=1, day=1) #now = now.replace(year=1900, month=1, day=1)
bgImage = self.manually_get_now_playing_bg_image(now, datalist) bgImage = self.manually_get_now_playing_bg_image(now, datalist)

View File

@@ -57,8 +57,8 @@ def get_last():
def start_channel(channel): def start_channel(channel):
#execute PseudoChannel.py -r in specified channel #execute PseudoChannel.py -r in specified channel
last = get_last()
try: try:
last = get_last()
os.remove(os.path.abspath(os.path.dirname(__file__))+'/pseudo-channel_'+last+"/last.info") os.remove(os.path.abspath(os.path.dirname(__file__))+'/pseudo-channel_'+last+"/last.info")
print("NOTICE: Previous last.info deleted") print("NOTICE: Previous last.info deleted")
except: except:

224
setup.py
View File

@@ -106,10 +106,10 @@ def ps_install():
print("INVALID ENTRY") print("INVALID ENTRY")
branchSelect = input('>: ') branchSelect = input('>: ')
ps_branch = branchSelect ps_branch = branchSelect
print("Enter Install Path (default: ./channels)") print("Enter Install Path (default: "+os.getcwd()+"/channels)")
pathInput = input('>: ') pathInput = input('>: ')
if pathInput == '': if pathInput == '':
path = "./channels" path = os.getcwd()+"/channels"
else: else:
path = pathInput path = pathInput
dirCheck = os.path.isdir(path) dirCheck = os.path.isdir(path)
@@ -298,7 +298,16 @@ def ps_install():
os.remove('../pseudo_config.py') os.remove('../pseudo_config.py')
os.remove('../plex_token.py') os.remove('../plex_token.py')
web_setup() web_setup()
copy_tv(clientList, clientNumbers, os.getcwd()) add_client = 'y'
while 'y' in add_client.lower():
print("Add another Plex client?")
add_client = input('Y/N >: ')
responses = ['yes','y','n','no']
while add_client.lower() not in responses:
print("INVALID ENTRY")
add_client = input('Y/N >: ')
if 'y' in add_client.lower():
copy_tv(clientList, path, os.getcwd())
def global_database_update(path): def global_database_update(path):
os.chdir(path) os.chdir(path)
@@ -358,12 +367,12 @@ def copyconfig(channel="all"):
chanDir = "pseudo-channel_"+str(chan)+'/' chanDir = "pseudo-channel_"+str(chan)+'/'
shutil.copy('./pseudo_config.py', chanDir) shutil.copy('./pseudo_config.py', chanDir)
def copy_tv(clientList, clientNumbers, path): def copy_tv(clientList, installDir, path):
print("Adding Additional Pseudo Channel Clients") #make symlinked copy of pseudo channel files to run on another client print("Adding Additional Pseudo Channel Clients") #make symlinked copy of pseudo channel files to run on another client
print("SELECT DESIRED CLIENT") print("SELECT DESIRED CLIENT")
for i, client in enumerate(PLEX.clients()): clientNumbers = []
print(str(i + 1)+":", client.title) for i, client in enumerate(clientList):
clientList.append(client.title) print(str(i + 1)+":", client)
clientNumbers.append(i + 1) clientNumbers.append(i + 1)
selectedClient = input('>:') selectedClient = input('>:')
while int(selectedClient) not in clientNumbers: while int(selectedClient) not in clientNumbers:
@@ -373,25 +382,170 @@ def copy_tv(clientList, clientNumbers, path):
ps_client = ps_client.replace(" ","\ ") ps_client = ps_client.replace(" ","\ ")
if path[-1] == '/': if path[-1] == '/':
path[-1] = path[-1].replace('/','') path[-1] = path[-1].replace('/','')
newChannelsDir = path+'_'+ps_client newChannelsDir = installDir+'_'+ps_client
print("Copying Files to "+newChannelsDir) print("Copying Files to "+newChannelsDir)
#os.mkdir(newChannelsDir)
#copy all files and directories to a _CLIENT directory #copy all files and directories to a _CLIENT directory
files = glob.glob(path+'/*') files = glob.glob(installDir+'/**', recursive=True)
for file in files:
isDirectory = os.path.isdir(file)
if isDirectory == True:
newDir = file.replace(installDir.split('/')[-1],installDir.split('/')[-1]+'_'+ps_client)
print("ACTION: Creating Directory "+newDir)
os.mkdir(newDir)
for file in files: #copy files into new client directory for file in files: #copy files into new client directory
if "pseudo-channel.db" in file: #symlink the database files isFile = os.path.isfile(file)
filePathList = file.split('/') newDir = file.replace(installDir.split('/')[-1],installDir.split('/')[-1]+'_'+ps_client)
if "pseudo-channel_" in filePathList[-2]: if isFile == True:
symLinkPath = newChannelsDir+'/'+filePathList[-2]+'/'+filePathList[-1] if "pseudo-channel.db" in file: #symlink the database files
print("ACTION: Creating symlink to "+file)
filePathList = file.split('/')
if "pseudo-channel_" in filePathList[-2]:
symLinkPath = newChannelsDir+'/'+filePathList[-2]+'/'+filePathList[-1]
else:
symLinkPath = newChannelsDir+'/'+filePathList[-1]
print("Creating symlink to database file")
print(file+" --> "+symLinkPath)
os.symlink(file,symLinkPath)
else: else:
symLinkPath = newChannelsDir+'/'+filePathList[-1] if isFile == True:
print("Creating symlink to database file") print("ACTION: Copying "+file)
print(file+" --> "+symLinkPath) shutil.copy(file, newDir)
os.symlink(file,symLinkPath)
else:
shutil.copy(file, newChannelsDir)
def ps_update(branch='main'): def ps_update():
print("ps_update") #download and copy updates from git to all branches and boxes print("Updating Pseudo Channel") #download and copy updates from git to all branches and boxes
branchList = ['master','develop','python3']
b = 1
print("Select Pseudo Channel Repository Branch (default: master)")
for branch in branchList:
print(str(b)+": "+branch)
b = b+1
branchSelect = input('>: ')
if branchSelect == "":
ps_branch = 'master'
else:
try:
branchSelect = int(branchSelect)
while 0 > int(branchSelect) > b-1:
print("INVALID ENTRY")
branchSelect = input('>: ')
ps_branch = branchList[branchSelect-1]
except:
while branchSelect not in branchList:
print("INVALID ENTRY")
branchSelect = input('>: ')
ps_branch = branchSelect
os.mkdir('../temp') #create temp directory to download files into
try:
git.Repo.clone_from('https://github.com/FakeTV/pseudo-channel', '../temp', branch=ps_branch)
except Exception as e:
print("ERROR GETTING DOWNLOADING FROM GIT")
print("e")
mainFiles = glob.glob('../temp/main-dir/*')
bothFiles = glob.glob('../temp/both-dir/*')
srcFiles = glob.glob('../temp/both-dir/src/*')
chanFiles = glob.glob('../temp/channel-dir/*')
filesList = [mainFiles,bothFiles,srcFiles,chanFiles]
fL = 1
for files in filesList:
for file in files:
fileName = file.split('/')[-1]
if fileName != 'pseudo_config.py' and fileName != 'src':
oldFiles = glob.glob('./**/'+fileName,recursive=True)
if len(oldFiles) == 0:
#Figure out where to copy new files
psDirs = glob.glob("./pseudo-channel_*")
if fL == 1:
try:
shutil.copyfile(file, os.getcwd()+'/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + os.getcwd()
print(printLine,end='\r')
except Exception as e:
print("\nERROR: Copy Failed - " + fileName + " to " + os.getcwd())
print(e)
elif fL == 2:
try:
shutil.copyfile(file, os.getcwd()+'/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + os.getcwd()+'/'+fileName
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + os.getcwd()+'/'+fileName)
for psDir in psDirs:
try:
shutil.copyfile(file, psDir+'/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + psDir+'/'+fileName
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + psDir+'/'+fileName)
elif fL == 3:
try:
shutil.copyfile(file, os.getcwd()+'/src/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + os.getcwd()+'/src/'+fileName
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + os.getcwd()+'/src/'+fileName)
for psDir in psDirs:
try:
shutil.copyfile(file, psDir+'/src/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + psDir+'/src/'+fileName
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + psDir+'/src/'+fileName)
elif fL == 4:
for psDir in psDirs:
try:
shutil.copyfile(file, psDir+'/src/'+fileName)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + psDir+'/src/'+fileName
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + psDir+'/src/'+fileName)
else:
for old in oldFiles:
try:
shutil.copyfile(file, old)
try:
clearLine = " " * len(printLine)
print(clearLine,end='\r')
except:
pass
printLine = "NOTICE: Copying " + fileName + " to " + old
print(printLine,end='\r')
except:
print("\nERROR: Copy Failed - " + fileName + " to " + old)
fL = fL + 1
shutil.rmtree('../temp')
print("\nNOTICE: Temp Files Deleted")
def web_setup(): def web_setup():
print("Setting up the web interface and API...") #set up the web interface and api print("Setting up the web interface and API...") #set up the web interface and api
@@ -459,9 +613,12 @@ def web_setup():
#insert config details #insert config details
configFile = open(path+"/psConfig.php", 'r') configFile = open(path+"/psConfig.php", 'r')
configData = configFile.read() configData = configFile.read()
configFile = open(path+"/psConfig.php", 'w')
configData = configData.replace("$pseudochannel = '/home/pi/channels/';", "$pseudochannel = '"+os.path.abspath(os.path.dirname(__file__))+"';") configData = configData.replace("$pseudochannel = '/home/pi/channels/';", "$pseudochannel = '"+os.path.abspath(os.path.dirname(__file__))+"';")
job.run() configFile.close()
configFile = open(path+"/psConfig.php", 'w')
configFile.write(configData)
configFile.close()
#job.run()
parser = argparse.ArgumentParser(description='Pseudo Channel Controls') parser = argparse.ArgumentParser(description='Pseudo Channel Controls')
try: try:
@@ -475,10 +632,10 @@ parser.add_argument('-cc', '--copyconfig',
choices = channelsList, choices = channelsList,
help='Copy root config file to one or all channels') help='Copy root config file to one or all channels')
parser.add_argument('-tv', '--tv', parser.add_argument('-tv', '--tv',
action = 'store', action = 'store_true',
help='Add another TV with linked database') help='Add another TV with linked database')
parser.add_argument('-u', '--update', parser.add_argument('-u', '--update',
choices = ['main','dev'], action = 'store_true',
help='Update Pseudo Channel to the Latest Version') help='Update Pseudo Channel to the Latest Version')
parser.add_argument('-w', '--web', parser.add_argument('-w', '--web',
action = 'store', action = 'store',
@@ -500,11 +657,20 @@ if args.copyconfig:
print("COPYING CONFIG TO ALL CHANNELS") print("COPYING CONFIG TO ALL CHANNELS")
copyconfig() copyconfig()
if args.tv: if args.tv:
print("SETTING UP PSUEDO CHANNEL FOR CLIENT "+str(args.tv)) print("SETTING UP PSUEDO CHANNEL FOR CLIENT")
#copy_tv(args.tv) import plex_token as plex_token
PLEX = PlexServer(plex_token.baseurl, plex_token.token)
clientList = []
for i, client in enumerate(PLEX.clients()):
clientList.append(client.title)
installDir = os.getcwd()
print(installDir)
parentDir = os.path.abspath(os.path.join(installDir, os.pardir))
print(parentDir)
copy_tv(clientList, installDir, parentDir)
if args.update: if args.update:
print("UPDATING PSEUDO CHANNEL FROM GIT BRANCH "+str(args.update)) print("UPDATING PSEUDO CHANNEL FROM GIT")
#ps_update(args.update) ps_update()
if args.web: if args.web:
print("SETTING UP PSEUDO CHANNEL WEB INTERFACE AND API FROM GIT BRANCH "+str(args.web)) print("SETTING UP PSEUDO CHANNEL WEB INTERFACE AND API FROM GIT BRANCH "+str(args.web))
#web_setup(args.web) #web_setup(args.web)