Strange Probleme with 9.11 on Ubuntu 10.4 and DVD State
#1
Hello to all ;-)

I found a strange problem with the following sample code.

Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

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

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

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

#######################################################
####################### MAIN ##########################
#######################################################
if __name__ == '__main__':
     dvd_info = xbmc.getDVDState()
     print "DVD-State value : " + str(dvd_info)    

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



This sample code allways return the value 3 even if no

* tray is open
* disk is inserted and the tray is closed

On my old notebook the code was working ....

with my new notebook with Ubuntu 10.4 and xbmc 9.11 the function
xbmc.getDVDState() allways return value 3

Here comes the pastebin from the log ....

http://pastebin.ch/5797

I need this function inside my script to check the state ...
Any help out there ?

Inside my new notebook I have a blueray drive.... could this make the trouble ?

Regards
Hans
Reply
#2
OK I found a solution for the xbmc pyhton function witch do not work correct on my notebook.

Code:
!/bin/bash
###########################################################
# scriptname : state.sh                                   #
###########################################################
#                                                         #
# RELEASE 0.6C luemmels-dvd-ripper                        #
#                                                         #
# This script is part of luemmels-dvd-ripper script for   #
# xbmc and is licenced under the gpl-licence              #
#                                                         #
# http://code.google.com/p/luemmels-dvd-ripper            #
#                                                         #
###########################################################
#                                                         #
# author     : hans weber                                 #
#                                                         #
# parameters :                                            #
#                                                         #
# $1 device                                               #
#                                                         #
# description :                                           #
# returns the state of the dvd or blueray-drive           #
# 0              Media inserted                           #
# 251            no media                                 #
###########################################################


OUTPUT=$(dvd+rw-mediainfo $1 >~/dvdripper/state)
RETVAL=$?

if [ $RETVAL -eq 0 ] ; then

   # Ok we have a dvd inserted into the drive specified by paramater $1

   cat ~/dvdripper/state | head -3 | tail -1 | awk '{print $4}' > ~/dvdripper/media
   echo errord-code was zero
   exit 0
fi

if [ $RETVAL -eq 251 ] ; then

   # There is no dvd insertet or it could be a blueray .....

   echo 'NONE'  > ~/dvdripper/media
   exit 251
fi

This Shell script can test if a dvd inserted ... but it fails with error 251 if no dvd is inserted or the medium inserted is a bluray ....

Is there a command to check for a inserted blue-ray ?

Regards Hans
Reply
#3
Ok found the solution to check if dvd or a blueray is inserted into to drive

Code:
#!/bin/bash
###########################################################
# scriptname : state.sh                                   #
###########################################################
#                                                         #
# RELEASE 0.6C luemmels-dvd-ripper                        #
#                                                         #
# This script is part of luemmels-dvd-ripper script for   #
# xbmc and is licenced under the gpl-licence              #
#                                                         #
# http://code.google.com/p/luemmels-dvd-ripper            #
#                                                         #
###########################################################
#                                                         #
# author     : hans weber                                 #
#                                                         #
# parameters :                                            #
#                                                         #
# $1 device                                               #
#                                                         #
# description :                                           #
# returns the state of the dvd or blueray-drive           #
# 0              Media inserted                           #
# 1              Media not reconized                      #
# 251            open tray                                #
###########################################################

# Define the counting commands we expect inside the script

EXPECTED_ARGS=1

# Error-codes

E_BADARGS=1
E_TOOLNOTF=2
SCRIPTDIR="$HOME/.xbmc/scripts/My Scripts/dvd-red/ssh"

OUTPUT_ERROR=~/dvdripper/dvdslave-error.log

if [ $# -lt $EXPECTED_ARGS ]; then
  echo "Usage: state.sh p1 "
  echo "                                      "
  echo "[p1] device"
  echo "                                      "
  echo "state.sh was called with wrong arguments"
  exit $E_BADARGS
fi



OUTPUT=$(dvd+rw-mediainfo $1 >~/dvdripper/state 2>/dev/null)
RETVAL1=$?
if [ $RETVAL1 -eq 0 ] ; then

   # In booth cases (dvd or blureay) the return valaue is zero

   lsdvd -a $1 > /dev/null 2>&1
   RETVAL2=$?

   if [ $RETVAL2 -eq 0 ] ; then

       # Ok we have a dvd inserted into the drive specified by paramater $1

       cat ~/dvdripper/state | head -3 | tail -1 | awk '{print $4}' > ~/dvdripper/media
       echo DVD FOUND INSIDE $1

       # If the filesystem of the inserted dvd is incorrect we should not copy the dvd with dd

       exit 0
   fi

   makemkvcon info -r disc:0 | head -2 > /dev/null 2>&1
   RETVAL3=$?

   if [ $RETVAL3 -eq 0 ] ; then
      echo BLUERAY FOUND INSIDE $1
      echo 'BLUERAY'  > ~/dvdripper/media
      exit 0
   fi

   # The ripper script do only support dvd and blueray .....

   exit 1
fi


if [ $RETVAL1 -eq 251 ] ; then
   echo 'NONE'  > ~/dvdripper/media
   echo NO MEDIUM INSIDE $1
   exit 251
fi
Reply

Logout Mark Read Team Forum Stats Members Help
Strange Probleme with 9.11 on Ubuntu 10.4 and DVD State0