Ok my littel progress-bar script do chrash xbmc
#1
Hello scripters of xbmc .-)

I have a strange problem with a python script for my dvd-ripper


The script that do crash the system is the following :

Code:
#!/usr/bin/python
#########################################################
# SCRIPT  : progress.py                                 #
#########################################################


####################### IMPORTS #######################

import xbmc, xbmcgui
import os, sys, thread, stat, time, string, re

#######################################################



####################### GLOABL ########################


__scriptname__ = "progress"
__author__ = "Hans Weber"
__version__ = "0.5H"
__date__ = '08-10-2009'

print '-' * 60
xbmc.output(__scriptname__ + " Version: " + __version__ + " Date: " + __date__ + '\n')
print '-' * 60
language = xbmc.getLanguage()
print 'xbmc language selected : ' + language


xbmc.Language.__init__(os.getcwd(), xbmc.getLanguage())
print 'path to strings.xml : ' + os.getcwd() +  '/resources/language/' +  xbmc.getLanguage()
print 'path to settings : ' + os.getcwd() +  '/config/settings'
print 'path to ssh-scripts : ' + os.getcwd() +  '/ssh/'


BASE_RESOURCE_PATH = os.path.join( os.getcwd().replace( ";", "" ), "resources" )
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )

# subclassing getLocalizedString

__language__ = xbmc.Language(os.getcwd()).getLocalizedString


#######################################################



#######################################################
# Function : MainClass                                #
#######################################################
# Parameter                                           #
# xbmcgui.Window  Window                              #
#                                                     #
# Returns      none 0                                 #
#######################################################
class MainClass(xbmcgui.Window):
      def __init__(self):
          success()                      
#######################################################


#######################################################
# Function : success                                  #
#######################################################
# Parameter    none                                   #
# Returns      0                                      #
#######################################################
def success():
    dialog = xbmcgui.Dialog()
    title = __language__(32040)
    selected = dialog.ok(title,'')
    return 0
#######################################################



#######################################################
# Function : pid_exists                               #
#######################################################
# Parameter                                           #
# pid          pid of dd process                      #
# Returns                                             #
# False        pid is not exist                       #
# True         pid exists                             #
#######################################################
def pid_exists(pid):
        try:
            os.kill(pid, 0)
            return(1)
        except OSError, err:
            return(0)
#######################################################



#######################################################
####################### MAIN ##########################
#######################################################
if __name__ == '__main__':

   # Check Release of xbmc

   xbmc_version = xbmc.getInfoLabel("System.BuildVersion")
   print xbmc_version

   # Decide on witch Operating-System we are executed

   system = os.uname()

   if system[0] == 'Linux':
       os_linux = True
   else:  
       print 'this sripts needs a linux system as host operating-system .....\n'
       print 'Try the blue-pill version of this script ....\n'
       print 'http://code.google.com/p/luemmels-dvd-ripper/downloads/list \n'  
       wrong_os()

   if (os_linux):  

       pid_path =  os.getenv("HOME") + '/RIPPING_STARTET'
       f = open(pid_path,'r')
       pid_dd = int(f.readline())
       f.close                        

       iso_path =  os.getenv("HOME") + '/RIPPING_FILE'
       f = open(iso_path,'r')
       iso = f.readline()
       f.close

       iso_path =  os.getenv("HOME") + '/RIPPING_PREVIEW'
       f = open(iso_path,'r')
       preview = f.readline()
       f.close
                      
       iso_path =  os.getenv("HOME") + '/RIPPING_SIZE'
       f = open(iso_path,'r')
       size_of_rip = int(f.readline())
       f.close

       exit = True
       while (exit):
               if (pid_exists(pid_dd)):
                   print 'dd is running '  
               else:
                   exit = False
               time.sleep(2)

       # Now the process is not running anymore
        
       state = os.path.exists(pid_path)
       if (state == False):
           mydisplay = MainClass()
           del mydisplay

#######################################################


After a ripp-process is statted I do start this script inside default.py
like follows:

Code:
# shows display dialog that ripping was sucessfull startet

        success()

        progress_script = os.getcwd() + "/progress.py"
        print 'script for progress : ' + progress_script
        xbmc.executescript(progress_script)


After this action my default.py will be closed and the progress.py
do run in the background.

As long the dd process is running .... all works like expected ....
The dialog-box that the dd process was successfull will also be shown.

On the moment I press Ok the hole xbmc is crashing...


Here comes the xbmc.log
Code:
01:42:15 T:2744617872 M:1741283328    INFO: Loading skin file: DialogOK.xml
01:42:15 T:2744617872 M:1741578240   DEBUG: Load DialogOK.xml: 72.74ms
01:42:15 T:3049015184 M:1741619200   DEBUG: ------------------- GUI_MSG_WINDOW_INIT
01:42:15 T:3049015184 M:1741619200   DEBUG: Dialog OK
01:42:15 T:3049015184 M:1741619200   DEBUG: -------------------
01:42:15 T:3049015184 M:1741488128   DEBUG: Load button-focus2.png: 23.0ms (bundled)
01:42:15 T:3049015184 M:1741488128   DEBUG: Alloc resources: 23.92ms (0.06 ms skin load, 0.46 ms preload)
01:42:15 T:3049015184 M:1740513280   DEBUG: Load DialogBack.png: 18.1ms (bundled)
01:42:15 T:3049015184 M:1739468800   DEBUG: Load DialogFront.png: 8.8ms (bundled)
01:42:15 T:3049015184 M:1739468800   DEBUG: Load separator.png: 0.2ms (bundled)
01:43:01 T:3049015184 M:1722200064   DEBUG: Load button-focus2.png: 0.2ms (bundled)
01:43:01 T:3049015184 M:1722359808   DEBUG: Load button-focus2.png: 0.2ms (bundled)
01:43:02 T:3049015184 M:1722454016   DEBUG: ------------------- GUI_MSG_WINDOW_DEINIT
01:43:02 T:3049015184 M:1722454016   DEBUG: Dialog OK
01:43:02 T:3049015184 M:1722454016   DEBUG: -------------------
01:43:02 T:2744617872 M:1724739584    INFO: Scriptresult: Succes

After this crash ....


Ok has anybody a hint to resolve the problem ....

May a own thread witch runs inside default.py after I close the script ?

Best regards
Hans
Reply
#2
Ok it works now but not as own progress.py

Regards
Hans
Reply
#3
Think this might be a little bit related to your problems..

http://trac.xbmc.org/ticket/6430
Reply

Logout Mark Read Team Forum Stats Members Help
Ok my littel progress-bar script do chrash xbmc0