-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

A Mennucc ha scritto:
> hi,
> 
> two problems (again!) with CDROMs !
> see bug http://bugs.debian.org/478574 
>
> I am preparing a patch.


here it is in attachment (ignore the first HUNK that was already applied
in SVN)

please check  it; in particular, I put some snippets of code that would
umount the media when the playing is over , and I used the methods
'stop': is it always true that the 'stop' methods are called when
playing ends (regardless of if it ends because the video is over, or the
user stopped it) ?

a.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpGRjQACgkQ9B/tjjP8QKRXMACffYCTdLUjCMefegsbVLmaCkk3
eQ8AoIURJkqLhKgzmP/7HmD2nI5AVu9o
=cmbh
-----END PGP SIGNATURE-----
diff -ur freevo.orig/util/fileops.py freevo/util/fileops.py
--- freevo.orig/util/fileops.py	2009-04-11 16:58:01.000000000 +0200
+++ freevo/util/fileops.py	2009-06-26 23:44:06.000000000 +0200
@@ -382,8 +382,6 @@
         so, se = p.communicate()
         if rc in (1,32,):
             _debug_('mounting %r: %s' % (dir, se), DWARNING)
-            from util.misc import print_upper_execution_stack
-            print_upper_execution_stack()
         if os.path.ismount(dir) and not dir in mounted_dirs:
             mounted_dirs.append(dir)
     if force and not dir in mounted_dirs:
@@ -427,9 +425,9 @@
 
 def resolve_media_mountdir(*arg):
     """
-    get the mount point of the media with media_id
+    get the media with given media_id , and add its mountpoint to the filename
     """
-    _debug_('resolve_media_mountdir(arg=%r)' % (arg,), 2)
+    _debug_('resolve_media(arg=%r)' % (arg,), 2)
     if len(arg) == 1 and isinstance(arg[0], dict):
         media_id = arg[0]['media_id']
         file     = arg[0]['file']
@@ -439,16 +437,15 @@
     else:
         raise KeyError
 
-    mountdir = ''
+    media = None
     # Find on what media it is located
     for media in config.REMOVABLE_MEDIA:
         if media_id == media.id:
             # Then set the filename
-            mountdir = media.mountdir
             file     = vfs.join(media.mountdir, file)
             break
 
-    return mountdir, file
+    return media, file
 
 
 def check_media(media_id):
diff -ur freevo.orig/video/plugins/mplayer.py freevo/video/plugins/mplayer.py
--- freevo.orig/video/plugins/mplayer.py	2009-05-07 19:34:38.000000000 +0200
+++ freevo/video/plugins/mplayer.py	2009-06-26 23:57:09.000000000 +0200
@@ -76,6 +76,8 @@
         self.plugins    = []
         self.paused     = False
         self.stored_time_info = None
+        self.audio_media = None
+        self.subtitle_media = None
 
 
     def rate(self, item):
@@ -297,13 +299,15 @@
                 _debug_('crop=%s:%s:%s:%s' % (x2-x1, y2-y1, x1, y1))
 
         if item.subtitle_file:
-            d, f = util.resolve_media_mountdir(item.subtitle_file)
-            util.mount(d)
+            self.subtitle_media, f = util.resolve_media_mountdir(item.subtitle_file)
+            if self.subtitle_media:
+                self.subtitle_media.mount()
             args['sub'] = '-sub %s' % f
 
         if item.audio_file:
-            d, f = util.resolve_media_mountdir(item.audio_file)
-            util.mount(d)
+            self.audio_media, f = util.resolve_media_mountdir(item.audio_file)
+            if self.audio_media:
+                self.audio_media.mount()
             args['audiofile'] = '-audiofile %s' % f
 
         self.plugins = plugin.get('mplayer_video')
@@ -389,6 +393,14 @@
         rc.app(None)
         dialog.disable_overlay_display()
         self.app = None
+        
+        if self.subtitle_media:
+            self.subtitle_media.mount()
+            self.subtitle_media = None
+                
+        if self.audio_media:
+            self.audio_media.mount()
+            self.audio_media = None
 
 
     def eventhandler(self, event, menuw=None):
diff -ur freevo.orig/video/videoitem.py freevo/video/videoitem.py
--- freevo.orig/video/videoitem.py	2009-05-16 20:10:55.000000000 +0200
+++ freevo/video/videoitem.py	2009-06-27 00:20:03.000000000 +0200
@@ -98,6 +98,7 @@
         self.subitems          = []
         self.current_subitem   = None
         self.media_id          = ''
+        self.mounted_media     = None
 
         self.subtitle_file     = {}
         self.audio_file        = {}
@@ -641,9 +642,10 @@
         if self.url.startswith('file://'):
             file = self.filename
             if self.media_id:
-                mountdir, file = util.resolve_media_mountdir(self.media_id,file)
-                if mountdir:
-                    util.mount(mountdir)
+                media = util.check_media(self.media_id)
+                if media:
+                    media.mount()
+                    self.mounted_media  = media
                 else:
                     self.menuw.show()
                     ConfirmBox(text=(_('No media found for "%(file)s".\nPlease insert the media "%(media_id)s".')) % \
@@ -651,7 +653,8 @@
                     return
 
             elif self.media:
-                util.mount(os.path.dirname(self.filename))
+                self.media.mount()
+                self.mounted_media = self.media
 
         # dvd and vcd
         elif self.mode in ('dvd', 'vcd') and not self.filename and not self.media:
@@ -707,7 +710,10 @@
 
         if self.player:
             self.player.stop()
-
+        
+        if self.mounted_media:
+            self.mounted_media.umount()
+            self.mounted_media = None
 
     def dvd_vcd_title_menu(self, arg=None, menuw=None):
         """
------------------------------------------------------------------------------
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to