Dirk Meyer wrote:
> So what to do now? If we remove the libdvdread from the runtime,
> Freevo can't play dvds anymore (bad), right now it crashes (even
> worse). The only solution is to use the css lib matching the
> dvdread. But including decss will be a legal problem.

OK, bad hack, but try to replace your dvdinfo.py with the attached
file. 

It uses mplayer to parse the num of titles on the dvd. This is a bad
hack (TM) but at least we get the number of titles of the dvd. But we
don't get the number of audio tracks/subtitles/chapters/length of each
track. This is a freevo only solution, Thomas will kill me (the
distance between us is not so big) if I put that into mmpython. 

Please try it.


Dischi

#if 0 /*
# -----------------------------------------------------------------------
# dvdinfo.py - parse dvd title structure
# -----------------------------------------------------------------------
# $Id: dvdinfo.py,v 1.10 2003/06/30 13:17:19 the_krow Exp $
#
# -----------------------------------------------------------------------
# Copyright (C) 2003 Thomas Schueppel, Dirk Meyer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ----------------------------------------------------------------------- */
#endif

import ifoparser
from mmpython import mediainfo
import mmpython
from discinfo import DiscInfo
import popen2

# XXX this is really bad, but we are in a freevo
# XXX env and it should work
import config

class DVDTitle(mediainfo.AVInfo):
    def __init__(self, number):
        mediainfo.AVInfo.__init__(self)
        self.number = number
        self.chapters = self.angles = self.length = audio_num = subtitles_num = 0
        self.mime = 'video/mpeg'

            
class DVDInfo(DiscInfo):
    def __init__(self,device):
        DiscInfo.__init__(self)
        self.context = 'video'
        self.offset = 0
        self.valid = self.isDisc(device)
        self.mime = 'video/dvd'
        self.type = 'DVD'
        self.subtype = 'video'

    def isDisc(self, device):
        if DiscInfo.isDisc(self, device) != 2:
            return 0

        # brute force reading of the device to find out if it is a DVD
        f = open(device,'rb')
        f.seek(32808, 0)
        buffer = f.read(50000)

        if buffer.find('UDF') == -1:
            f.close()
            return 0

        # seems to be a DVD, read a little bit more
        buffer += f.read(550000)
        f.close()

        if buffer.find('VIDEO_TS') == -1 and buffer.find('VIDEO_TS.IFO') == -1 and \
               buffer.find('OSTA UDF Compliant') == -1:
            return 0

        child = popen2.Popen3('%s dvd://1000 -dvd-device %s' % \
                              (config.CONF.mplayer, device), 1, 100)
        title_num = 0
        while (1):
            data = child.fromchild.readline()
            if not data:
                break
            if data.startswith('There are '):
                title_num =  int(data[10:data[10:].find(' ')+10])
            
        child.wait()

        if not title_num:
            return 0

        for title in range(1, title_num+1):
            ti = DVDTitle(title)
            ti.trackno = title
            ti.trackof = title_num
            self.appendtrack(ti)

        return 1



mmpython.registertype( 'video/dvd', mediainfo.EXTENSION_DEVICE, mediainfo.TYPE_AV, 
DVDInfo )
-- 
Universe.SYS corrupted. Reboot? [Y/N]

Reply via email to