Best development practice

Hi all,



I am going to start on my first plugin. For sputnik.dk (a danish premium webtv channel) and was wondering how you guys do the development? do you have some kind of debug setup, or du you make your changes, restart the media server, and just see if it works?



Sune

ill outline my dev practice later, but first of all, you dont need to restart the media server to see the changes, the plugin updates live as soon as you hit save in your text editor.

my first advice is get yourself a good programer’s text editor, while i strongly prefer Textmate, anything from Emacs to BBEdit will do, use what you’re comfortable with. a full IDE like xcode or eclipse would technically work but isnt ideal, its way too heavy for just python, and a good text editor (Textmate!!!) will be your best friend for life. Just please please please for god’s sake dont use apple’s textedit or god forbid, word. Really you want something lightweight and flexible, with features geared toward coding, you absolutely must have syntax highlighting and basic code validation. good syntax highlighting in particular (look for something with customizable color themes) will catch 98% of common errors and mistypings that you’d be searching for for hours in textedit.

skipping ahead here a bit, as for debugging a plugin, once syntax and whitespace errors that would prevent it from loading at all are out of the way, any fatal errors cause a traceback to be written to the plugin’s log file at ~/Library/Logs/PMS Plugin Logs/com.plexapp.plugins.yourpluginname.log so you can see what happened. beyond that, if the code’s not throwing errors, but just not working the way you want it to, you can use the framework’s Log() function to write to the plugin’s log file in order to inspect the contents of a variable or to get an idea of what’s going wrong where.

Thanks a lot, that clarified things.



Already using textmate for all my development work, actually I am one of the programmers behind the sputnik.dk site, and this was done in textmate :slight_smile:



just wanted to know how the plugins behaved when throwing exceptions and such.



Again, thank you :slight_smile:

One thing to add to Billy’s suggestions is to run PMS from the command line and then you can see Log messages, exceptions etc in the terminal.



<br />
killall "Plex Media Server"<br />
<br />
~/Library/Application\ Support/Plex/Plex\ Media\ Server.app/Contents/MacOS/Plex\ Media\ Server<br />




other than that, the dev site and existing plugins for example code are your best friends.

Jonny

The next version of the Media Server logs to a standard log file, so that last scary Terminal step won’t be needed :slight_smile:



sounds good, because when doing a tail -f on the plugin logfile, you have to reopen everytime the plugin crashes, as it starts a new file :) And when you are coming from PHP and doing your first Python, it crashes a lot :D

You shouldn’t need to tail the plug-in logfile, if you run the media server from the Terminal you can see the plug-in “crashes” (stack traces) and you don’t need to restart/reopen.



Will do that instead, otherwise, what a great job on the plugin framework. I really like it so far!


Thanks very much for your kind words!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.