Lists in PrefsItem

How can I use name->value lists in PrefsItem?



Currently I am using the following method that might be not correct

i declare an array



SORTING = [<br />
	[L('ONAIR'), 'on_air'],<br />
	[L('PRODUCTION'), 'production_year'],<br />
	[L('NAME'), 'name'],<br />
	[L('MARK'), 'mark_total']]


then make list with names in Prefs


def CreatePrefs():<br />
	sortingOption = []<br />
	for name, value in SORTING:<br />
		sortingOption.append(name)<br />
	Prefs.Add(id='sorting', type='enum', default='on_air', label=L('SORTING'), values=sortingOption)<br />




Then somewhere in procedures I loop though the array to find matching value


<br />
for name, value in SORTING:<br />
		if name==Prefs.Get('sorting'):<br />
			sortby=value<br />
url=BASE_URL+PATH+"&sort="+sortby<br />




I thing It should be nicer way doing this. Can somebody give me a hint?

You should be able to us an enum as your pref item type.



Look in the doc in the developper section of the website, it should be explained there. Otherwise look at an example plugin. Look for example at the beta of YouTube I posted on the forums.



Also you should really move to v2 framework where there isnt prefs.get and .set anymore nor createprefs but a defaultprefs.Json file.

Do you mean http://dev.plexapp.com/ ? There is nothing about framework v2.

Grey Download button is not referring anywhere.

Latest Article there is dated by August 7th, 2009!

The kick starter generator generates v1 framework plugin.

PlexMediaFramework.pdf “Plex Development Manual” is dated October 19, 2009!

http://forums.plexapp.com/index.php/topic/18324-updating-plugins-to-v2-framework/ just brief explanation of difference between two versions of frameworks.

How do you expect newbies can start making plugins and help to develop the project?

I am sure some plugins are made in framework v2, and some of them utilize drop down lists, but it takes time to dig every plugin to find certain solution.

Please provide me with links to the tutorials and Plex Development Manual for framework V2.



Sorry if I was emotional.

most of the v2 info is located here:

Updating plugins to v2 framework



you’re right, all of the development info isn’t very organized. But once you pick it up, it’s fairly straight forward.


I am referring to http://dev.plexapp.com/docs/ and yes the docs are outdated a bit and the download is greyed out (view online works fine). But truth is v2 has really a minimal amount of changes that are summed up in the forum link you pasted.



The plugin kickstarter generated v2 plugins (it has been recently updated by me you can ask me questions directly about it if you want)



Newbies have been doing plugins and have helped the project. One of the great strength of Plex is its community and the large number of very competent and very available people on the forums, always ready to help and answer questions. Don’t be afraid to ask.

Thank you guys!



I met PLEX last christmas, had no experience of python, but so far I made 4 plugins for Russian community. ( http://www.rozdol.com/index.php/plex/ )

eTVnet had even provided me free account for plugin developed for their resource. :slight_smile:



Pierre, I will use your v2 plugin kickstarter for my next plugin.

Ok. I have completely rewritten plugin in FW v2.

Now I want to make it work in iOS.

The stream that plugin plays .wmv with WMV3 video and VMA2 audio.

I enable iOS in info.plist


<br />
<key><br />
	PlexAudioCodec</key><br />
	<array><br />
		<string>WMA2</string><br />
	</array><br />
	<key>PlexClientPlatforms</key><br />
	<string>MacOSX,iOS,Android</string><br />
	<key>PlexFrameworkVersion</key><br />
	<string>2</string><br />
	<key>PlexMediaContainer</key><br />
	<array><br />
		<string>WMV9</string><br />
	</array><br />
	<key>PlexPluginMode</key><br />
	<string>AlwaysOn</string><br />
	<key>PlexVideoCodec</key><br />
	<array><br />
		<string>WMV3</string><br />
	</array>


But my iphone PLEX app crashes with error:




How to solve it?

Not 100% sure but ibthought the video and audio format keys were not used by the current plex client / pms but were more meant for LG and future clients. Try taking them out entirely I bet you get the exact same error.

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