Re-worked Episode algorithmn to 30 minute blocks with commercials proceeding to fill time. More episode, less commercial.
This commit is contained in:
parent
d14b68451c
commit
69736c1361
@ -13,7 +13,7 @@ while(true); do
|
||||
|
||||
python $pyscript
|
||||
|
||||
DISPLAY=:0 cvlc --fullscreen --play-and-exit --sub-source logo --logo-position 10 --logo-opacity=128 --logo-file $buglocation --no-osd $playlist
|
||||
|
||||
done
|
||||
clear
|
||||
DISPLAY=:0 cvlc -q --fullscreen --play-and-exit --sub-source logo --logo-position 10 --logo-opacity=128 --logo-file $buglocation --no-osd $playlist 2> /dev/null
|
||||
|
||||
done
|
94
faketv.py
94
faketv.py
@ -15,7 +15,7 @@ commercials = "/media/zella/anime/commercials"
|
||||
#the "station id" video that calls out what the channel is. have fun with it.
|
||||
stationID = "/media/zella/anime/stationid/AAEAStationID.mp4"
|
||||
|
||||
secondsInHour = 3600
|
||||
secondsInBlock = 1800
|
||||
episodeBlockTime = 1560
|
||||
minimumTime = 30
|
||||
|
||||
@ -123,70 +123,64 @@ print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
|
||||
episodesEmptyFlag = False
|
||||
firstLoop = True
|
||||
while not episodesEmptyFlag:
|
||||
#generate next episode block (station id + episode + fill in any extra time with commercial spots)
|
||||
if firstLoop:
|
||||
timeLeft = get_remaining_seconds_in_hour()
|
||||
if timeLeft > secondsInBlock:
|
||||
timeLeft -= secondsInBlock; # only use the extra time over the first half hour on the opening block
|
||||
firstLoop = False
|
||||
else:
|
||||
timeLeft = secondsInHour
|
||||
timeLeft = secondsInBlock
|
||||
random.shuffle(showNumberList)
|
||||
showNumberListCount = 0
|
||||
while timeLeft > minimumTime:
|
||||
if timeLeft >= episodeBlockTime:
|
||||
print("Enough time for an episode block")
|
||||
#add station id
|
||||
timeLeft -= get_video_length_in_seconds(stationID)
|
||||
playlist.write(stationID + "\n")
|
||||
|
||||
#add commercial. Maybe add a while loop here to add multiple commercials if one is too short
|
||||
nextAd = get_next_commercial()
|
||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
||||
playlist.write(nextAd + "\n")
|
||||
if timeLeft >= episodeBlockTime: #while there is time left in the 30 minute block
|
||||
#add station id
|
||||
timeLeft -= get_video_length_in_seconds(stationID)
|
||||
playlist.write(stationID + "\n")
|
||||
|
||||
#add tv episode
|
||||
nextEpisode = ""
|
||||
while showNumberListCount < len(showNumberList):
|
||||
nextEpisode = get_next_show_episode(showNumberList[showNumberListCount])
|
||||
if nextEpisode is None:
|
||||
showNumberListCount += 1
|
||||
continue
|
||||
else:
|
||||
showNumberListCount += 1
|
||||
timeLeft -= get_video_length_in_seconds(nextEpisode)
|
||||
playlist.write(nextEpisode + "\n")
|
||||
print("\nEpisode " + nextEpisode + " added to playlist. " + str(len(lineupStack[showNumberList[showNumberListCount - 1]])) + " episodes left in stack\n")
|
||||
|
||||
break
|
||||
#add tv episode
|
||||
nextEpisode = ""
|
||||
while showNumberListCount < len(showNumberList):
|
||||
nextEpisode = get_next_show_episode(showNumberList[showNumberListCount])
|
||||
if nextEpisode is None:
|
||||
print("Episodes exhausted! Completing Playlist!\n")
|
||||
episodesEmptyFlag = True
|
||||
showNumberListCount += 1
|
||||
continue
|
||||
else:
|
||||
showNumberListCount += 1
|
||||
timeLeft -= get_video_length_in_seconds(nextEpisode)
|
||||
playlist.write(nextEpisode + "\n")
|
||||
print("\nEpisode " + nextEpisode + " added to playlist. " + str(len(lineupStack[showNumberList[showNumberListCount - 1]])) + " episodes left in stack\n")
|
||||
break
|
||||
|
||||
#add commercial.
|
||||
|
||||
if nextEpisode is None:
|
||||
print("Episodes exhausted! Completing Playlist!\n")
|
||||
episodesEmptyFlag = True
|
||||
break
|
||||
|
||||
#add commercial.
|
||||
while timeLeft > minimumTime:
|
||||
nextAd = get_next_commercial()
|
||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
||||
playlist.write(nextAd + "\n")
|
||||
|
||||
#add commercial.
|
||||
nextAd = get_next_commercial()
|
||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
||||
playlist.write(nextAd + "\n")
|
||||
comLength = get_video_length_in_seconds(nextAd)
|
||||
if timeLeft > comLength:
|
||||
timeLeft -= comLength
|
||||
playlist.write(nextAd + "\n")
|
||||
print("\nCommercial " + nextAd + " added to playlist.\n")
|
||||
else:
|
||||
print("\nCommercial too long. retrying...\n")
|
||||
|
||||
else:
|
||||
#no time for furtur episodes this hour
|
||||
print("Not enough time for another episode this hour. Padding")
|
||||
|
||||
#add station id
|
||||
timeLeft -= get_video_length_in_seconds(stationID)
|
||||
playlist.write(stationID + "\n")
|
||||
|
||||
#add commercial.
|
||||
nextAd = get_next_commercial()
|
||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
||||
playlist.write(nextAd + "\n")
|
||||
|
||||
#add commercial.
|
||||
nextAd = get_next_commercial()
|
||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
||||
playlist.write(nextAd + "\n")
|
||||
while timeLeft > minimumTime:
|
||||
nextAd = get_next_commercial()
|
||||
comLength = get_video_length_in_seconds(nextAd)
|
||||
if timeLeft > comLength:
|
||||
timeLeft -= comLength
|
||||
playlist.write(nextAd + "\n")
|
||||
print("\nCommercial " + nextAd + " added to playlist.\n")
|
||||
else:
|
||||
print("\nCommercial too long. retrying...\n")
|
||||
|
||||
print("playlist file creation complete")
|
||||
|
Loading…
Reference in New Issue
Block a user