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
|
python $pyscript
|
||||||
|
|
||||||
DISPLAY=:0 cvlc --fullscreen --play-and-exit --sub-source logo --logo-position 10 --logo-opacity=128 --logo-file $buglocation --no-osd $playlist
|
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
|
|
||||||
|
|
||||||
|
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.
|
#the "station id" video that calls out what the channel is. have fun with it.
|
||||||
stationID = "/media/zella/anime/stationid/AAEAStationID.mp4"
|
stationID = "/media/zella/anime/stationid/AAEAStationID.mp4"
|
||||||
|
|
||||||
secondsInHour = 3600
|
secondsInBlock = 1800
|
||||||
episodeBlockTime = 1560
|
episodeBlockTime = 1560
|
||||||
minimumTime = 30
|
minimumTime = 30
|
||||||
|
|
||||||
@ -123,70 +123,64 @@ print("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
|
|||||||
episodesEmptyFlag = False
|
episodesEmptyFlag = False
|
||||||
firstLoop = True
|
firstLoop = True
|
||||||
while not episodesEmptyFlag:
|
while not episodesEmptyFlag:
|
||||||
|
#generate next episode block (station id + episode + fill in any extra time with commercial spots)
|
||||||
if firstLoop:
|
if firstLoop:
|
||||||
timeLeft = get_remaining_seconds_in_hour()
|
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
|
firstLoop = False
|
||||||
else:
|
else:
|
||||||
timeLeft = secondsInHour
|
timeLeft = secondsInBlock
|
||||||
random.shuffle(showNumberList)
|
random.shuffle(showNumberList)
|
||||||
showNumberListCount = 0
|
showNumberListCount = 0
|
||||||
while timeLeft > minimumTime:
|
if timeLeft >= episodeBlockTime: #while there is time left in the 30 minute block
|
||||||
if timeLeft >= episodeBlockTime:
|
#add station id
|
||||||
print("Enough time for an episode block")
|
timeLeft -= get_video_length_in_seconds(stationID)
|
||||||
#add station id
|
playlist.write(stationID + "\n")
|
||||||
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")
|
|
||||||
|
|
||||||
#add tv episode
|
#add tv episode
|
||||||
nextEpisode = ""
|
nextEpisode = ""
|
||||||
while showNumberListCount < len(showNumberList):
|
while showNumberListCount < len(showNumberList):
|
||||||
nextEpisode = get_next_show_episode(showNumberList[showNumberListCount])
|
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
|
|
||||||
if nextEpisode is None:
|
if nextEpisode is None:
|
||||||
print("Episodes exhausted! Completing Playlist!\n")
|
showNumberListCount += 1
|
||||||
episodesEmptyFlag = True
|
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
|
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()
|
nextAd = get_next_commercial()
|
||||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
comLength = get_video_length_in_seconds(nextAd)
|
||||||
playlist.write(nextAd + "\n")
|
if timeLeft > comLength:
|
||||||
|
timeLeft -= comLength
|
||||||
#add commercial.
|
playlist.write(nextAd + "\n")
|
||||||
nextAd = get_next_commercial()
|
print("\nCommercial " + nextAd + " added to playlist.\n")
|
||||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
else:
|
||||||
playlist.write(nextAd + "\n")
|
print("\nCommercial too long. retrying...\n")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
#no time for furtur episodes this hour
|
#no time for furtur episodes this hour
|
||||||
print("Not enough time for another episode this hour. Padding")
|
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.
|
#add commercial.
|
||||||
nextAd = get_next_commercial()
|
while timeLeft > minimumTime:
|
||||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
nextAd = get_next_commercial()
|
||||||
playlist.write(nextAd + "\n")
|
comLength = get_video_length_in_seconds(nextAd)
|
||||||
|
if timeLeft > comLength:
|
||||||
#add commercial.
|
timeLeft -= comLength
|
||||||
nextAd = get_next_commercial()
|
playlist.write(nextAd + "\n")
|
||||||
timeLeft -= get_video_length_in_seconds(nextAd)
|
print("\nCommercial " + nextAd + " added to playlist.\n")
|
||||||
playlist.write(nextAd + "\n")
|
else:
|
||||||
|
print("\nCommercial too long. retrying...\n")
|
||||||
|
|
||||||
print("playlist file creation complete")
|
print("playlist file creation complete")
|
||||||
|
Loading…
Reference in New Issue
Block a user