I’m trying to create a plugin that shows a list of local videos. The list appears fine but I can’t get any of the videos to play. I’ve tried the instructions at this topic but get a “301” response. Nothing shows up in the user interface.
Basically I’m trying the play the video using this code snippet:
Redirect(Stream.LocalFile(’/Volumes/ExternalHardDrive/Media/Salsa/Lessons/School/Salsa/6/02.2.mp4’))
I’ve attached logfile output and source code below.
Log:
1/28/12 10:15:38.240 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:15:38,239 - com.plexapp.plugins.salsa (-4f967000) : DEBUG (runtime:678) - Response: 301<br />
1/28/12 10:25:54.646 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:54,646 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:528) - Handling request GET /video/salsa<br />
1/28/12 10:25:54.647 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:54,646 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:575) - Found prefix handler matching /video/salsa<br />
1/28/12 10:25:54.648 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:54,647 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:320) - Loaded the user preferences for com.plexapp.plugins.salsa<br />
1/28/12 10:25:54.651 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:54,651 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:678) - Response: 200<br />
1/28/12 10:25:54.653 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:54,652 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:353) - Saved the user preferences<br />
1/28/12 10:25:55.289 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:55,289 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:528) - Handling request GET /video/salsa/:/function/LatestLessons?function_args=Y2VyZWFsMQozCmRpY3QKZGljdApGcmFtZXdvcmsub2JqZWN0cy5JdGVtSW5mb1JlY29yZAoxCnIyCnM2CnNlbmRlcjUKczE0CkxhdGVzdCBsZXNzb25zczkKaXRlbVRpdGxlczUKU2Fsc2FzNgp0aXRsZTFzNApOb25lczYKdGl0bGUyczM5Ci92aWRlby9zYWxzYS86L3Jlc291cmNlcy9iYWNrZ3JvdW5kLmpwZ3MzCmFydHM0MQovdmlkZW8vc2Fsc2EvOi9yZXNvdXJjZXMvaWNvbi1kZWZhdWx0LmpwZ3M1CnRodW1icjEKcjAK<br />
1/28/12 10:25:55.291 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:55,290 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:760) - Calling function 'LatestLessons'<br />
1/28/12 10:25:55.291 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:55,291 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:320) - Loaded the user preferences for com.plexapp.plugins.salsa<br />
1/28/12 10:25:55.293 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:55,292 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:353) - Saved the user preferences<br />
1/28/12 10:25:55.322 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:55,321 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:678) - Response: 200<br />
1/28/12 10:25:56.273 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,272 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:528) - Handling request GET /video/salsa/:/function/PlayVideo?function_args=Y2VyZWFsMQoxCmRpY3QKMQpzNzkKL1ZvbHVtZXMvQmFja3VwU2Vjb25kYXJ5L01lZGlhL1NhbHNhL0xlc3NvbnMvUHVyYSBTYWxzYS9TYWxzYS82IC0gMTIuMS8wMi4yLm1wNHM0CnBhdGhyMAo_<br />
1/28/12 10:25:56.274 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,273 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:760) - Calling function 'PlayVideo'<br />
1/28/12 10:25:56.275 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,274 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:320) - Loaded the user preferences for com.plexapp.plugins.salsa<br />
1/28/12 10:25:56.276 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,275 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (networking:115) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0cmVhbVNlcnZpY2U6UmVnaXN0ZXJMb2NhbEZpbGU_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMgpzNzkKL1ZvbHVtZXMvQmFja3VwU2Vjb25kYXJ5L01lZGlhL1NhbHNhL0xlc3NvbnMvUHVyYSBTYWxzYS9TYWxzYS82IC0gMTIuMS8wMi4yLm1wNHM0CnBhdGhuczQKc2l6ZXIwCg__'<br />
1/28/12 10:25:56.277 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,276 - com.plexapp.plugins.salsa (-4fa6b000) : DEBUG (prefskit:353) - Saved the user preferences<br />
1/28/12 10:25:56.285 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,285 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (networking:115) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X1N0cmVhbVNlcnZpY2U6SXNTdHJlYW1WYWxpZA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMQpzMzYKZTc4YTFmNTUtYTI2Mi00YzkwLWI1ZjktNTdhODhhNmUyM2JmczQKdXVpZHIwCg__'<br />
1/28/12 10:25:56.299 PM [0x0-0x2ea2ea].com.plexapp.plexmediaserver: 2012-01-28 22:25:56,299 - com.plexapp.plugins.salsa (-4faed000) : DEBUG (runtime:678) - Response: 301
__init__.py:
import os<br />
import salsaBrowser<br />
<br />
VIDEO_PREFIX = "/video/salsa"<br />
NAME = 'Salsa'<br />
ART = 'background.jpg'<br />
ICON = 'icon-default.jpg'<br />
<br />
def Start():<br />
''' Called when the plug-in first started '''<br />
Plugin.AddPrefixHandler(VIDEO_PREFIX, VideoMainMenu, NAME, ICON, ART)<br />
Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")<br />
Plugin.AddViewGroup("List", viewMode="List", mediaType="items")<br />
<br />
# set some defaults to prevent having to pass these every single time<br />
MediaContainer.title1 = NAME<br />
MediaContainer.viewGroup = "List"<br />
MediaContainer.art = R(ART)<br />
DirectoryItem.thumb = R(ICON)<br />
VideoItem.thumb = R(ICON)<br />
<br />
def VideoMainMenu():<br />
''' Called when the Salsa main menu is to be shown'''<br />
dir = MediaContainer(viewGroup="InfoList")<br />
dir.Append(<br />
Function(<br />
DirectoryItem(<br />
LatestLessons,<br />
"Latest lessons",<br />
subtitle="",<br />
summary="",<br />
thumb=R(ICON),<br />
art=R(ART)<br />
)<br />
)<br />
)<br />
return dir<br />
<br />
def LatestLessons(sender):<br />
'''Lists most recent lessons'''<br />
lessons = salsaBrowser.getLessonsAll()<br />
dir = MediaContainer(viewGroup="InfoList")<br />
for lesson in lessons:<br />
summary = lesson['school'] + '
'<br />
summary += lesson['course'] + '
'<br />
summary += lesson['season'] + '
'<br />
summary += lesson['videoPath']<br />
dir.Append(<br />
DirectoryItem(<br />
key = Callback(PlayVideo, path=lesson['videoPath']),<br />
title = lesson['lessonFilename'],<br />
subtitle = lesson['school'],<br />
summary = summary,<br />
thumb = R(ICON),<br />
art = R(ART)<br />
)<br />
)<br />
break # List only 1 video for now<br />
return dir<br />
<br />
def PlayVideo(path):<br />
''' Play a video '''<br />
return Redirect(Stream.LocalFile(path))