XBMC Community Forum  

Go Back   XBMC Community Forum > Help and Support > Plugin/Script (Python) Help and Support

Plugin/Script (Python) Help and Support Python requests/suggestions, support, bugs, and everything python goes in here!
Please, add platform prefix to threads that are not platform-independent!:
Thread prefixes; "[LINUX]", "[LIVE]", "[MAC]", "[WINDOWS]", and "[XBOX]"

Reply
 
Thread Tools Search this Thread Display Modes
Old 2008-05-01, 02:26   #1
netmgr
Member
 
Join Date: Apr 2008
Posts: 34
netmgr is on a distinguished road
Default get selected libary item filename

Can i get the currently select library item (say from my movies) via a script?

i want to alter the keymap.xml file so that on a certain keypress whilst viewing my library it runs a script (ive done this part) the script should then be able to tell me which library item is selected, ie its filename
netmgr is offline   Reply With Quote
Old 2008-05-01, 02:53   #2
Nuka1195
Team Arcade
 
Join Date: Dec 2004
Posts: 3,591
Nuka1195 is on a distinguished road
Default

xbmc.getInfoLabel()

Link to pydocs and manual in my signature
__________________
For python coding questions first see http://xbmc.sourceforge.net/python-docs/
Nuka1195 is offline   Reply With Quote
Old 2008-05-01, 03:06   #3
netmgr
Member
 
Join Date: Apr 2008
Posts: 34
netmgr is on a distinguished road
Default

Quote:
Originally Posted by Nuka1195 View Post
xbmc.getInfoLabel()

Link to pydocs and manual in my signature
Ah ha, I was using InfoTagVideo() obviously on the wrong track, cheers
netmgr is offline   Reply With Quote
Old 2008-05-01, 03:21   #4
Nuka1195
Team Arcade
 
Join Date: Dec 2004
Posts: 3,591
Nuka1195 is on a distinguished road
Default

that label is for what is currently playing.
__________________
For python coding questions first see http://xbmc.sourceforge.net/python-docs/
Nuka1195 is offline   Reply With Quote
Old 2008-05-02, 00:28   #5
netmgr
Member
 
Join Date: Apr 2008
Posts: 34
netmgr is on a distinguished road
Default

no joy with this, im using:

label1 = xbmc.getInfoLabel("listitem.filename")

the label returned is blank.

I can use other labels like listitem.title, which works fine

Is there a problem with asking the filename in a library view?


Quote:
Originally Posted by Nuka1195 View Post
xbmc.getInfoLabel()

Link to pydocs and manual in my signature
netmgr is offline   Reply With Quote
Old 2008-05-02, 01:01   #6
Nuka1195
Team Arcade
 
Join Date: Dec 2004
Posts: 3,591
Nuka1195 is on a distinguished road
Default

looks like listitem.filename returns filename without the full path.

Sounds like you may want the full path? IS this correct?
__________________
For python coding questions first see http://xbmc.sourceforge.net/python-docs/
Nuka1195 is offline   Reply With Quote
Old 2008-05-02, 01:05   #7
netmgr
Member
 
Join Date: Apr 2008
Posts: 34
netmgr is on a distinguished road
Default

i do want the full path yep, however the request returns nothing at all, full or partial.

What should i be doing to get the full path?
netmgr is offline   Reply With Quote
Old 2008-05-02, 01:08   #8
Nuka1195
Team Arcade
 
Join Date: Dec 2004
Posts: 3,591
Nuka1195 is on a distinguished road
Default

nothing, i'm testing something right now, just wondered if thats what you needed.
__________________
For python coding questions first see http://xbmc.sourceforge.net/python-docs/
Nuka1195 is offline   Reply With Quote
Old 2008-05-02, 01:54   #9
Nuka1195
Team Arcade
 
Join Date: Dec 2004
Posts: 3,591
Nuka1195 is on a distinguished road
Default

ok, when i run from library, it returns the idMovie column of the database. Are you sure your getting nothing?

One way to return this strictly from python, would be to use an sql statement and httpapi to get the resulting path and filename. But I'm testing a new infolabel, with a correction for library. If this works then it will need to be approved before commiting and you'll need to compile your own or wait for the next t3ch.

If you want to just use the httpapi.

PHP Code:
import xbmc
from urllib import quote_plus
new_sql 
"SELECT path.strPath, files.strFileName FROM movie JOIN files ON files.idFile=movie.idFile JOIN path ON files.idPath=path.idPath WHERE movie.idMovie=%s;" % ( xbmc.getInfoLabel"ListItem.filename" ), )
records xbmc.executehttpapi"QueryVideoDatabase(%s)" % ( quote_plusnew_sql ), ) )
print 
records.replace"<field>""" ).replace"</field>""" 
__________________
For python coding questions first see http://xbmc.sourceforge.net/python-docs/

Last edited by Nuka1195; 2008-05-02 at 01:56.
Nuka1195 is offline   Reply With Quote
Old 2008-05-02, 02:21   #10
netmgr
Member
 
Join Date: Apr 2008
Posts: 34
netmgr is on a distinguished road
Default

yes im getting nothing

When i run your alternate sql script im getting a sql error and when i look into it it seems that 'movie.idmovie=' and then it just stops so its not getting anything from xbmc.getInfoLabel( "ListItem.filename" )

thoughts?

Quote:
Originally Posted by Nuka1195 View Post
ok, when i run from library, it returns the idMovie column of the database. Are you sure your getting nothing?
netmgr is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:22.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2008, XBMC Project