mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-19 01:33:33 +00:00
Added another config flag for debug mode. If set to false then commercials are not included in the html / xml. Will soon effect other input.
This commit is contained in:
@@ -23,8 +23,6 @@ import textwrap
|
|||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
import sched
|
|
||||||
|
|
||||||
from threading import Timer
|
from threading import Timer
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
@@ -40,6 +38,7 @@ class PseudoChannel():
|
|||||||
PLEX = PlexServer(config.baseurl, config.token)
|
PLEX = PlexServer(config.baseurl, config.token)
|
||||||
MEDIA = []
|
MEDIA = []
|
||||||
GKEY = config.gkey
|
GKEY = config.gkey
|
||||||
|
|
||||||
USING_GOOGLE_CALENDAR = config.useGoogleCalendar
|
USING_GOOGLE_CALENDAR = config.useGoogleCalendar
|
||||||
|
|
||||||
USING_COMMERCIAL_INJECTION = config.useCommercialInjection
|
USING_COMMERCIAL_INJECTION = config.useCommercialInjection
|
||||||
@@ -48,11 +47,18 @@ class PseudoChannel():
|
|||||||
|
|
||||||
APP_TIME_FORMAT_STR = '%I:%M:%S %p'
|
APP_TIME_FORMAT_STR = '%I:%M:%S %p'
|
||||||
|
|
||||||
|
DEBUG = config.debug_mode
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.db = PseudoChannelDatabase("pseudo-channel.db")
|
self.db = PseudoChannelDatabase("pseudo-channel.db")
|
||||||
|
|
||||||
self.controller = PseudoDailyScheduleController(config.baseurl, config.token, config.plexClients)
|
self.controller = PseudoDailyScheduleController(
|
||||||
|
config.baseurl,
|
||||||
|
config.token,
|
||||||
|
config.plexClients,
|
||||||
|
self.DEBUG
|
||||||
|
)
|
||||||
|
|
||||||
"""Database functions.
|
"""Database functions.
|
||||||
|
|
||||||
@@ -1035,15 +1041,14 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
s = sched.scheduler(time, sleep)
|
|
||||||
|
|
||||||
the_daily_schedule = pseudo_channel.db.get_daily_schedule()
|
the_daily_schedule = pseudo_channel.db.get_daily_schedule()
|
||||||
|
|
||||||
daily_update_time = datetime.datetime.strptime(
|
daily_update_time = datetime.datetime.strptime(
|
||||||
pseudo_channel.translate_time(
|
pseudo_channel.translate_time(
|
||||||
pseudo_channel.DAILY_UPDATE_TIME
|
pseudo_channel.DAILY_UPDATE_TIME
|
||||||
|
),
|
||||||
|
pseudo_channel.APP_TIME_FORMAT_STR
|
||||||
)
|
)
|
||||||
, pseudo_channel.APP_TIME_FORMAT_STR)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|||||||
@@ -63,3 +63,5 @@ useGoogleCalendar = True
|
|||||||
useCommercialInjection = True
|
useCommercialInjection = True
|
||||||
|
|
||||||
dailyUpdateTime = "12:00 AM"
|
dailyUpdateTime = "12:00 AM"
|
||||||
|
|
||||||
|
debug_mode = False
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import logging.handlers
|
|||||||
|
|
||||||
class PseudoDailyScheduleController():
|
class PseudoDailyScheduleController():
|
||||||
|
|
||||||
def __init__(self, server, token, clients):
|
def __init__(self, server, token, clients, debugMode = False):
|
||||||
|
|
||||||
self.PLEX = PlexServer(server, token)
|
self.PLEX = PlexServer(server, token)
|
||||||
|
|
||||||
@@ -23,6 +23,8 @@ class PseudoDailyScheduleController():
|
|||||||
|
|
||||||
self.PLEX_CLIENTS = clients
|
self.PLEX_CLIENTS = clients
|
||||||
|
|
||||||
|
self.DEBUG = debugMode
|
||||||
|
|
||||||
self.my_logger = logging.getLogger('MyLogger')
|
self.my_logger = logging.getLogger('MyLogger')
|
||||||
self.my_logger.setLevel(logging.DEBUG)
|
self.my_logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
@@ -73,6 +75,10 @@ class PseudoDailyScheduleController():
|
|||||||
|
|
||||||
for row in datalist:
|
for row in datalist:
|
||||||
|
|
||||||
|
if str(row[11]) == "Commercials" and self.DEBUG == False:
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
timeB = datetime.strptime(row[8], '%I:%M:%S %p')
|
timeB = datetime.strptime(row[8], '%I:%M:%S %p')
|
||||||
|
|
||||||
if currentTime == None:
|
if currentTime == None:
|
||||||
@@ -184,6 +190,10 @@ class PseudoDailyScheduleController():
|
|||||||
|
|
||||||
for row in datalist:
|
for row in datalist:
|
||||||
|
|
||||||
|
if str(row[11]) == "Commercials" and self.DEBUG == False:
|
||||||
|
|
||||||
|
continue
|
||||||
|
|
||||||
numberIncrease += 1
|
numberIncrease += 1
|
||||||
|
|
||||||
with tag('tbody'):
|
with tag('tbody'):
|
||||||
|
|||||||
Reference in New Issue
Block a user