Today is a quick post about what I’m doing with Project One this week and some of my testing.
Testing the Concepts
After doing a lot of thinking about this project, there were a few concepts that I knew I needed to get under my belt before starting to write the actual code. For example, the concept of reading and parsing time. Sounds simple, right? A 24 minute episode is less than 30 minutes, so we have a 30 minute time block with 6 minutes of “empty air”. How do we use Python to calculate this?
What about storing TV Show and Movie metadata? How can we accomplish this while the main rule for this project is “offline first”? More on this below.
There are many small concepts like this that I want to understand and do some testing with. I have set small goals and wrote quick Python files to do just those things. This way, I can get a decent understanding of how to express these concepts in Python. I’m also trying my best to write decent notes along the way.
Offline first . . .
Setting rules for a project like this and sticking to it is always tricky. Once you start, things can easily change along the way. When it comes to handling metadata for a TV show like “Friends”, I have 2 options: I could either manually create offline files (NFOs, JSON, TXT, etc) for every single episode or I could pull that information automatically from an external source like TheTVDB. I looked around the web to see how people have been storing this information and I could not find a great solution for offline storage other than the traditional NFO file; Plex and Jellyfin have internal DBs that are stored offline but pull from sources like TheTVDB and IMDB.
My thought is that this device won’t always be offline. If we are not traveling, it will be at home and connected, so the program can check for offline data and pull it with a single API call for future access if it does not exist. From there, the program can reference this metadata and update the database as needed.
Sure, it’s not 100% offline, but if you want metadata and don’t want the headache of manually creating files for each episode, it’s just better to rely on an external source. I think that this still allows for playback and scheduling to be done fully offline.
I’m thinking of treating this project like any TV station would: hire a staff and give them a job to make sure things run smoothly. In this case, I currently have defined 3 staff members to accomplish my goals. There is a Program Manager, a Scheduler, and a File Watcher. Each member has specific jobs and work at specific times of the day. As “novel” as this idea might sound, it actually helps me to break the project down into smaller pieces. More on this in a future post.
I wrote my first piece of documentation this morning regarding the Channel Definition files. Each channel is defined by a simple JSON file, formatted with options that each channel needs, such as Channel Name, Channel Number, Random, Repeat, and of course, the SQLite query itself. Each piece of documentation is written in Markdown and will eventually follow some standards.
Raspberry Pi 4b
I ordered a Raspberry Pi 4b with 4GB RAM, so it should be here today. I already have a SATA to USB cable with a spare 2TB drive that I will get connected and going today.
So What’s v0.0.1 About?
There is still a lot of planning and learning going on, but I do know that I want to basically develop a simple proof of concept. Here are the highlights:
- Hardware: Raspberry Pi 4b + 2TB Hard Drive
- One channel, focused on a single TV show that airs between 5AM to 10PM.
- Scheduler - Scheduler can read channel definition file, create a schedule in air time chosen based on local database, fill in “empty air” with a “bumper” MP4 file (a video of TV snow or something), and each episode will start at the proper time block (5AM, 5:30AM, etc).
- File Watcher - Scan folders for TV shows, parse information on the hard drive, pull from TheTVDB, create offline data JSON files and database, manage database.
Doesn’t sound too hard, but it will take some time to get going.
There is more I have in my notes but I think this will do for now. See you on the next update.