Update of /cvsroot/freevo/kaa/metadata/src/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14035/src/misc
Added Files:
.cvsignore __init__.py dirinfo.py xmlinfo.py
Log Message:
move current mmpython cvs to kaa.metadata
--- NEW FILE: .cvsignore ---
*.pyc *.pyo
--- NEW FILE: xmlinfo.py ---
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# xmlinfo.py - detect xml and fxd files
# -----------------------------------------------------------------------------
# $Id: xmlinfo.py,v 1.1 2005/07/02 16:33:12 dischi Exp $
#
# -----------------------------------------------------------------------------
# kaa-Metadata - Media Metadata for Python
# Copyright (C) 2003-2005 Thomas Schueppel, Dirk Meyer
#
# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
#
# Please see the file doc/CREDITS for a complete list of authors.
#
# 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
#
# -----------------------------------------------------------------------------
# python imports
import os
import logging
# kaa imports
from kaa.metadata import factory
from kaa.metadata import mediainfo
# get logging object
log = logging.getLogger('metadata')
XML_TAG_INFO = {
'image': 'Bins Image Description',
'freevo': 'Freevo XML Definition'
}
class XMLInfo(mediainfo.MediaInfo):
def __init__(self,file):
if not os.path.splitext(file.name)[1].lower() in ('.xml', '.fxd'):
raise mediainfo.KaaMetadataParseError()
mediainfo.MediaInfo.__init__(self)
self.mime = 'text/xml'
self.type = ''
try:
parser = qp_xml.Parser()
tree = parser.parse(file)
except:
raise mediainfo.KaaMetadataParseError()
if tree.name in XML_TAG_INFO:
self.type = XML_TAG_INFO[tree.name]
else:
self.type = 'XML file'
try:
# XML support
from xml.utils import qp_xml
factory.register( 'text/xml', ('xml', 'fxd'), mediainfo.TYPE_MISC,
XMLInfo )
except:
log.warning('Python XML not found')
--- NEW FILE: __init__.py ---
--- NEW FILE: dirinfo.py ---
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# dvdinfo.py - parse dvd title structure
# -----------------------------------------------------------------------------
# $Id: dirinfo.py,v 1.1 2005/07/02 16:33:12 dischi Exp $
#
# TODO: update the ifomodule and remove the lsdvd parser
#
# -----------------------------------------------------------------------------
# kaa-Metadata - Media Metadata for Python
# Copyright (C) 2003-2005 Thomas Schueppel, Dirk Meyer
#
# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
#
# Please see the file doc/CREDITS for a complete list of authors.
#
# 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
#
# -----------------------------------------------------------------------------
# python imports
import os
import logging
# kaa imports
from kaa.metadata import mediainfo
from kaa.metadata import factory
# get logging object
log = logging.getLogger('metadata')
class DirInfo(mediainfo.MediaInfo):
"""
Simple parser for reading a .directory file.
"""
def __init__(self, directory):
mediainfo.MediaInfo.__init__(self)
self.media = 'directory'
# search .directory
info = os.path.join(directory, '.directory')
if os.path.isfile(info):
f = open(info)
for l in f.readlines():
if l.startswith('Icon='):
self.image = l[5:]
if self.image.startswith('./'):
self.image = self.image[2:]
self.keys.append('image')
f.close()
factory.register('directory', mediainfo.EXTENSION_DIRECTORY,
mediainfo.TYPE_MISC, DirInfo)
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog