„tv_program.py“ ändern
This commit is contained in:
parent
90523b57c7
commit
fca3b43ff1
@ -27,22 +27,22 @@ myday = f"{date.today():%d}"
|
|||||||
print("Day:", myday)
|
print("Day:", myday)
|
||||||
|
|
||||||
# Define the time range (modify as needed)
|
# Define the time range (modify as needed)
|
||||||
default_start_time = 2015 # 5:30 AM
|
default_start_time = "20:15" # 8:15 PM
|
||||||
default_end_time = 2030 # 4:00 PM
|
default_end_time = "20:30" # 8:30 PM
|
||||||
|
|
||||||
# Create an argument parser
|
# Create an argument parser
|
||||||
parser = argparse.ArgumentParser(description="TV Program Viewer")
|
parser = argparse.ArgumentParser(description="TV Program Viewer")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--start-time",
|
"--start-time",
|
||||||
type=int,
|
type=str,
|
||||||
default=default_start_time,
|
default=default_start_time,
|
||||||
help="Start time in HHMM format (e.g., 0530 for 5:30 AM)",
|
help="Start time in HH:MM format (e.g., 05:30 for 5:30 AM)",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--end-time",
|
"--end-time",
|
||||||
type=int,
|
type=str,
|
||||||
default=default_end_time,
|
default=default_end_time,
|
||||||
help="End time in HHMM format (e.g., 2030 for 8:30 PM)",
|
help="End time in HH:MM format (e.g., 20:30 for 8:30 PM)",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -59,15 +59,16 @@ def getValues(id, start_time, end_time):
|
|||||||
st = a.get('startTime')
|
st = a.get('startTime')
|
||||||
d = a.get('duration')
|
d = a.get('duration')
|
||||||
start = time.strftime("%-H:%M", time.localtime(st))
|
start = time.strftime("%-H:%M", time.localtime(st))
|
||||||
start_time_int = int(start.replace(":", ""))
|
# Split the start time into hours and minutes
|
||||||
|
start_hours, start_minutes = map(int, start.split(":"))
|
||||||
day = time.strftime("%d", time.localtime(int(st)))
|
day = time.strftime("%d", time.localtime(int(st)))
|
||||||
if day == myday and start_time <= start_time_int < end_time:
|
if day == myday and start_time <= f"{start_hours:02}:{start_minutes:02}" <= end_time:
|
||||||
data.append([start, title])
|
data.append([start, title])
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def makeList(start_time, end_time):
|
def makeList(start_time, end_time):
|
||||||
print("Channel:", len(dictList))
|
print("Channels:", len(dictList))
|
||||||
table.append(["Channel", f"TV Shows from {start_time // 100}:{start_time % 100:02d} to {end_time // 100}:{end_time % 100:02d}"])
|
table.append(["Channel", f"TV Shows from {start_time} to {end_time}"])
|
||||||
for ch in dictList:
|
for ch in dictList:
|
||||||
data = [ch.upper()]
|
data = [ch.upper()]
|
||||||
channel_data = getValues(dictList.get(ch), start_time, end_time)
|
channel_data = getValues(dictList.get(ch), start_time, end_time)
|
||||||
|
Loading…
Reference in New Issue
Block a user