It’s been a while since I’ve visited both these forums and Plex channel development. With day job pressures easing, I’ve decided to revisit some of my past work and maybe knock over a few other channel ideas however I’m finding myself increasingly frustrated with the workflow. Perhaps its just me not understanding some fundamentals but I’m having a nightmare of a time debugging as I work.
Currently I’m just dumping my code in a live bundle and working from there, testing in Plex/Web.
I’m constantly greeted with “This channel is not responding” without any corresponding errors in the logs. My own logged comments seem to only show sporadically (is the framework loading the whole file first and bugging, rather than running code iteratively?). And God forbid I make a syntax error, where apparently I have to restart the whole Plex server before it will detect any changes.
It seems as though changes to my code aren’t always detected by the framework immediately, I don’t know if its some kind of caching / routing / context issue or what. Surely I’m not the only one with these issues and surely there is a better way!?
Can someone more knowledgeable than I please explain how they debug their work without wanting to kill themselves?
Dramatics aside, perhaps I’m just bad at Python. Here’s a code snippet. Channel is not responding as soon as I added the HTML.ElementFromString line (the request is returning valid JSON, I even managed to see it in the log once… =/ ). Can anyone see any issues with this? (Assume constants are set, they are).
I would not use Plex Web for real time testing due to the caching in web browsers.
I use Roku. But any client is better than Plex Web. PHT is another good client. You can install it on the same computer as your PMS and your code editing, but I like being able to look at my code on Notepad++ (my code editing software) and/or the logs at the same time I am looking at the Plex player/client screen when I test changes.The Android or iOS app, anything is better than PlexWeb.
And you do not have to be perfect at Python. You just need to use a client that doesn’t have a cache. My xpath, syntax and every other part of my programming is usually full of issues I have to fix along the way. With the Roku, I just save the changes in Notepad++ and then back out and reenter that directory on the Roku to see the changes I just made (or the channel, if I edit the main or start menu) and if I get a content unavailable error, it shows up in the logs right away.
Now once I have the channel working the way I want, I will try it with PlexWeb, just to make sure it works the same way in multiple clients.
Also when you fix a syntax/indention error that causes the channel to not open or freeze up, it will take anywhere from 2-5 minutes for the error to clear in the logs after you have updated your code, but you do not have to reboot Plex Media Server.
You should only have to reboot Plex Media Server when you alter the plist files (ServiceInfo.plist or Info.plist). Which I admit is usually my bigest annoyance because my regex is horrible.
And also realize that some errors in your URL service may show up in the specific channel log and some may only show up in the system log. It depend on the client you are using and at what point in the process of calling the URL service the error occurs. (Most clients do a URL lookup to pull all the media object data including metadata, but the Roku uses the metadata in the channel xml and then just makes a request for the key data).
@shopgirl284 said:
I would not use Plex Web for real time testing due to the caching in web browsers.
Now that you say that, this seems obvious. I’m a web developer and I guess I just instinctively reached for the browser.
@shopgirl284 said:
PHT is another good client. You can install it on the same computer as your PMS and your code editing
Currently I’m running PMS from a Synology NAS and editing from a network mounted drive. I had considered installing a copy of PMS on my local PC just for testing purposes, if I had to continue to restart the PMS service from the Synology, however according your other point that shouldn’t really be necessary. I’ll give PHT a go.
@shopgirl284 said:
And also realize that some errors in your URL service may show up in the specific channel log and some may only show up in the system log.
Thanks, I was aware of that one, but a good point nonetheless. Cheers for your feedback, that was useful.
Just following up on this for anyone else who stumbles on my rant.
I’m developing on Windows and discovered the Plex Windows app is a great alternative to a Roku (as suggested by shopgirl284). The app doesn’t suffer from the caching issues that a browser does and it even provides handy error messages as popups when something’s gone wrong.
Thanks again shopgirl284 for your insight, it’s really helped me out.
I use a laptop for everything, so I have more flexibility and mobility, but I would think most here either use a laptop (so they could use it in front of a TV with Plex), or they have a TV with Plex in the same room as the desktop they use for developing.
Am I wrong in that assumption?
So why can you not just use the Plex app on that TV for testing, since it is always best to see your channel on a TV screen during development?
Sure, you could. Personally, I develop primarily on a desktop and prefer to have a local client simply for the speed and ease of switching. I have a few monitors so having and my IDE on one screen and Plex on the other works great for me. I’d imagine developing from the couch and using a remote to go back and forth would actually be kind of a pain in the ■■■■… but each to their own I guess.
My main concerns was with the lack of error reporting and seemingly nonsensical refreshing of my code but that’s been fixed by not using Plex/Web to test, as you suggested.
The biggest workflow issue is using a client other than Plex Web, so you can see your changes in real time. And figuring out how to see any changes or issues without having to reboot PMS, unless it is for plist changes.
I think you are not alone in your opinion of my method of sitting on the couch with a remote. But I like using the TV screen because I feel like I can see the channels the way the users will. So, I am more likely to see usability issues, like the best way to split up navigation/directories and results.
But then I do not have multiple computers/monitors, so switching back and forth from my code to a Plex client screen is actually more of a pain for me.
Is there no way to make PMS clear the cache, besides rebooting, so I can see the latest change on Plex Web? Plex Web is really the most convient way to test for me right now. I’m running Plex in a Docker container and just developing locally right now. Other computers, besides my laptop, don’t have access to the PMS.
@dmp1ce said:
Is there no way to make PMS clear the cache, besides rebooting, so I can see the latest change on Plex Web? Plex Web is really the most convient way to test for me right now. I’m running Plex in a Docker container and just developing locally right now. Other computers, besides my laptop, don’t have access to the PMS.
You can set a global cache time to zero. This can git rid of Plex Web errors, but only after the browser has cleared its cache and sometimes the server cache as well. I outline this method in Comment_1151537 in the Edit section at the bottom of my comment.
Even if you do clear the cache, I would still suggest using another device, especially if you are using Chrome or Firefox. So many websites now only offer HLS videos and Chrome has so many restrictions on HLS, many HLS videos will not play on Chrome. Firefox has similar issues with HLS.