shane-mason / FieldStation42

Broadcast TV simulator
Mozilla Public License 2.0
74 stars 6 forks source link

Receiving "No module named 'moviepy'" when trying to rebuild catalog #10

Open JonnyGators opened 2 days ago

JonnyGators commented 2 days ago

I'm still just starting to set this up, I assume I need to build a catalog to start with, so I tried running the python3 station_42.py --rebuild_catalog command. It spit out a bunch of text that ended with the No module named 'moviepy' error.

I re-read over all documentation searching for any mention of moviepy, what it is, or any requirement/prerequisit for this. I have found none. This has caught me completely by surprise, as nowhere was this mentioned in the documentation. Was it supposed to come through some other way?

I reviewed and confirmed that I've met all pre-requisits in that I have mpv and python3 installed and up to date. The cloned repository is also current and up to date. I'm still not sure how I can be missing something required.

I further searched for moviepy, and how to install it. All documentation points to running pip3 install moviepy. However, running this command on a prompt in raspbian results in a bunch of gibberish to the effect of the environment being externally managed. Not sure what this means, or why this means it cannot execute the installation I requested. It suggests instead trying apt install python3-xyz where xyz is the package you are trying to install.

Running the suggested command of sudo apt install python3-moviepy results in an error of "Package 'python3-moviepy' has no installation candidate"

I'm completely lost at this point. Please advise.

shane-mason commented 2 days ago

You ran the install script? Did you activate the python virtual environment before your ran station42? You need to run something like:

source env/bin/activate

That needs to be ran at least once in the shell before any python commands. You can add that to your login script so you don't have to enter it on each shell.

shane-mason commented 2 days ago

Also - station_42 will look to see if there is an existing catalog.bin file for the station and rebuild the catalog if there isn't. I am looking having it do an automatic 'quick look' for changes and then automatically updating the catalog if there have been changes.

JonnyGators commented 2 days ago

Ok, all good to know things. Running python3 station_42.py is resulting in the following

(env) jgata@raspberrypi:~/projects/FieldStation42 $ python3 station_42.py False Traceback (most recent call last): File "/home/jgata/projects/FieldStation42/station_42.py", line 255, in from confs.fieldStation42_conf import main_conf File "/home/jgata/projects/FieldStation42/confs/fieldStation42_conf.py", line 29, in load_json_stations() File "/home/jgata/projects/FieldStation42/confs/fieldStation42_conf.py", line 26, in load_json_stations main_conf['stations'] = sorted(stations, key=lambda station: station['channel_number']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jgata/projects/FieldStation42/confs/fieldStation42_conf.py", line 26, in main_conf['stations'] = sorted(stations, key=lambda station: station['channel_number'])


KeyError: 'channel_number'

I'm not finding any reference in the documentation for a 'channel_number', so I'm not seeing what I overlooked.
shane-mason commented 2 days ago

Oh yeah! I just added this in the last week. Good find! Who does quality control around here anyway?? ;) Quick fix: add a line like this in your config:

"channel_number": 1,

all the example json files in confs/examples contain that line. I would recommend using one of those as the starting point. Make sure you have done a fresh git pull to get all the latest goodies I have added.

This feature was added because I did't have a way of specifiying what order I wanted the channels to come in - soon I will add an overlay option to show the channel number when you turn the channel (my TV from '86 does that with a digital overlay)

shane-mason commented 2 days ago

Updated the documents with more information on that configuration option.

JonnyGators commented 2 days ago

Ok, that makes sense, I cleared that setting out since the documentation didn't include it or explain it, guess I should've left it alone.

Now I'm consistently getting stuck on the catalog build. So far I've only included 1 TV programs folder and 1 commercial folder to start with to build a single test channel that just plays episodes from the same show with commercials to pad them out, so it isn't a huge catalog to build. But it seems to always get stuck at the same point. I don't think it's a hardware issue, otherwise the failure point wouldn't be so consistent. I don't think it's a specific bad file it's trying to catalog - I renamed the file it got stuck at, and then it got stuck at the next file. I renamed my subfolders to be shorter in case I was running into a path size limitation, and it gets stuck at a different point after that change, but again, at the same consistent point. Something is making it crash.

When it happens, my putty session into the terminal becomes unresponsive, and eventually times out. Nothing is displaying on the screen (currently it's connected to an official Pi LCD, once I get things working as I want I'll move it over to a TV), my power button that's connected to a gpio becomes unresponsive, will not do a shutdown or power on, I'm not sure if it's powered on in a completely stuck state with no screen, or if it's powered off in some bad state that it won't turn back on, I have to pull the plug and plug it back in to get it to turn on again.

After a reboot, whether or not I run it with or without a --rebuild_catalog, it starts the catalog build, so whatever partially ran before doesn't leave it in a state of having a catalog, so it starts a new/first build.

Any idea how to troubleshoot what's crashing out the catalog building process?

shane-mason commented 2 days ago

Let me see if I understand correctly: its going through the files and adding them to the catalog and then it crashes and stops updating the screen?

I am running about 800 GB of movie files - takes about 3 to 4 minutes to process the catalog - so it shouldn't be a memory issue that you are seeing. File path length shouldn't be an issue. I am stumped. Its at different parts of the catalog this happens?

JonnyGators commented 2 days ago

If I don't change anything, it's at the same part of the catalog.

If I change a foldername or filename, it changes the part of the catalog.

I am creating folders in my test channel folder, and mounting them to folders on my media server, rather than copying things directly to the microsd card.

I was testing with a single TV show that has 8 seasons, I removed a few of the season folders out of my folder to allow it to finish, and that worked to get it past that point.

My problem now is I need to find a good collection of various length commercials, I pointed to a folder I have of a few crazy eddie commercials, but it now bombs out trying to make hour long blocks. I found a torrent with more ads.

I'll keep poking around and keep you posted, and let me know if you think of what might have caused it. I'm concerned as I ramp this up and build up a library I'm going to run into this again.

shane-mason commented 2 days ago

yeah - it needs a variety of commercials and bumps. I like bumps because they can be 2 or 3 second long station identifications.

I wonder if network issues were at play? I am using a local hard disk - but haven't tested at scale past the 800 GB of shows that I built out for this. Let me think on how I can do some synthetic testing.

JonnyGators commented 2 days ago

Well, if you want, but at this point feel free to hold off until I have more details. I'll troubleshoot some more and try to dial more into it. Sorry to be reaching out so much, you've been so great.