2007-08-14, 16:58
I just updated the script because the actual videos didn't show up.
http://max-server.informatik.uni-bremen....m/joox.rar
http://max-server.informatik.uni-bremen....m/joox.rar
import time
while(1):
time.sleep(500)
Nuka1195 Wrote:Just keep in mind sys.argv is shared between python sessions.so what do you think? is there any other possibility to tell each individual instance "who called"?
Quote:20:05:32 M: 41222144 DEBUG: CGUIMediaWindow::GetDirectory (plugin://video/Apple Movie Trailers Plugin/default.py/)
20:05:32 M: 41222144 DEBUG: ParentPath = []
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::GetDirectory - opened with plugin://video/Apple Movie Trailers Plugin/default.py/
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::GetDirectory - doing arguments stuff...
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::getNewHandle - getHandle called.
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::getNewHandle - Handle #:0
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::getNewHandle - Address00A16D4
20:05:32 M: 41226240 DEBUG: DIRECTORY::CPluginDirectory::GetDirectory - calling script Q:\plugins\video\Apple Movie Trailers Plugin\default.py('plugin://video/Apple Movie Trailers Plugin/default.py/','0','')
20:05:32 M: 41226240 DEBUG: LoadLibraryA('python24.dll')
20:05:32 M: 40103936 DEBUG: LoadLibrary('python24.dll') returning: 0xa4da50
20:05:33 M: 40103936 DEBUG: dllGetProcAddress(0x6d0780(kernel32.dll), 'InterlockedCompareExchange') => 0x1fde34
20:05:33 M: 39837696 DEBUG: GetModuleFileNameA(0x0, 0x1e102490, 256) => 'xbmc.xbe'
20:05:33 M: 39837696 DEBUG: advapi32.dll fake function RegQueryInfoKeyA called
20:05:33 M: 39837696 DEBUG: advapi32.dll fake function RegQueryInfoKeyA called
20:05:33 M: 39780352 DEBUG: LoadLibraryExA called with flags:
- LOAD_WITH_ALTERED_SEARCH_PATH
20:05:33 M: 39780352 DEBUG: LoadLibraryA('zlib.pyd')
20:05:33 M: 39710720 DEBUG: kernel32.dll fake function DisableThreadLibraryCalls called
20:05:33 M: 39710720 DEBUG: LoadLibrary('zlib.pyd') returning: 0xa3f160
20:05:33 M: 39710720 DEBUG: dllGetProcAddress(0x1e1b0000(zlib.pyd), 'initzlib') => 0x1e1b2150
20:05:33 M: 38830080 INFO: -->Python Initialized<--
20:05:33 M: 38830080 INFO:
20:05:33 M: 38301696 DEBUG: DIRECTORY::CPluginDirectory::GetDirectory - waiting...
20:05:33 M: 38301696 DEBUG: kernel32.dll fake function SetConsoleCtrlHandler called
20:05:33 M: 38301696 DEBUG: LoadLibraryExA called with flags:
- LOAD_WITH_ALTERED_SEARCH_PATH
20:05:33 M: 38301696 DEBUG: LoadLibraryA('_sqlite.pyd')
20:05:33 M: 38014976 DEBUG: kernel32.dll fake function DisableThreadLibraryCalls called
20:05:33 M: 38014976 DEBUG: LoadLibrary('_sqlite.pyd') returning: 0x84dc30
20:05:33 M: 38014976 DEBUG: dllGetProcAddress(0x10000000(_sqlite.pyd), 'init_sqlite') => 0x100012b0
20:05:33 M: 24645632 ERROR: CThread:taticThread : Access violation at 0x0001c0b5: Reading location 0x00000000
20:05:34 M: 24539136 INFO: Loading skin file: DialogBusy.xml
20:05:35 M: 24399872 ERROR: Unable to wait for NTP reply from the SNTP server, GetLastError returns 10060
20:05:43 M: 24465408 DEBUG: DIRECTORY::CPluginDirectory::GetDirectory - wait timed out
20:05:43 M: 24465408 DEBUG: DIRECTORY::CPluginDirectory::removeHandle - RemoveHandle called with handle 0.
20:05:43 M: 24465408 ERROR: CGUIMediaWindow::GetDirectory(plugin://video/Apple Movie Trailers Plugin/default.py/) failed
20:05:43 M: 24465408 DEBUG: CGUIMediaWindow::GetDirectory ()
20:05:43 M: 24465408 DEBUG: ParentPath = []
20:05:43 M: 24465408 DEBUG: CURL::CURL - Url has no protocol .tbn, empty CURL created
20:05:43 M: 24465408 DEBUG: CURL::CURL - Url has no protocol \folder.jpg, empty CURL created
20:05:43 M: 24465408 DEBUG: CURL::CURL - Url has no protocol add, empty CURL created
20:05:43 M: 23941120 INFO: Loading skin file: DialogOK.xml
20:05:45 M: 24006656 DEBUG: CApplication::OnKey: 256 pressed, action is 7
Index: xbmc/FileSystem/PluginDirectory.cpp
===================================================================
--- xbmc/FileSystem/PluginDirectory.cpp (revision 9957)
+++ xbmc/FileSystem/PluginDirectory.cpp (working copy)
@@ -55,7 +55,7 @@
}
// TODO: This should really pass in a CGUIListItem that we create directly from the ListItem sent in.
-void CPluginDirectory::AddItem(int handle, const string &name, const string &url, const string &iconPath, bool isDirectory)
+void CPluginDirectory::AddItem(int handle, const string &url, CGUIListItem &item, bool bIsFolder)
{
if (handle < 0 || handle >= (int)globalHandles.size())
{
@@ -63,11 +63,14 @@
return;
}
CPluginDirectory *dir = globalHandles[handle];
- CFileItem *pItem = new CFileItem(name);
+ CFileItem *pItem = new CFileItem(item.GetLabel());
pItem->m_strPath = url;
- pItem->SetThumbnailImage(iconPath);
- pItem->m_bIsFolder = isDirectory;
- pItem->SetLabelPreformated(true); // TODO: This is probably better not set once we have all the CFileItem stuff available.
+ pItem->SetLabel(item.GetLabel());
+ pItem->SetLabel2(item.GetLabel2());
+ pItem->SetIconImage(item.GetIconImage());
+ pItem->SetThumbnailImage(item.GetThumbnailImage());
+ pItem->m_bIsFolder = bIsFolder;
+ //pItem->SetLabelPreformated(true); // TODO: This is probably better not set once we have all the CFileItem stuff available.
dir->m_listItems.Add(pItem);
}
Index: xbmc/FileSystem/PluginDirectory.h
===================================================================
--- xbmc/FileSystem/PluginDirectory.h (revision 9957)
+++ xbmc/FileSystem/PluginDirectory.h (working copy)
@@ -20,7 +20,7 @@
bool GetPluginsDirectory(const CStdString &type, CFileItemList &items);
// callbacks from python
- static void AddItem(int handle, const string &name, const string &url, const string &iconPath, bool isDirectory);
+ static void AddItem(int handle, const string &url, CGUIListItem &item, bool bIsFolder);
static void EndOfDirectory(int handle);
private:
static vector<CPluginDirectory*> globalHandles;
Index: xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
===================================================================
--- xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp (revision 9957)
+++ xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp (working copy)
@@ -18,6 +18,7 @@
// include for constants
#include "pyutil.h"
#include "../../../PlayListPlayer.h"
+#include "listitem.h"
using namespace XFILE;
@@ -36,49 +37,49 @@
* start of xbmc methods
*****************************************************************/
PyDoc_STRVAR(setDirectoryEntry__doc__,
- "setDirectoryEntry(pointer,name,url,isDirectory [,iconpath]) -- Callback function to pass directory contents back to XBMC.\n"
+ "setDirectoryEntry(handle, url, listitem, [,isFolder]) -- Callback function to pass directory contents back to XBMC.\n"
"\n"
- "handle: longint, handle the virtualpythonfolder plugin was started with.\n"
- "name: name of the playlist entry\n"
- "url: url of the playlist entry. would be python:// for another virtual directory\n"
- "isDirectory: 0 if it is no directory, <>0 if it is.\n"
- "iconpath: (optional) path to the icon to be displayed in xbmc\n");
+ "handle : Integer - handle the plugin was started with.\n"
+ "url : string - url of the entry. would be plugin:// for another virtual directory\n"
+ "listitem : ListItem - item to add.\n"
+ "isFolder : [opt] bool - True=folder / False=not a folder(default).\n"
+ "\n"
+ "example:\n"
+ " - xbmc.setDirectoryEntry(handle, 'F:\\\\Trailers\\\\300.mov', listitem)\n");
PyObject* XBMC_setDirectoryEntry(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
- static char *keywords[] = {"handle", "name", "url", "isDirectory", "iconpath", NULL };
- string name;
- string url;
- string iconpath;
- PyObject *pName = NULL;
+ static char *keywords[] = {"handle", "url", "listitem", "isFolder", NULL };
+ int handle = -1;
PyObject *pURL = NULL;
- PyObject *pIconPath = NULL;
- int isDirectory=0;
- int handle;
+ PyObject *pItem = NULL;
+ bool bIsFolder = false;
// parse arguments
if (!PyArg_ParseTupleAndKeywords(
args,
kwds,
- "iOOi|O",
+ "iOO|b",
keywords,
&handle,
- &pName,
&pURL,
- &isDirectory,
- &pIconPath
+ &pItem,
+ &bIsFolder
))
{
return NULL;
};
- if (!PyGetUnicodeString(name, pName, 1)) return NULL;
- if (!PyGetUnicodeString(url, pURL, 1)) return NULL;
- if (pIconPath && !PyGetUnicodeString(iconpath, pIconPath, 1)) return NULL;
+ string url;
+ if (!PyGetUnicodeString(url, pURL, 1) || !ListItem_CheckExact(pItem)) return NULL;
+
+ ListItem *pListItem = NULL;
+ pListItem = (ListItem *)pItem;
+ Py_INCREF(pListItem);
// call the directory class to add our item
- DIRECTORY::CPluginDirectory::AddItem(handle, name, url, iconpath, isDirectory != 0);
+ DIRECTORY::CPluginDirectory::AddItem(handle, url, (CGUIListItem &)pListItem, bIsFolder);
- Py_INCREF(Py_None);
+ //Py_INCREF(Py_None);
return Py_None;
}