Brainstorming a saturday morning cartoon playlist generator for my media library

Gonna do it in PHP because I used PHP daily for 12 years and haven’t used it in like 5 years and want to reconnect with it.

I have quite a few shows downloaded and want to have a way to generate a playlist for the day for my kid to watch on his tablet.

Will need a database to keep track of every show and episode and if he’s watched it before.

Do I want to bother renaming every file to have a sensible name or just compensate for it in the code with some regex?

$showModel->getEpisode( $absolute_episode= 40);
$showModel->getEpisode( $season = 2, $episode = 17);
$showModel->getLastWatchedEpisode();
$showModel->getNextUnwatchedEpisode();

Getting an episode, whether looking at file names on disk, or looking in a database… when I put them into the database in the first place I would need to have already parsed the random file names to deduce the season and episode to store that info properly.

$allShows = $showModel->getAllShows();
for each {
$allShows as $showModel... 
$playlistBuilder->add( $showModel->getNextUnwatchedEpisode() );
}

$playlistBuilder->randomize();
$playlistBuilder->writeM3uFile( date("Y-m-d") );

By using extended m3u options I might be able to force VLC to show a more detailed playlist entry item than just the awkward original file names.

Will need to be able to include/exclude shows from the playlist build process to make it easy to test/debug certain things.

For example if I have only 5 episodes of Big City Greens and all 5 eventually get marked as watched then there won’t be anything returned from $showModel->getNextUnwatchedEpisode(); When I add 20 more episodes of that I’d like to be able to do a test run that includes only Big City Greens, One Piece, and Naruto just to make sure that those new episodes are being picked up.

to be continued…

2 Likes

There’s no need to do all this yourself, just use Jellyfin

1 Like

I don’t want to binge 1 show. I want to recreate the experience of a tv station with a different show every 30 minutes, and possibly even classic commercials for toys that no longer exist, lol. I also need to automatically copy today’s episodes to a folder that auto sync’s with his tablet.

I keep saying “today’s” playist but with each show at 20 minutes and the number of shows it’s more like 3 days, especially if he’s only watching his tablet when we’re in the car.

1 Like