![]() |
|
|||||||
| Plugin/Script (Python) Development Developers forum for XBMC Python Plugins/Scripts. Scripters/coders only! Not for posting feature requests, bugs, or end-user support requests! |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Member
Join Date: Apr 2004
Posts: 47
![]() |
hello
i have a central shared folder on my network which contains all the current tv listings in xmltv format. (thanks to the great xmltv software which grabs it off the net) is there a way to read this file over the network within python, e.g: xmldata = self.readfile("smb://user assword@computer/tv/listings.xml")?? it doesn't seem to work, i get 'file not found'. (but i remember the author of the mythtv scripts saying that he had a workaround?) or could it be added into the current python implementation? any help appreciated! carlos ps: currently, i get it to auto-ftp the listings to the xbox, but this is a hassle. |
|
|
|
|
|
#2 |
|
Member
Join Date: Mar 2004
Location: England
Posts: 76
![]() |
i don't think there's a raw access to files over smb at the moment, you're probably best off using an ftp server on your pc and using python to download the file to your xbox, rather than uploading it to your xbox (if that's what you're doing)
python ftplib |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2004
Posts: 47
![]() |
yeah, thanks for this, i guess so, if the ftp library is implemented in XBMC. but surely there must be a way to access remote files within python?
any developers care to comment, or have news on an implementation? |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Apr 2004
Posts: 8
![]() |
python has socket support so it should be fairly easy to write a script that accesses an xbms server (the protocol is fairly simple). smb on the other hand, i believe is complex although i have never bothered to look at what is known about it.
while on this topic, this is another reason i believe xbms (or another simple protocol) is more important to xbmc than smb support (that and the fact i don't want to run samba just for the xbox). |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2004
Posts: 174
![]() |
if you grab the xbmc mythtv source from http://changeling.ixionstudios.com/xbmc/,
you'll find smb.py and nmb.py in the python/lib directory. that is the library i am using to copy files from a smb share to the xbox. you can poke around the code to see how to use it. in particular, i just added smb.copytolocal() to copy a file from a remote share to the xbox file system. it should work fine for ascii files but at the moment seems to be broken for binary files. |
|
|
|
|
|
#6 |
|
Member
Join Date: Mar 2004
Posts: 74
![]() |
i would definitely love to test your xmltv script carlos if you get it working, i had trouble displaying the results
|
|
|
|
|
|
#7 |
|
Member
Join Date: Apr 2004
Posts: 47
![]() |
thanks for that guys - i'll have a look at your smb.py; that would be brilliant if it works.
i'll post the xmltv script up here when it's done - it's nothing special, i haven't used proper xml parsing yet as i couldnt get enough sample code of expat, so it's all r.e. matching. but it works! |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Mar 2004
Posts: 174
![]() |
btw, you'll want to grab version 0.5. version 0.4 did not have the copytolocal() method.
edit: i have updated xbmc mythtv to version 0.6 that fixes binary file copies. you can call smb.copytolocal( remoteservice, remotepath, localpath ) to copy files from a smb share to the xbox filesystem. |
|
|
|
|
|
#9 | |||
|
Member
Join Date: Apr 2004
Posts: 47
![]() |
madtw that's fantastic! thank you!
not sure on the syntax to use this. do you have an example function call for copytolocal ? e.g. what if i want to copy smb://domain;user assword@server/share/file.xmldo i do: Quote:
Quote:
Quote:
|
|||
|
|
|
|
|
#10 | |
|
Senior Member
Join Date: Mar 2004
Posts: 174
![]() |
your best bet is to look in mytvshow.py to see how to call copytolocal(). the short answer is that you must instantiate a smb object first and do the login, then you can issue a copytolocal() method call. this is what it would look like with no error handling:
Quote:
btw, i found these nmb and smb modules on the web. since the copy() method assumed two remote smb shares, i added the copytolocal() method based on the code in the copy() method. i probably should've gotten rid of the rest of the parameters... but i wasn't sure what i was going to need until i got it working. once i got it working, i didn't go back to clean it up... |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| All files played from network, except for one | punkinguk | XBMC for Xbox Specific Support | 2 | 2006-04-18 04:51 |
| XBMC - files over network | retepetsir | XBMC for Xbox Specific Support | 1 | 2006-02-08 14:27 |
| Avi files won't play over network | twentworth22 | XBMC for Xbox Specific Support | 0 | 2005-05-01 18:00 |
| Xbmc can see wma files on the network but not dvd | LostIt | XBMC for Xbox Specific Support | 1 | 2005-02-04 19:51 |
| Python network problems | back | XBMC for Xbox Specific Support | 0 | 2005-01-02 00:55 |