Update of /cvsroot/freevo/freevo/src/video
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1092
Modified Files:
database.py fxdhandler.py interface.py videoitem.py
Log Message:
switch to new mediainfo module
Index: interface.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/interface.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** interface.py 22 Jan 2005 13:24:47 -0000 1.10
--- interface.py 10 Apr 2005 17:58:11 -0000 1.11
***************
*** 82,86 ****
! def get(self, parent, files):
"""
return a list of items based on the files
--- 82,86 ----
! def get(self, parent, listing):
"""
return a list of items based on the files
***************
*** 88,94 ****
items = []
! all_files = util.find_matches(files, config.VIDEO_SUFFIX)
# sort all files to make sure 1 is before 2 for auto-join
! all_files.sort(lambda l, o: cmp(l.upper(), o.upper()))
hidden_files = []
--- 88,95 ----
items = []
! all_files = listing.match_suffix(config.VIDEO_SUFFIX)
# sort all files to make sure 1 is before 2 for auto-join
! all_files.sort(lambda l, o: cmp(l.basename.upper(),
! o.basename.upper()))
hidden_files = []
***************
*** 98,163 ****
hasattr(parent,'VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS') and
\
parent.VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS:
! util.videothumb.snapshot(file, update=False)
! if file in hidden_files:
! files.remove(file)
! continue
x = VideoItem(file, parent)
# join video files
! if config.VIDEO_AUTOJOIN and file.find('1') > 0:
! pos = 0
! for count in range(file.count('1')):
! # only count single digests
! if file[pos+file[pos:].find('1')-1] in string.digits or \
! file[pos+file[pos:].find('1')+1] in string.digits:
! pos += file[pos:].find('1') + 1
! continue
! add_file = []
! missing = 0
! for i in range(2, 6):
! current = file[:pos]+file[pos:].replace('1', str(i),
1)
! if current in all_files:
! add_file.append(current)
! end = i
! elif not missing:
! # one file missing, stop searching
! missing = i
! if add_file and missing > end:
! if len(add_file) > 3:
! # more than 4 files, I don't belive it
! break
! # create new name
! name = file[:pos] + \
! file[pos:].replace('1', '1-%s' % end, 1)
! x = VideoItem(name, parent)
! x.files = FileInformation()
! for f in [ file ] + add_file:
! x.files.append(f)
! x.subitems.append(VideoItem(f, x))
! hidden_files.append(f)
! break
! else:
! pos += file[pos:].find('1') + 1
! if parent.media:
! file_id = parent.media.id + \
! file[len(os.path.join(parent.media.mountdir,"")):]
! try:
! x.mplayer_options = database.discset[file_id]
! except KeyError:
! pass
items.append(x)
- files.remove(file)
-
- for i in copy.copy(files):
- if os.path.isdir(i+'/VIDEO_TS'):
- # DVD Image, trailing slash is important for Xine
- dvd = VideoItem('dvd://' + i[1:] + '/VIDEO_TS/', parent)
- items.append(dvd)
- files.remove(i)
return items
--- 99,159 ----
hasattr(parent,'VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS') and
\
parent.VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS:
! util.videothumb.snapshot(file.filename, update=False)
! # if file in hidden_files:
! # files.remove(file)
! # continue
x = VideoItem(file, parent)
# join video files
! # if config.VIDEO_AUTOJOIN and file.find('1') > 0:
! # pos = 0
! # for count in range(file.count('1')):
! # # only count single digests
! # if file[pos+file[pos:].find('1')-1] in string.digits or
\
! # file[pos+file[pos:].find('1')+1] in
string.digits:
! # pos += file[pos:].find('1') + 1
! # continue
! # add_file = []
! # missing = 0
! # for i in range(2, 6):
! # current = file[:pos]+file[pos:].replace('1',
str(i), 1)
! # if current in all_files:
! # add_file.append(current)
! # end = i
! # elif not missing:
! # # one file missing, stop searching
! # missing = i
! # if add_file and missing > end:
! # if len(add_file) > 3:
! # # more than 4 files, I don't belive it
! # break
! # # create new name
! # name = file[:pos] + \
! # file[pos:].replace('1', '1-%s' % end, 1)
! # x = VideoItem(name, parent)
! # x.files = FileInformation()
! # for f in [ file ] + add_file:
! # x.files.append(f)
! # x.subitems.append(VideoItem(f, x))
! # hidden_files.append(f)
! # break
! # else:
! # pos += file[pos:].find('1') + 1
! # if parent.media:
! # file_id = parent.media.id + \
! # file[len(os.path.join(parent.media.mountdir,"")):]
! # try:
! # x.mplayer_options = database.discset[file_id]
! # except KeyError:
! # pass
items.append(x)
+ for dvd in listing.match_type('DVD'):
+ # DVD Image
+ items.append(VideoItem(dvd, parent))
return items
Index: database.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/database.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** database.py 22 Jan 2005 13:24:47 -0000 1.5
--- database.py 10 Apr 2005 17:58:11 -0000 1.6
***************
*** 42,45 ****
--- 42,46 ----
import config
import util
+ from mediadb import Listing
import logging
***************
*** 93,112 ****
files += util.recursefolders(dir,1,'*.fxd',1)
! for subdir in ('disc', 'disc-set'):
! files += util.recursefolders(vfs.join(config.OVERLAY_DIR, subdir),
! 1, '*.fxd', 1)
! for info in fxditem.mimetype.parse(None, files, display_type='video'):
! if hasattr(info, '__fxd_rom_info__'):
! for i in info.__fxd_rom_id__:
! fxd['id'][i] = info
! for l in info.__fxd_rom_label__:
! fxd['label'].append((re.compile(l), info))
! for fo in info.__fxd_files_options__:
! discset[fo['file-id']] = fo['mplayer-options']
if config.VIDEO_SHOW_DATA_DIR:
! files = util.recursefolders(config.VIDEO_SHOW_DATA_DIR,1, '*.fxd',1)
! for info in fxditem.mimetype.parse(None, files, display_type='video'):
if info.type != 'video':
continue
--- 94,116 ----
files += util.recursefolders(dir,1,'*.fxd',1)
! # for subdir in ('disc', 'disc-set'):
! # files += util.recursefolders(vfs.join(config.OVERLAY_DIR, subdir),
! # 1, '*.fxd', 1)
! # for info in fxditem.mimetype.parse(None, files, display_type='video'):
! # if hasattr(info, '__fxd_rom_info__'):
! # for i in info.__fxd_rom_id__:
! # fxd['id'][i] = info
! # for l in info.__fxd_rom_label__:
! # fxd['label'].append((re.compile(l), info))
! # for fo in info.__fxd_files_options__:
! # discset[fo['file-id']] = fo['mplayer-options']
if config.VIDEO_SHOW_DATA_DIR:
! listing = Listing(config.VIDEO_SHOW_DATA_DIR)
! if listing.num_changes:
! listing.update()
! for info in fxditem.mimetype.parse(None,
listing.match_suffix(['fxd']), [],
! display_type='video'):
if info.type != 'video':
continue
Index: fxdhandler.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/fxdhandler.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** fxdhandler.py 30 Dec 2004 11:32:35 -0000 1.25
--- fxdhandler.py 10 Apr 2005 17:58:11 -0000 1.26
***************
*** 1,6 ****
# -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------
# fxdhandler - handler for <movie> and <disc-set> tags in a fxd file
! # -----------------------------------------------------------------------
# $Id$
#
--- 1,6 ----
# -*- coding: iso-8859-1 -*-
! #
-----------------------------------------------------------------------------
# fxdhandler - handler for <movie> and <disc-set> tags in a fxd file
! #
-----------------------------------------------------------------------------
# $Id$
#
***************
*** 20,27 ****
# </part>+
# </variant>+
! # </variants>
# <info/>
# </movie>
! #
# <?xml version="1.0" ?>
# <freevo>
--- 20,27 ----
# </part>+
# </variant>+
! # </variants>
# <info/>
# </movie>
! #
# <?xml version="1.0" ?>
# <freevo>
***************
*** 33,66 ****
# </freevo>
#
#
! # Notes:
! # Todo:
! #
! # -----------------------------------------------------------------------
! # $Log$
! # Revision 1.25 2004/12/30 11:32:35 dischi
! # add set_name for tv show handling, rename id to __id__
! #
! # Revision 1.24 2004/09/14 20:06:40 dischi
! # add doc
! #
! # Revision 1.23 2004/07/11 11:47:02 dischi
! # fix image file lookup
! #
! # Revision 1.22 2004/07/11 10:43:22 dischi
! # fix unicode error
! #
! # Revision 1.21 2004/07/10 12:33:43 dischi
! # header cleanup
! #
! # Revision 1.20 2004/05/13 12:50:21 dischi
! # fix duplicate removal for fxd files in vfs
! #
! # Revision 1.19 2004/03/02 20:56:59 dischi
! # fxd files are always right about the name
#
- # -----------------------------------------------------------------------
- # Freevo - A Home Theater PC framework
- # Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
--- 33,43 ----
# </freevo>
#
+ #
-----------------------------------------------------------------------------
+ # Freevo - A Home Theater PC framework
+ # Copyright (C) 2002-2004 Krister Lagerstrom, Dirk Meyer, et al.
#
! # First Edition: Unknown
! # Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
#
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
***************
*** 79,83 ****
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
! # ----------------------------------------------------------------------- */
__all__ = [ 'parse_movie', 'parse_disc_set' ]
--- 56,61 ----
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
! #
-----------------------------------------------------------------------------
!
__all__ = [ 'parse_movie', 'parse_disc_set' ]
***************
*** 85,88 ****
--- 63,67 ----
# python imports
import os
+ import logging
# freevo imports
***************
*** 90,159 ****
from item import FileInformation
! def parse_movie(fxd, node):
"""
! Callback for VideoItem <movie>
"""
! files = []
!
! def parse_video_child(fxd, node, dirname):
! """
! parse a subitem from <video>
! """
! filename = String(fxd.gettext(node))
! media_id = fxd.getattr(node, 'media-id')
! mode = node.name
! id = fxd.getattr(node, 'id')
! options = fxd.getattr(node, 'mplayer-options')
! player = fxd.childcontent(node, 'player')
! playlist = False
if fxd.get_children(node, 'playlist'):
! playlist = True
! if mode == 'file':
! if not media_id:
! filename = os.path.join(dirname, filename)
! if vfs.isoverlay(filename):
! filename = vfs.normalize(filename)
! if filename and not filename in files:
! files.append(filename)
! if mode == 'url':
! return id, filename, media_id, options, player, playlist
! return id, String('%s://%s' % (String(mode), String(filename))), \
! media_id, options, player, playlist
!
! item = VideoItem('', fxd.getattr(None, 'parent', None), parse=False)
- dirname = os.path.dirname(fxd.filename)
- image = ''
- title = fxd.getattr(node, 'title')
- item.image = fxd.childcontent(node, 'cover-img')
- item.set_name(title)
- if item.image:
- item.image = vfs.abspath(os.path.join(dirname, item.image))
- image = item.image
fxd.parse_info(node, item, {'runtime': 'length'})
video = fxd.get_children(node, 'video')
if video:
mplayer_options = fxd.getattr(video[0], 'mplayer_options')
! video = fxd.get_children(video[0], 'file') + \
! fxd.get_children(video[0], 'vcd') + \
! fxd.get_children(video[0], 'dvd') + \
! fxd.get_children(video[0], 'url')
variants = fxd.get_children(node, 'variants')
- if variants:
- variants = fxd.get_children(variants[0], 'variant')
if variants:
# a list of variants
id = {}
! for v in video:
! video_child = parse_video_child(fxd, v, dirname)
! id[video_child[0]] = video_child
for variant in variants:
--- 69,172 ----
from item import FileInformation
+ # get logging object
+ log = logging.getLogger('video')
! class VideoChild:
"""
! Objects of this class contain a parsed a subitem from <video>
"""
! def __init__(self, fxd, node, dirname, files):
! self.filename = String(fxd.gettext(node))
! self.media_id = fxd.getattr(node, 'media-id')
! self.mode = node.name
! self.id = fxd.getattr(node, 'id')
! self.options = fxd.getattr(node, 'mplayer-options')
! self.player = fxd.childcontent(node, 'player')
! self.is_playlist = False
if fxd.get_children(node, 'playlist'):
! self.is_playlist = True
! if self.mode == 'file':
! if not self.media_id:
! fullname = os.path.join(dirname, self.filename)
! if vfs.isoverlay(fullname):
! filename = vfs.normalize(fullname)
! if fullname and not fullname in files:
! files.append(fullname)
! if self.mode == 'url':
! self.url = self.filename
! else:
! self.url = '%s://%s' % (String(self.mode), String(fullname))
! def set_to_item(self, item):
! """
! Set some attributes from the video child to the given item. This
! functionw ill set media_id, mplayer_options, force_player and
! is_playlist.
! """
! item.media_id = self.media_id
! item.mplayer_options = self.options
! if self.player:
! item.force_player = self.player
! if self.is_playlist:
! item.is_playlist = True
!
!
! def get_url(self, listing):
! """
! Return the url as string or the ItemInfo from listing.
! """
! if not self.url.startswith('file://'):
! return self.url
! if os.path.isfile(self.url[7:]):
! if self.filename.find('/') == -1:
! return listing.get_by_name(self.filename)
! else:
! # FIXME:
! return self.url
! if os.path.isdir(self.url[7:]):
! # FIXME: dvd dir
! return self.url.replace('file://', 'dvd:/') + \
! '/VIDEO_TS/'
! # Oops, not found
! log.info('unknown file %s' % (String(self.url)))
! return ''
+ def parse_movie(fxd, node):
+ """
+ Callback for VideoItem <movie>
+ """
+ listing = fxd.getattr(None, 'listing', [])
+ dirname = os.path.dirname(fxd.filename)
+
+ # a list of all files covered by this <video> node
+ files = []
+
+ # create an item
+ item = VideoItem('', fxd.getattr(None, 'parent', None))
+ # add info from <info>
fxd.parse_info(node, item, {'runtime': 'length'})
+ video_list = []
video = fxd.get_children(node, 'video')
if video:
mplayer_options = fxd.getattr(video[0], 'mplayer_options')
! children = fxd.get_children(video[0], 'file') + \
! fxd.get_children(video[0], 'vcd') + \
! fxd.get_children(video[0], 'dvd') + \
! fxd.get_children(video[0], 'url')
! for child in children:
! video_list.append(VideoChild(fxd, child, dirname, files))
variants = fxd.get_children(node, 'variants')
if variants:
+ variants = fxd.get_children(variants[0], 'variant')
# a list of variants
id = {}
! for video in video_list:
! id[video.id] = video
for variant in variants:
***************
*** 163,175 ****
# a variant with one file
ref = fxd.getattr(parts[0] ,'ref')
! v = VideoItem(id[ref][1], parent=item, info=item.info,
parse=False)
! v.files = None
! v.media_id, v.mplayer_options, player, is_playlist =
id[ref][2:]
! if player:
! v.force_player = player
! if is_playlist:
! v.is_playlist = True
! audio = fxd.get_children(parts[0], 'audio')
if audio:
audio = { 'media_id': fxd.getattr(audio[0], 'media-id'),
--- 176,185 ----
# a variant with one file
ref = fxd.getattr(parts[0] ,'ref')
! video = id[ref]
! v = VideoItem(video.get_url(listing), parent=item)
! v.info.set_variables(item.info)
! video.set_to_item(v)
! audio = fxd.get_children(parts[0], 'audio')
if audio:
audio = { 'media_id': fxd.getattr(audio[0], 'media-id'),
***************
*** 183,190 ****
subtitle = fxd.get_children(parts[0], 'subtitle')
if subtitle:
! subtitle = { 'media_id': fxd.getattr(subtitle[0],
'media-id'),
'file' : fxd.gettext(subtitle[0]) }
if not subtitle['media_id']:
! subtitle['file'] = os.path.join(dirname,
subtitle['file'])
else:
subtitle = {}
--- 193,202 ----
subtitle = fxd.get_children(parts[0], 'subtitle')
if subtitle:
! subtitle = { 'media_id': fxd.getattr(subtitle[0],
! 'media-id'),
'file' : fxd.gettext(subtitle[0]) }
if not subtitle['media_id']:
! subtitle['file'] = os.path.join(dirname,
! subtitle['file'])
else:
subtitle = {}
***************
*** 196,224 ****
else:
# a variant with a list of files
! v = VideoItem('', parent=item, info=item.info, parse=False)
for p in parts:
ref = fxd.getattr(p ,'ref')
audio = fxd.get_children(p, 'audio')
subtitle = fxd.get_children(p, 'subtitle')
!
if audio:
! audio = { 'media_id': fxd.getattr(audio[0],
'media-id'),
! 'file' : fxd.gettext(audio[0]) }
if not audio['media_id']:
! audio['file'] = os.path.join(dirname,
audio['file'])
else:
audio = {}
!
if subtitle:
! subtitle = { 'media_id': fxd.getattr(subtitle[0],
'media-id'),
'file' : fxd.gettext(subtitle[0]) }
if not subtitle['media_id']:
! subtitle['file'] = os.path.join(dirname,
subtitle['file'])
else:
subtitle = {}
! sub = VideoItem(id[ref][1], parent=v, info=item.info,
parse=False)
sub.files = None
! sub.media_id, sub.mplayer_options, player, is_playlist =
id[ref][2:]
sub.subtitle_file = subtitle
sub.audio_file = audio
--- 208,245 ----
else:
# a variant with a list of files
! v = VideoItem('', parent=item)
! v.info.set_variables(item.info)
for p in parts:
ref = fxd.getattr(p ,'ref')
+ video = id[ref]
+
audio = fxd.get_children(p, 'audio')
subtitle = fxd.get_children(p, 'subtitle')
!
if audio:
! audio = audio[0]
! audio = { 'media_id': fxd.getattr(audio, 'media-id'),
! 'file' : fxd.gettext(audio) }
if not audio['media_id']:
! audio['file'] = os.path.join(dirname,
! audio['file'])
else:
audio = {}
!
if subtitle:
! subtitle = { 'media_id': fxd.getattr(subtitle[0],
! 'media-id'),
'file' : fxd.gettext(subtitle[0]) }
if not subtitle['media_id']:
! subtitle['file'] = os.path.join(dirname,
! subtitle['file'])
else:
subtitle = {}
! sub = VideoItem(video.get_url(listing), parent=v)
! sub.info.set_variables(item.info)
sub.files = None
! video.set_to_item(sub)
!
sub.subtitle_file = subtitle
sub.audio_file = audio
***************
*** 227,269 ****
sub.mplayer_options += mplayer_options
v.subitems.append(sub)
!
v.name = fxd.getattr(variant, 'name')
item.variants.append(v)
! elif len(video) == 1:
# only one file, this is directly for the item
! id, url, item.media_id, item.mplayer_options, player, is_playlist = \
! parse_video_child(fxd, video[0], dirname)
! if url.startswith('file://') and os.path.isfile(url[7:]):
! variables = item.info.get_variables()
! item.set_url(url, info=True)
! item.info.set_variables(variables)
! elif url.startswith('file://') and os.path.isdir(url[7:]):
! # dvd dir
! variables = item.info.get_variables()
! item.set_url(url.replace('file://', 'dvd:/')+ '/VIDEO_TS/',
info=True)
! item.info.set_variables(variables)
! else:
! item.set_url(url, info=False)
! if title:
! item.set_name(title)
! if player:
! item.force_player = player
! if is_playlist:
! item.is_playlist = True
# global <video> mplayer_options
if mplayer_options:
item.mplayer_options += mplayer_options
else:
# a list of files
! for s in video:
! video_child = parse_video_child(fxd, s, dirname)
! v = VideoItem(video_child[1], parent=item, info=item.info,
parse=False)
v.files = None
! v.media_id, v.mplayer_options, player, is_playlist =
video_child[2:]
! if video_child[-2]:
! v.force_player = video_child[-2]
! if video_child[-1]:
! item.is_playlist = True
# global <video> mplayer_options
if mplayer_options:
--- 248,275 ----
sub.mplayer_options += mplayer_options
v.subitems.append(sub)
!
v.name = fxd.getattr(variant, 'name')
item.variants.append(v)
! elif len(video_list) == 1:
# only one file, this is directly for the item
! video = video_list[0]
! video.set_to_item(item)
!
! variables = item.info.get_variables()
! item.set_url(video.get_url(listing))
! item.info.set_variables(variables)
!
# global <video> mplayer_options
if mplayer_options:
item.mplayer_options += mplayer_options
+
else:
# a list of files
! for video in video_list:
! v = VideoItem(video.get_url(listing), parent=item)
! v.info.set_variables(item.info)
v.files = None
! video.set_to_item(v)
# global <video> mplayer_options
if mplayer_options:
***************
*** 271,290 ****
item.subitems.append(v)
if not item.files:
item.files = FileInformation()
- item.files.files = files
item.files.fxd_file = fxd.filename
if image:
item.files.image = image
!
# remove them from the filelist (if given)
- duplicates = fxd.getattr(None, 'duplicate_check', [])
for f in files:
try:
! duplicates.remove(f)
except:
pass
!
if fxd.is_skin_fxd:
item.skin_fxd = fxd.filename
--- 277,303 ----
item.subitems.append(v)
+
+ title = fxd.getattr(node, 'title')
+ if title:
+ item.set_name(title)
+
if not item.files:
item.files = FileInformation()
+ item.files.files = files
item.files.fxd_file = fxd.filename
+
+ image = fxd.childcontent(node, 'cover-img')
if image:
+ item.image = vfs.abspath(os.path.join(dirname, image))
item.files.image = image
!
# remove them from the filelist (if given)
for f in files:
try:
! listing.remove(f)
except:
pass
!
if fxd.is_skin_fxd:
item.skin_fxd = fxd.filename
***************
*** 299,306 ****
Callback for VideoItem <disc-set>
"""
! item = VideoItem('', fxd.getattr(None, 'parent', None), parse=False)
dirname = os.path.dirname(fxd.filename)
!
item.name = fxd.getattr(node, 'title')
item.image = fxd.childcontent(node, 'cover-img')
--- 312,319 ----
Callback for VideoItem <disc-set>
"""
! item = VideoItem('', fxd.getattr(None, 'parent', None))
dirname = os.path.dirname(fxd.filename)
!
item.name = fxd.getattr(node, 'title')
item.image = fxd.childcontent(node, 'cover-img')
***************
*** 336,340 ****
if not file_media_id:
file_media_id = id
! mpl_opts = item.mplayer_options + ' ' + fxd.getattr(f,
'mplayer-options')
opt = { 'file-id' : file_media_id + fxd.gettext(f),
'mplayer-options': mpl_opts }
--- 349,354 ----
if not file_media_id:
file_media_id = id
! mpl_opts = item.mplayer_options + ' ' + \
! fxd.getattr(f, 'mplayer-options')
opt = { 'file-id' : file_media_id + fxd.gettext(f),
'mplayer-options': mpl_opts }
***************
*** 344,348 ****
# of files defined in the file-opt elements
item.mplayer_options = ''
!
if not item.files:
item.files = FileInformation()
--- 358,362 ----
# of files defined in the file-opt elements
item.mplayer_options = ''
!
if not item.files:
item.files = FileInformation()
Index: videoitem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/videoitem.py,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** videoitem.py 20 Jan 2005 16:37:36 -0000 1.160
--- videoitem.py 10 Apr 2005 17:58:11 -0000 1.161
***************
*** 52,56 ****
import plugin
import util.videothumb
! import util.mediainfo
from gui import PopupBox, AlertBox, ConfirmBox
--- 52,56 ----
import plugin
import util.videothumb
! import mediadb
from gui import PopupBox, AlertBox, ConfirmBox
***************
*** 66,73 ****
class VideoItem(MediaItem):
! def __init__(self, url, parent, info=None, parse=True):
! self.autovars = [ ('deinterlace', 0) ]
MediaItem.__init__(self, 'video', parent)
!
self.variants = [] # if this item has variants
self.subitems = [] # more than one file/track to play
--- 66,73 ----
class VideoItem(MediaItem):
! def __init__(self, url, parent):
! self.autovars = { 'deinterlace': 0 }
MediaItem.__init__(self, 'video', parent)
!
self.variants = [] # if this item has variants
self.subitems = [] # more than one file/track to play
***************
*** 90,98 ****
# set url and parse the name
! self.set_url(url, info=parse)
!
! if info:
! # set info variables
! self.info.set_variables(info)
# extra infos in database.discset
--- 90,94 ----
# set url and parse the name
! self.set_url(url)
# extra infos in database.discset
***************
*** 109,113 ****
filename is set.
"""
! self.name = name
show_name = None
self.tv_show = False
--- 105,112 ----
filename is set.
"""
! if name:
! self.name = name
! else:
! self.name = ''
show_name = None
self.tv_show = False
***************
*** 116,120 ****
self.sort_name = self.name[4:]
self.sort_name = self.name
!
if self.info['episode'] and self.info['subtitle']:
# get informations for recordings
--- 115,119 ----
self.sort_name = self.name[4:]
self.sort_name = self.name
!
if self.info['episode'] and self.info['subtitle']:
# get informations for recordings
***************
*** 132,136 ****
else:
show_name = None
!
if show_name:
# This matches a tv show with a show name, an epsiode and
--- 131,135 ----
else:
show_name = None
!
if show_name:
# This matches a tv show with a show name, an epsiode and
***************
*** 156,161 ****
self.tv_show_ep = show_name[3]
!
! def set_url(self, url, info=True):
"""
Sets a new url to the item. Always use this function and not set 'url'
--- 155,160 ----
self.tv_show_ep = show_name[3]
!
! def set_url(self, url):
"""
Sets a new url to the item. Always use this function and not set 'url'
***************
*** 163,178 ****
filename, mode and network_play
"""
! MediaItem.set_url(self, url, info)
! if url.startswith('dvd://') or url.startswith('vcd://'):
self.network_play = False
self.mimetype = self.url[:self.url.find('://')].lower()
! if self.url.find('/VIDEO_TS/') > 0:
! # dvd on harddisc
! self.filename = self.url[5:self.url.rfind('/VIDEO_TS/')]
! self.info = util.mediainfo.get(self.filename)
self.files = FileInformation()
- self.name = self.info['title:filename']
- if not self.name:
- self.name = util.getname(self.filename)
self.files.append(self.filename)
elif self.url.rfind('.iso') + 4 == self.url.rfind('/'):
--- 162,174 ----
filename, mode and network_play
"""
! MediaItem.set_url(self, url)
! if self.url.startswith('dvd://') or self.url.startswith('vcd://'):
self.network_play = False
self.mimetype = self.url[:self.url.find('://')].lower()
! if self.info.filename:
! # dvd on harddisc, add '/' for xine
! self.url = self.url + '/'
! self.filename = self.info.filename
self.files = FileInformation()
self.files.append(self.filename)
elif self.url.rfind('.iso') + 4 == self.url.rfind('/'):
***************
*** 183,198 ****
self.filename = ''
! elif url.endswith('.iso') and self.info['mime'] == 'video/dvd':
# dvd iso
self.mimetype = 'dvd'
self.mode = 'dvd'
self.url = 'dvd' + self.url[4:] + '/'
!
! if not self.image or (self.parent and self.image ==
self.parent.image):
! image = vfs.getoverlay(self.filename + '.raw')
! if os.path.exists(image):
! self.image = image
! self.files.image = image
!
if config.VIDEO_INTERLACING and self.info['interlaced'] \
and not self['deinterlace']:
--- 179,188 ----
self.filename = ''
! elif self.url.endswith('.iso') and self.info['mime'] == 'video/dvd':
# dvd iso
self.mimetype = 'dvd'
self.mode = 'dvd'
self.url = 'dvd' + self.url[4:] + '/'
!
if config.VIDEO_INTERLACING and self.info['interlaced'] \
and not self['deinterlace']:
***************
*** 202,206 ****
# start name parser by setting name to itself
self.set_name(self.name)
!
def __id__(self):
--- 192,196 ----
# start name parser by setting name to itself
self.set_name(self.name)
!
def __id__(self):
***************
*** 236,240 ****
elapsed = elapsed - self.info['start']
if elapsed / 3600:
! return '%d:%02d:%02d' % ( elapsed / 3600, (elapsed % 3600) /
60,
elapsed % 60)
else:
--- 226,231 ----
elapsed = elapsed - self.info['start']
if elapsed / 3600:
! return '%d:%02d:%02d' % ( elapsed / 3600,
! (elapsed % 3600) / 60,
elapsed % 60)
else:
***************
*** 335,339 ****
! def _get_possible_player(self):
"""
return a list of possible player for this item
--- 326,330 ----
! def __get_possible_player(self):
"""
return a list of possible player for this item
***************
*** 359,363 ****
return a list of possible actions on this item.
"""
! self.possible_player = self._get_possible_player()
if not self.possible_player:
--- 350,354 ----
return a list of possible actions on this item.
"""
! self.possible_player = self.__get_possible_player()
if not self.possible_player:
***************
*** 437,449 ****
i = copy.copy(self)
i.parent = self
! i.set_url(self.url + str(title+1), False)
! i.info = copy.copy(self.info)
# copy the attributes from mmpython about this track
! i.info.mmdata = self.info.mmdata['tracks'][title]
i.info.set_variables(self.info.get_variables())
! i.info_type = 'track'
i.possible_player = []
! i.files = None
! i.name = Unicode(_('Play Title %s')) % (title+1)
items.append(i)
--- 428,445 ----
i = copy.copy(self)
i.parent = self
! # get info
! i.info = self.info.get_subitem(title)
! # set url
! i.info.url = self.info.url
! i.set_url(i.info)
! i.url = i.url + '/' + str(title+1)
# copy the attributes from mmpython about this track
! i.info.mminfo = self.info.mminfo['tracks'][title]
i.info.set_variables(self.info.get_variables())
! # set attributes
! i.info_type = 'track'
i.possible_player = []
! i.files = None
! i.name = Unicode(_('Play Title %s')) % (title+1)
items.append(i)
***************
*** 565,569 ****
# rating if the player can play this item or not
if not self.possible_player:
! self.possible_player = self._get_possible_player()
if not self.possible_player:
--- 561,565 ----
# rating if the player can play this item or not
if not self.possible_player:
! self.possible_player = self.__get_possible_player()
if not self.possible_player:
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog