This is my first plugin. I’ve searched the forum and the API, but unfortunately found nothing.
I want to get video clips from a specific webpage. So far everything works. I have a list of videos and can play the videos.
But I have a question:
How is it possible to provide a ‘sort by’ button on the iPad plex client. I mean such a sort button which exists for local media (in the upper right corner).
My first attempt was:
<br />
dir = ObjectContainer(view_group = 'InfoList')<br />
list = []<br />
for movie in movies<br />
some code<br />
list.append([(title, VideoClipObject(title = title, thumb = thumb, rating = rating, summary = summary, url = url))])<br />
list.sort()<br />
for sortedMovies in list:<br />
dir.add(sortedMovies[0][1])<br />
return dir
As a result the video clips are listed alphabetically. But it would be perfect if the order can be chosen freely (like sort by date, recently added, etc.).
You can use python’s “sorted()” method on the ObjectContainer and specify which attribute you want used for the sort.
<br />
oc = ObjectContatiner()<br />
''' insert code to build VideoClipObjects and add them to the container'''<br />
oc = sorted(oc, key=lambda media: media.title) ### any attribute of the Object should work for sorting<br />
return oc<br />
You can also specify that you want the list in the reverse order adding the "reverse" argument.
If you are willing to add an extra menu layer you can still have the user determine their choice for sorting at runtime. Something like this might work...
Hmm, ok. This is a possible solution. But it’s not a really nice one (regarding design / usability). There is no possibility to do it like in the screenshot? Is it because there is no XML metadata file? If so, is there a possibility to call a existing agent (like imdb, themoviesdb, etc.) and save the metadata on disk? If the user navigates to a video the metadata is loaded from the hard drive, but the video is still streamed over HTTP.
Plugins do not have access to client level controls like the Sort/Filter menu. Another option would be to add an item to the list which allows the user to change the sort order by selecting it, but it would show up as within the list of movies/videos/etc. rather than as a client level option.