Playing a file from a network share
#1
Question 
I'm having a problem playing a video from a file on a SMB share.

I'm running XBMC on Ubuntu Jaunty, and reading a list of files from a MySQL database.

I create a list of buttons with the name of each file. When a button is clicked, tthe dialog is shown, and when OK is clicked, XBMC hangs and has to be killed with a kill -9.

Heres the script that I'm working with:
Code:
import xbmc, xbmcgui
import MySQLdb
import re

conn = MySQLdb.connect (host = '192.168.0.200',
            user = 'root',
            passwd = '',
            db = 'mynewmovies')

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10

class MyClass(xbmcgui.Window):
  def __init__(self):
    self.strActionInfo = xbmcgui.ControlLabel(250, 80, 200, 200, '', 'font14', '0xFFBBBBFF')
    self.addControl(self.strActionInfo)
    self.strActionInfo.setLabel('Push BACK to quit')
    self.list = xbmcgui.ControlList(200, 150, 600, 600)
    self.addControl(self.list)
    cursor = conn.cursor(MySQLdb.cursors.DictCursor)
    cursor.execute("select title, url from movie inner join moviexlinks on movie.id = moviexlinks.movieid where linktype = 'movie' order by if(titlesort = '', title, titlesort)")
    results = cursor.fetchall()
    
    for row in results:
    self.list.addItem(row["url"])

    self.setFocus(self.list)

  def onAction(self, action):
    if action == ACTION_PREVIOUS_MENU:
      self.close()
  
  def onControl(self, control):
    if control == self.list:
      item = self.list.getSelectedItem()
      r = re.compile('\\\\')
      file = "smb:" + r.sub('/', item.getLabel())
      self.message('You selected : ' + file)
      xbmc.Player().play(file)

  def message(self, message):
    dialog = xbmcgui.Dialog()
    dialog.ok(" My message title", message)

mydisplay = MyClass()
mydisplay.doModal()
del mydisplay

Here's xbmc.log
Code:
19:01:42 T:2764523856 M:1518145536   DEBUG: Load DialogOK.xml: 34.98ms
19:01:42 T:3174295616 M:1518145536   DEBUG: ------------------- GUI_MSG_WINDOW_INIT
19:01:42 T:3174295616 M:1518145536   DEBUG: Dialog OK
19:01:42 T:3174295616 M:1518145536   DEBUG: -------------------
19:01:42 T:3174295616 M:1518145536   DEBUG: Load button-focus2.png: 0.3ms (bundled)
19:01:42 T:3174295616 M:1518145536   DEBUG: Load button-nofocus.png: 0.2ms (bundled)
19:01:42 T:3174295616 M:1518145536   DEBUG: Alloc resources: 1.26ms (0.03 ms skin load, 0.21 ms preload)
19:01:42 T:3174295616 M:1518145536   DEBUG: Load DialogBack.png: 13.7ms (bundled)
19:01:42 T:3174295616 M:1517154304   DEBUG: Load DialogFront.png: 28.8ms (bundled)
19:01:42 T:3174295616 M:1516118016   DEBUG: Load separator.png: 0.2ms (bundled)
19:01:44 T:3174295616 M:1515757568   DEBUG: SDLKeyboard: scancode: 36, sym: 13, unicode: 13, modifier: 0
19:01:44 T:3174295616 M:1515757568   DEBUG: OnKey: 61453 pressed, action is 7
19:01:45 T:3174295616 M:1516085248   DEBUG: ------------------- GUI_MSG_WINDOW_DEINIT
19:01:45 T:3174295616 M:1516085248   DEBUG: Dialog OK
19:01:45 T:3174295616 M:1516085248   DEBUG: -------------------
19:01:45 T:3174295616 M:1515978752   DEBUG: new file set audiostream:0
19:01:46 T:3174295616 M:1516019712   DEBUG: CPlayerCoreFactory::GetPlayers(smb://tardis/video/Doctor Who/01 William Hartnell/Series 01/001 An Unearthly Child/00 - Pilot Episode - An Unearthly Child .avi)
19:01:46 T:3174295616 M:1516019712  NOTICE: DVDPlayer: Opening: smb://tardis/video/Doctor Who/01 William Hartnell/Series 01/001 An Unearthly Child/00 - Pilot Episode - An Unearthly Child .avi
19:01:46 T:2663094608 M:1515974656   DEBUG: Running thread 2663094608
19:01:46 T:2663094608 M:1515974656   DEBUG: thread start, auto delete: 1
19:01:46 T:3174295616 M:1515974656 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
19:01:46 T:2654701904 M:1515839488   DEBUG: Running thread 2654701904
19:01:46 T:2654701904 M:1515839488   DEBUG: thread start, auto delete: 0
19:01:46 T:2654701904 M:1515839488  NOTICE: Creating InputStream
19:01:46 T:2654701904 M:1515839488   DEBUG: OpenDir - Using authentication url smb://tardis/video
19:01:49 T:2663094608 M:1515708416    INFO: Loading skin file: DialogProgress.xml
19:01:49 T:2663094608 M:1515708416   DEBUG: Load DialogProgress.xml: 17.57ms
19:01:49 T:2663094608 M:1515708416   DEBUG: DialogProgress::StartModal called
19:01:49 T:2663094608 M:1515708416   DEBUG:
19:01:49 T:2663094608 M:1515708416   DEBUG: ------------------- GUI_MSG_WINDOW_INIT
19:01:49 T:2663094608 M:1515708416   DEBUG: Progress dialog
19:01:49 T:2663094608 M:1515708416   DEBUG: -------------------
19:01:49 T:2663094608 M:1515708416   DEBUG: Load button-focus2.png: 0.2ms (bundled)
19:01:49 T:2663094608 M:1515708416   DEBUG: Load button-nofocus.png: 0.1ms (bundled)
19:01:49 T:2663094608 M:1515708416   DEBUG: Alloc resources: 0.94ms (0.03 ms skin load, 0.14 ms preload)

I figure that it's probably something simple, but I'm new to this.

Thanks!
Brian
Reply
#2
I figured out what the problem was.

The path stored in the database was in windows format: \\server\share\path_to_file

The script changed the path to: smb"//server/share/path_to_file

The problem turned out to be authentication. I need to look into this some more because the share is open for read access to all users.

The fix was to change the path to: smb://user:password@server/share/path_to_file

Anyone have an idea as to why authentication is required?

Brian
Reply
#3
I don't know exactly, had some similar issues with my subtitle plugins, it may be that the authentication is not be shared between XBMC itself and the Python engine?!
Reply

Logout Mark Read Team Forum Stats Members Help
Playing a file from a network share0