Update of /cvsroot/freevo/freevo/WIP/Dischi
In directory sc8-pr-cvs1:/tmp/cvs-serv4367
Added Files:
audiodiskitem.py configure.py rom_drives.py use_mmpython.sh
Log Message:
basic mmpython support
--- NEW FILE: audiodiskitem.py ---
#if 0 /*
# -----------------------------------------------------------------------
# audiodiskitem.py - Item for CD Audio Disks
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2003 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/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
#
# ----------------------------------------------------------------------- */
#endif
import config
import menu
from item import Item
from audioitem import AudioItem
from playlist import Playlist, RandomPlaylist
class AudioDiskItem(Playlist):
"""
class for handling audio disks
"""
def __init__(self, disc_id, parent, devicename = None, display_type = None):
Item.__init__(self, parent)
self.type = 'dir'
self.media = None
self.disc_id = disc_id
self.devicename = devicename
self.name = 'Unknown CD Album'
# variables only for Playlist
self.current_item = 0
self.playlist = []
self.autoplay = 0
# variables only for DirItem
self.dir = dir
self.display_type = display_type
# set directory variables to default
all_variables = ('DIRECTORY_AUTOPLAY_SINGLE_ITEM',
'AUDIO_RANDOM_PLAYLIST')
for v in all_variables:
setattr(self, v, eval('config.%s' % v))
def copy(self, obj):
"""
Special copy value DirItem
"""
Playlist.copy(self, obj)
if obj.type == 'dir':
self.dir = obj.dir
self.display_type = obj.display_type
def actions(self):
"""
return a list of actions for this item
"""
items = [ ( self.cwd, 'Browse directory' ) ]
return items
def cwd(self, arg=None, menuw=None):
"""
make a menu item for each file in the directory
"""
play_items = []
for i in range(0, len(self.info['tracks'])):
title=self.info['tracks'][i]['title']
item = AudioItem('cdda://%d' % (i+1), self, None, title)
# XXX FIXME: set also all the other infos here if AudioInfo
# XXX will be based on mmpython
item.set_info('', self.name, title, i+1, self.disc_id[1], '')
if config.MPLAYER_ARGS.has_key('cd'):
item.mplayer_options += (' ' + config.MPLAYER_ARGS['cd'])
if self.devicename:
item.mplayer_options += ' -cdrom-device %s' % self.devicename
play_items.append(item)
# add all playable items to the playlist of the directory
# to play one files after the other
self.playlist = play_items
# all items together
items = []
# random playlist (only active for audio)
if len(play_items) > 1 and config.AUDIO_RANDOM_PLAYLIST == 1:
pl = Playlist(play_items, self)
pl.randomize()
pl.autoplay = 1
items += [ pl ]
items += play_items
self.play_items = play_items
title = self.name
if title[0] == '[' and title[-1] == ']':
title = self.name[1:-1]
item_menu = menu.Menu(title, items, item_types = self.display_type)
if menuw:
menuw.pushmenu(item_menu)
return items
--- NEW FILE: configure.py ---
#if 0 /*
# -----------------------------------------------------------------------
# configure.py - Configure video playing
# -----------------------------------------------------------------------
# $Id: configure.py,v 1.1 2003/06/20 18:19:00 dischi Exp $
#
# Notes: Not integrated right now
# Todo: Fix some stuff, wait for the mplayer people what they are doing
#
# -----------------------------------------------------------------------
# $Log: configure.py,v $
# Revision 1.1 2003/06/20 18:19:00 dischi
# basic mmpython support
#
# Revision 1.10 2003/04/24 19:56:42 dischi
# comment cleanup for 1.3.2-pre4
#
# Revision 1.9 2003/04/12 18:30:04 dischi
# add support for audio/subtitle selection for avis, too
#
# Revision 1.8 2003/03/31 20:44:52 dischi
# shorten time between pop.destroy and menu drawing
#
# Revision 1.7 2003/03/30 16:50:20 dischi
# pass xml_file definition to submenus
#
# -----------------------------------------------------------------------
# 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.
#
# 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
# The menu widget class
import menu
# RegExp
import re
current_xml_file = None
#
# Dummy for playing the movie
#
def play_movie(arg=None, menuw=None):
menuw.delete_menu()
arg[0].play(menuw=menuw, arg=arg[1])
#
# Audio menu and selection
#
def audio_selection(arg=None, menuw=None):
arg[0].selected_audio = arg[1]
menuw.back_one_menu()
def audio_selection_menu(arg=None, menuw=None):
global current_xml_file
items = []
for a in arg.info['audio']:
txt = '%s (channels=%s, codec=%s, id=%s)' % (a['language'], a['channels'],
a['codec'], a['id'])
items.append(menu.MenuItem(txt, audio_selection, (arg, a['id'])))
moviemenu = menu.Menu('AUDIO MENU', items, xml_file=current_xml_file)
menuw.pushmenu(moviemenu)
#
# Subtitle menu and selection
#
def subtitle_selection(arg=None, menuw=None):
arg[0].selected_subtitle = arg[1]
menuw.back_one_menu()
def subtitle_selection_menu(arg=None, menuw=None):
global current_xml_file
items = []
items += [ menu.MenuItem("no subtitles", subtitle_selection, (arg, None)) ]
for s in range(len(arg.info['subtitles'])):
items.append(menu.MenuItem(arg.info['subtitles'][s], subtitle_selection, (arg,
s)))
moviemenu = menu.Menu('SUBTITLE MENU', items, xml_file=current_xml_file)
menuw.pushmenu(moviemenu)
#
# Chapter selection
#
def chapter_selection(menuw=None, arg=None):
menuw.delete_menu()
play_movie(menuw=menuw, arg=arg)
def chapter_selection_menu(arg=None, menuw=None):
global current_xml_file
items = []
for c in range(1, arg.info['chapters']):
items += [ menu.MenuItem("play chapter %s" % c, chapter_selection,
(arg, ' -chapter %s' % c)) ]
moviemenu = menu.Menu('CHAPTER MENU', items, xml_file=current_xml_file)
menuw.pushmenu(moviemenu)
#
# De-interlacer
#
def toggle(arg=None, menuw=None):
setattr(arg[0], arg[1], not getattr(arg[0], arg[1]))
sel = menuw.all_items.index(menuw.menustack[-1].selected)
menuw.menustack[-1].choices = main_menu_generate(arg[0])
menuw.menustack[-1].selected = menuw.menustack[-1].choices[sel]
menuw.init_page()
menuw.refresh()
def add_toogle(name, item, var):
if getattr(item, var):
return menu.MenuItem("Turn off %s" % name, toggle, (item, var))
return menu.MenuItem("Turn on %s" % name, toggle, (item, var))
#
# config main menu
#
def main_menu_generate(item):
next_start = 0
items = []
if item.info.has_key('audio') and len(item.info['audio']) > 1:
items.append(menu.MenuItem("Audio selection", audio_selection_menu, item))
if item.info.has_key('subtitles') and len(item.info['subtitles']) > 1:
items.append(menu.MenuItem("Subtitle selection", subtitle_selection_menu,
item))
if item.info.has_key('chapters') and item.info['chapters'] > 1:
items.append(menu.MenuItem("Chapter selection", chapter_selection_menu, item))
items += [ add_toogle('deinterlacing', item, 'deinterlace') ]
items += [ menu.MenuItem("Play", play_movie, (item, '')) ]
return items
def get_main_menu(item, menuw, xml_file):
global current_xml_file
current_xml_file = xml_file
return menu.Menu('CONFIG MENU', main_menu_generate(item), xml_file=xml_file)
--- NEW FILE: rom_drives.py ---
#if 0 /*
# -----------------------------------------------------------------------
# rom_drives.py - the Freevo identifymedia/automount plugin
# -----------------------------------------------------------------------
# $Id: rom_drives.py,v 1.1 2003/06/20 18:19:00 dischi Exp $
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# $Log: rom_drives.py,v $
# Revision 1.1 2003/06/20 18:19:00 dischi
# basic mmpython support
#
# Revision 1.10 2003/06/07 04:59:10 outlyer
# Treat Mixed (CD Audio + Data Track) as CD Audio too since the ioctl
# returns a different value.
#
# It would be nice to have the data track mounted as well. Looking into it now.
#
# Revision 1.9 2003/05/29 09:06:18 dischi
# small fix again
#
# Revision 1.8 2003/05/28 15:11:43 dischi
# small bugfix
#
# Revision 1.7 2003/05/27 17:53:35 dischi
# Added new event handler module
#
# Revision 1.6 2003/04/26 15:09:19 dischi
# changes for the new mount/umount
#
# Revision 1.5 2003/04/24 19:56:38 dischi
# comment cleanup for 1.3.2-pre4
#
# Revision 1.4 2003/04/24 19:14:50 dischi
# pass xml_file to directory and videoitems
#
# Revision 1.3 2003/04/20 17:36:49 dischi
# Renamed TV_SHOW_IMAGE_DIR to TV_SHOW_DATA_DIR. This directory can contain
# images like before, but also fxd files for the tv show with global
# informations (plot/tagline/etc) and mplayer options.
#
# Revision 1.2 2003/04/20 12:43:33 dischi
# make the rc events global in rc.py to avoid get_singleton. There is now
# a function app() to get/set the app. Also the events should be passed to
# the daemon plugins when there is no handler for them before. Please test
# it, especialy the mixer functions.
#
# Revision 1.1 2003/04/20 10:53:23 dischi
# moved identifymedia and mediamenu to plugins
#
# -----------------------------------------------------------------------
# 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.
#
# 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 time, os
from fcntl import ioctl
import re
import threading
import string
import copy
import config
import util
import rc
import event as em
import plugin
from audio.audiodiskitem import AudioDiskItem
from video.videoitem import VideoItem
from item import Item
TRUE = 1
FALSE = 0
import mmpython
from video import xml_parser, videoitem
from directory import DirItem
DEBUG = config.DEBUG # 1 = regular debug, 2 = more verbose
LABEL_REGEXP = re.compile("^(.*[^ ]) *$").match
# taken from cdrom.py so we don't need to import cdrom.py
CDROM_DRIVE_STATUS=0x5326
CDSL_CURRENT=( (int ) ( ~ 0 >> 1 ) )
CDS_DISC_OK=4
CDROM_DISC_STATUS=0x5327
CDS_AUDIO=100
CDS_MIXED=105
CDROM_SELECT_SPEED=0x5322
# Identify_Thread
im_thread = None
from gui.PopupBox import PopupBox
def init():
# Add the drives to the config.removable_media list. There doesn't have
# to be any drives defined.
if config.ROM_DRIVES != None:
for i in range(len(config.ROM_DRIVES)):
(dir, device, name) = config.ROM_DRIVES[i]
media = RemovableMedia(mountdir=dir, devicename=device,
drivename=name)
# close the tray without popup message
media.move_tray(dir='close', notify=0)
config.REMOVABLE_MEDIA.append(media)
# Remove the ROM_DRIVES member to make sure it is not used by
# legacy code!
del config.ROM_DRIVES # XXX Remove later
# Start identifymedia thread
global im_thread
im_thread = Identify_Thread()
im_thread.setDaemon(1)
im_thread.start()
class autostart(plugin.DaemonPlugin):
"""
Plugin to autostart if a new medium is inserted while Freevo shows
the main menu
"""
def __init__(self):
plugin.DaemonPlugin.__init__(self)
global im_thread
if not im_thread:
init()
def eventhandler(self, event = None, menuw=None, arg=None):
"""
eventhandler to handle the IDENTIFY_MEDIA plugin event and the
EJECT event
"""
global im_thread
# if we are at the main menu and there is an IDENTIFY_MEDIA event,
# try to autorun the media
if plugin.isevent(event) == 'IDENTIFY_MEDIA' and im_thread.last_media and \
menuw and len(menuw.menustack) == 1:
media = im_thread.last_media
if media.info:
media.info.parent = menuw.menustack[0].selected
if media.info and media.info.actions():
media.info.actions()[0][0](menuw=menuw)
else:
menuw.refresh()
return TRUE
# Handle the EJECT key for the main menu
elif event == em.EJECT and len(menuw.menustack) == 1:
# Are there any drives defined?
if config.REMOVABLE_MEDIA:
# The default is the first drive in the list
media = config.REMOVABLE_MEDIA[0]
media.move_tray(dir='toggle')
return TRUE
class rom_items(plugin.MainMenuPlugin):
"""
Plugin to add the rom drives to a main menu. This can be the global main menu
or most likely the video/audio/image/games main menu
"""
def __init__(self):
plugin.MainMenuPlugin.__init__(self)
self.parent = None
global im_thread
if not im_thread:
init()
def items(self, parent):
"""
return the list of rom drives
"""
self.parent = parent
items = []
for media in config.REMOVABLE_MEDIA:
if media.info:
# if this is a video item (e.g. DVD) and we are not in video
# mode, deactivate it
if media.info.type == 'video' and parent.display_type != 'video':
m = Item(parent)
m.type = media.info.type
m.copy(media.info)
m.media = media
elif parent.display_type == 'video' and media.videoinfo:
m = media.videoinfo
else:
if media.info.type == 'dir':
media.info.display_type = parent.display_type
m = media.info
else:
m = Item(parent)
m.name = 'Drive %s (no disc)' % media.drivename
m.media = media
media.info = m
# hack: now make self the parent to get the events
m.parent = parent
m.eventhandler_plugins.append(self.items_eventhandler)
items.append(m)
return items
def items_eventhandler(self, event, item, menuw):
"""
handle EJECT for the rom drives
"""
if event == em.EJECT and item.media and menuw and \
menuw.menustack[1] == menuw.menustack[-1]:
item.media.move_tray(dir='toggle')
return TRUE
return FALSE
class RemovableMedia:
"""
Object about one drive
"""
def __init__(self, mountdir='', devicename='', drivename=''):
# This is read-only stuff for the drive itself
self.mountdir = mountdir
self.devicename = devicename
self.drivename = drivename
# Dynamic stuff
self.tray_open = 0
self.drive_status = None # return code from ioctl for DRIVE_STATUS
self.id = ''
self.label = ''
self.info = None
self.videoinfo = None
self.type = 'empty_cdrom'
def is_tray_open(self):
if self.tray_open and self.info:
# if we have an info, the tray can't be open
self.tray_open = FALSE
return self.tray_open
def move_tray(self, dir='toggle', notify=1):
"""Move the tray. dir can be toggle/open/close
"""
if dir == 'toggle':
if self.is_tray_open():
dir = 'close'
else:
dir = 'open'
if dir == 'open':
if DEBUG: print 'Ejecting disc in drive %s' % self.drivename
if notify:
pop = PopupBox(text='Ejecting disc in drive %s' % self.drivename)
pop.show()
os.system('eject %s' % self.devicename)
self.tray_open = 1
if notify:
pop.destroy()
elif dir == 'close':
if DEBUG: print 'Inserting %s' % self.drivename
if notify:
pop = PopupBox(text='Reading disc in drive %s' % self.drivename)
pop.show()
# close the tray, identifymedia does the rest,
# including refresh screen
os.system('eject -t %s' % self.devicename)
self.tray_open = 0
if notify:
pop.destroy()
def mount(self):
"""Mount the media
"""
if DEBUG: print 'Mounting disc in drive %s' % self.drivename
util.mount(self.mountdir, force=TRUE)
return
def umount(self):
"""Mount the media
"""
if DEBUG: print 'Unmounting disc in drive %s' % self.drivename
util.umount(self.mountdir)
return
class Identify_Thread(threading.Thread):
"""
Thread to watch the rom drives for changes
"""
def identify(self, media):
"""
magic!
Try to find out as much as possible about the disc in the
rom drive: title, image, play options, ...
"""
# Check drive status (tray pos, disc ready)
try:
fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK)
s = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)
except:
# maybe we need to close the fd if ioctl fails, maybe
# open fails and there is no fd
try:
os.close(fd)
except:
pass
media.drive_status = None
return
# Same as last time? If so we're done
if s == media.drive_status:
os.close(fd)
return
media.drive_status = s
media.id = ''
media.label = ''
media.type = 'empty_cdrom'
media.info = None
media.videoinfo = None
# Is there a disc present?
if s != CDS_DISC_OK:
os.close(fd)
return
data = mmpython.parse(media.devicename)
mmpython.cache_disc(data)
if data and data.mime == 'audio/cd':
os.close(fd)
disc_id = data.id
media.info = AudioDiskItem(disc_id, parent=None,
devicename=media.devicename,
display_type='audio')
media.info.handle_type = 'audio'
if data.title:
media.info.name = data.title
media.info.info = data
return
# try to set the speed
if config.ROM_SPEED:
try:
ioctl(fd, CDROM_SELECT_SPEED, config.ROM_SPEED)
except:
pass
os.close(fd)
image = title = movie_info = more_info = xml_file = None
if data:
media.id = data.id
media.label = data.label
media.type = 'cdrom'
else:
# Read the volume label directly from the ISO9660 file system
try:
img = open(media.devicename)
img.seek(0x0000832d)
id = img.read(16)
img.seek(32808, 0)
label = img.read(32)
m = LABEL_REGEXP(label)
if m:
label = m.group(1)
img.close()
except IOError:
print 'I/O error on disc %s' % media.devicename
return
media.id = id+label
media.label = label
media.type = 'cdrom'
# is the id in the database?
if media.id in config.MOVIE_INFORMATIONS_ID:
movie_info = config.MOVIE_INFORMATIONS_ID[media.id]
if movie_info:
title = movie_info.name
# no? Maybe we can find a label regexp match
else:
for (re_label, movie_info_t) in config.MOVIE_INFORMATIONS_LABEL:
if re_label.match(media.label):
movie_info = movie_info_t
if movie_info_t.name:
title = movie_info.name
m = re_label.match(media.label).groups()
re_count = 1
# found, now change the title with the regexp. E.g.:
# label is "bla_2", the label regexp "bla_[0-9]" and the title
# is "Something \1", the \1 will be replaced with the first
item
# in the regexp group, here 2. The title is now "Something 2"
for g in m:
title=string.replace(title, '\\%s' % re_count, g)
re_count += 1
break
if movie_info:
image = movie_info.image
# DVD/VCD/SVCD:
# There is data from mmpython for these three types
if data and data.mime in ('video/cd', 'video/dvd'):
if not title:
title = '%s [%s]' % (mediatype[0], media.label)
if movie_info:
media.info = copy.copy(movie_info)
else:
media.info = videoitem.VideoItem('0', None)
media.info.name = title
media.info.mode = data.mime[6:]
media.info.media = media
media.type = data.mime[6:]
if media.info.info:
for i in media.info.info:
if media.info.info[i]:
data[i] = media.info.info[i]
media.info.info = data
# copy configure options from track[0] to main item
# for playback
for k in ('audio', 'subtitles', 'chapters' ):
if media.info.info.tracks[0].has_key(k):
if not media.info.info.has_key(k):
media.info.info.keys.append(k)
media.info.info[k] = media.info.info.tracks[0][k]
if os.path.isfile(config.COVER_DIR+data.label+'.jpg'):
media.info.image = config.COVER_DIR+data.label+'.jpg'
media.info.num_titles = len(data.tracks)
# Hack to avoid rescan, remove this when mmpython is used
# everytime
media.info.scanned = TRUE
return
# Disc is data of some sort. Mount it to get the file info
util.mount(media.mountdir, force=TRUE)
# Check for movies/audio/images on the disc
mplayer_files = util.match_files(media.mountdir, config.SUFFIX_VIDEO_FILES)
mp3_files = util.match_files(media.mountdir, config.SUFFIX_AUDIO_FILES)
image_files = util.match_files(media.mountdir, config.SUFFIX_IMAGE_FILES)
util.umount(media.mountdir)
if DEBUG:
print 'identifymedia: mplayer = "%s"' % mplayer_files
print 'identifymedia: mp3="%s"' % mp3_files
print 'identifymedia: image="%s"' % image_files
media.info = DirItem(media.mountdir, None)
# Is this a movie disc?
if mplayer_files and not mp3_files:
media.info.handle_type = 'video'
# try to find out if it is a series cd
if not title:
show_name = ""
the_same = 1
volumes = ''
for movie in mplayer_files:
if config.TV_SHOW_REGEXP_MATCH(movie):
show = config.TV_SHOW_REGEXP_SPLIT(os.path.basename(movie))
if show_name and show_name != show[0]: the_same = 0
if not show_name: show_name = show[0]
if volumes: volumes += ', '
volumes += show[1] + "x" + show[2]
if show_name and the_same:
k = config.TV_SHOW_DATA_DIR + show_name
if os.path.isfile((k + ".png").lower()):
image = (k + ".png").lower()
elif os.path.isfile((k + ".jpg").lower()):
image = (k + ".jpg").lower()
title = show_name + ' ('+ volumes + ')'
if config.TV_SHOW_INFORMATIONS.has_key(show_name.lower()):
tvinfo = config.TV_SHOW_INFORMATIONS[show_name.lower()]
more_info = tvinfo[1]
if not image:
image = tvinfo[0]
if not xml_file:
xml_file = tvinfo[3]
elif not show_name:
if os.path.isfile(config.COVER_DIR+\
os.path.splitext(os.path.basename(movie))[0]+'.png'):
image = config.COVER_DIR+\
os.path.splitext(os.path.basename(movie))[0]+'.png'
elif os.path.isfile(config.COVER_DIR+\
os.path.splitext(os.path.basename(movie))[0]+'.jpg'):
image = config.COVER_DIR+\
os.path.splitext(os.path.basename(movie))[0]+'.jpg'
title = os.path.splitext(os.path.basename(movie))[0]
# nothing found, give up: return the label
if not title:
title = label
# XXX add more intelligence to cds with audio files
elif (not mplayer_files) and mp3_files:
media.info.handle_type = 'audio'
title = '%s [%s]' % (media.drivename, label)
# XXX add more intelligence to cds with image files
elif (not mplayer_files) and (not mp3_files) and image_files:
media.info.handle_type = 'image'
title = '%s [%s]' % (media.drivename, label)
# Mixed media?
elif mplayer_files or image_files or mp3_files:
media.info.handle_type = None
title = '%s [%s]' % (media.drivename, label)
# Strange, no useable files
else:
media.info.handle_type = None
title = '%s [%s]' % (media.drivename, label)
if movie_info:
media.info.copy(movie_info)
if title:
media.info.name = title
if image:
media.info.image = image
if more_info:
media.info.info = more_info
if xml_file:
media.info.xml_file = xml_file
if len(mplayer_files) == 1:
media.videoinfo = VideoItem(mplayer_files[0], None)
media.videoinfo.media = media
media.videoinfo.media_id = media.id
media.videoinfo.label = media.label
if movie_info:
media.videoinfo.copy(movie_info)
if title:
media.videoinfo.name = title
if image:
media.videoinfo.image = image
if more_info:
media.videoinfo.info = more_info
if xml_file:
media.videoinfo.xml_file = xml_file
media.info.media = media
return
def check_all(self):
for media in config.REMOVABLE_MEDIA:
last_status = media.drive_status
self.identify(media)
if last_status != media.drive_status:
if DEBUG:
print 'MEDIA: Status=%s' % media.drive_status
print 'Posting IDENTIFY_MEDIA event'
if last_status:
self.last_media = media
rc.post_event(plugin.event('IDENTIFY_MEDIA'))
else:
if DEBUG > 1:
print 'MEDIA: Status=%s' % media.drive_status
def __init__(self):
threading.Thread.__init__(self)
self.last_media = None # last changed media
def run(self):
# Make sure the movie database is rebuilt at startup
os.system('touch /tmp/freevo-rebuild-database')
while 1:
# Check if we need to update the database
# This is a simple way for external apps to signal changes
if os.path.exists("/tmp/freevo-rebuild-database"):
xml_parser.hash_xml_database()
for media in config.REMOVABLE_MEDIA:
media.drive_status = None
self.check_all()
time.sleep(2)
--- NEW FILE: use_mmpython.sh ---
#!/usr/bin/env bash
# use_mmpython.sh
#
# Dirk Meyer <[EMAIL PROTECTED]>
# $Id: use_mmpython.sh,v 1.1 2003/06/20 18:19:00 dischi Exp $
cd `dirname $0`
cp audiodiskitem.py ../../src/audio/audiodiskitem.py
cp configure.py ../../src/video/configure.py
cp rom_drives.py ../../src/plugins
# end of use_mmpython.sh
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog