Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv20370
Modified Files:
rom_drives.py
Log Message:
IDENTIFY_MEDIA now sends the media as arg
Index: rom_drives.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/rom_drives.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** rom_drives.py 29 Dec 2003 22:09:38 -0000 1.47
--- rom_drives.py 30 Dec 2003 15:30:56 -0000 1.48
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.48 2003/12/30 15:30:56 dischi
+ # IDENTIFY_MEDIA now sends the media as arg
+ #
# Revision 1.47 2003/12/29 22:09:38 dischi
# move to new Item attributes
***************
*** 19,40 ****
# use new Mimetype plugin interface
#
- # Revision 1.44 2003/11/28 20:08:57 dischi
- # renamed some config variables
- #
- # Revision 1.43 2003/11/28 19:26:37 dischi
- # renamed some config variables
- #
- # Revision 1.42 2003/11/24 19:25:28 dischi
- # adjust to variable moving
- #
- # Revision 1.41 2003/11/22 20:36:04 dischi
- # use new vfs
- #
- # Revision 1.40 2003/11/09 16:17:32 dischi
- # fix mmpython info parsing for movies on disc
- #
- # Revision 1.39 2003/11/09 13:05:04 dischi
- # support for disc images without fxd file
- #
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
--- 22,25 ----
***************
*** 70,73 ****
--- 55,60 ----
from struct import *
import array
+ import rc
+
try:
***************
*** 130,134 ****
# 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
--- 117,121 ----
# Remove the ROM_DRIVES member to make sure it is not used by
# legacy code!
! del config.ROM_DRIVES
# Start identifymedia thread
***************
*** 145,152 ****
--- 132,143 ----
"""
def __init__(self):
+ """
+ load the plugin and start the thread
+ """
plugin.DaemonPlugin.__init__(self)
global im_thread
if not im_thread:
init()
+
def eventhandler(self, event = None, menuw=None, arg=None):
***************
*** 159,165 ****
# 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
--- 150,156 ----
# 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 menuw and \
! len(menuw.menustack) == 1 and not event.arg[1]:
! media = event.arg[0]
if media.info:
media.info.parent = menuw.menustack[0].selected
***************
*** 188,193 ****
"""
def __init__(self):
plugin.MainMenuPlugin.__init__(self)
- self.parent = None
global im_thread
if not im_thread:
--- 179,186 ----
"""
def __init__(self):
+ """
+ load the plugin and start the thread
+ """
plugin.MainMenuPlugin.__init__(self)
global im_thread
if not im_thread:
***************
*** 198,214 ****
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
--- 191,198 ----
return the list of rom drives
"""
items = []
for media in config.REMOVABLE_MEDIA:
if media.info:
! if parent.display_type == 'video' and media.videoinfo:
m = media.videoinfo
***************
*** 225,229 ****
media.info = m
- # hack: now make self the parent to get the events
m.parent = parent
m.eventhandler_plugins.append(self.items_eventhandler)
--- 209,212 ----
***************
*** 265,276 ****
self.cached = False
def is_tray_open(self):
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():
--- 248,263 ----
self.cached = False
+
def is_tray_open(self):
+ """
+ return tray status
+ """
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():
***************
*** 346,352 ****
def mount(self):
- """Mount the media
"""
!
_debug_('Mounting disc in drive %s' % self.drivename,2)
util.mount(self.mountdir, force=True)
--- 333,339 ----
def mount(self):
"""
! Mount the media
! """
_debug_('Mounting disc in drive %s' % self.drivename,2)
util.mount(self.mountdir, force=True)
***************
*** 355,361 ****
def umount(self):
- """Mount the media
"""
!
_debug_('Unmounting disc in drive %s' % self.drivename,2)
util.umount(self.mountdir)
--- 342,348 ----
def umount(self):
"""
! Mount the media
! """
_debug_('Unmounting disc in drive %s' % self.drivename,2)
util.umount(self.mountdir)
***************
*** 436,440 ****
devicename=media.devicename,
display_type='audio')
! media.type = media.info.type
media.info.handle_type = 'audio'
media.info.media = media
--- 423,427 ----
devicename=media.devicename,
display_type='audio')
! media.type = media.info.type
media.info.handle_type = 'audio'
media.info.media = media
***************
*** 567,572 ****
the_same = 1
volumes = ''
! start_ep = 0
! end_ep = 0
mplayer_files.sort(lambda l, o: cmp(l.upper(), o.upper()))
--- 554,559 ----
the_same = 1
volumes = ''
! start_ep = 0
! end_ep = 0
mplayer_files.sort(lambda l, o: cmp(l.upper(), o.upper()))
***************
*** 641,646 ****
- if movie_info:
- media.info.copy(movie_info)
if title:
media.info.name = title
--- 628,631 ----
***************
*** 654,665 ****
if len(mplayer_files) == 1:
util.mount(media.mountdir)
! media.videoinfo = VideoItem(mplayer_files[0], None)
util.umount(media.mountdir)
! 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
--- 639,650 ----
if len(mplayer_files) == 1:
util.mount(media.mountdir)
! if movie_info:
! media.videoinfo = copy.deepcopy(movie_info)
! else:
! media.videoinfo = VideoItem(mplayer_files[0], None)
util.umount(media.mountdir)
! media.videoinfo.media = media
media.videoinfo.media_id = media.id
if title:
media.videoinfo.name = title
***************
*** 676,679 ****
--- 661,671 ----
def check_all(self):
+ """
+ check all drives
+ """
+ if rc.app():
+ # Some app is running, do not scan, it's not necessary
+ return
+
self.lock.acquire()
for media in config.REMOVABLE_MEDIA:
***************
*** 684,701 ****
_debug_('MEDIA: Status=%s' % media.drive_status,2)
_debug_('Posting IDENTIFY_MEDIA event',2)
! if last_status:
! self.last_media = media
! rc.post_event(plugin.event('IDENTIFY_MEDIA'))
self.lock.release()
def __init__(self):
threading.Thread.__init__(self)
- self.last_media = None # last changed media
self.lock = thread.allocate_lock()
def run(self):
!
rebuild_file = '/tmp/freevo-rebuild-database'
# Make sure the movie database is rebuilt at startup
--- 676,698 ----
_debug_('MEDIA: Status=%s' % media.drive_status,2)
_debug_('Posting IDENTIFY_MEDIA event',2)
! if last_status == None:
! rc.post_event(plugin.event('IDENTIFY_MEDIA', arg=(media, True)))
! else:
! rc.post_event(plugin.event('IDENTIFY_MEDIA', arg=(media, False)))
self.lock.release()
def __init__(self):
+ """
+ init the thread
+ """
threading.Thread.__init__(self)
self.lock = thread.allocate_lock()
def run(self):
! """
! thread main function
! """
rebuild_file = '/tmp/freevo-rebuild-database'
# Make sure the movie database is rebuilt at startup
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog