hi

I have a freevo 1.8.1 box , where the program freevo runs as user
'freevo' (and not root)

I have a data CD with some audio files on it;
if I mount the CD as root, then I can browse the CD and play audio fine;
if I insert the CD and let freevo manage it, all hell breaks loose

the problem is that freevo continues to mount/unmount the CD, but this
exposes many bugs

one such bug for example is in the  Dirwatcher plugin that wants to scan
the directory in the CD, but the CD gets unmounted,  and freevo crashes

I have fixed all bugs in directory.py , I attach a patch, so now I can
browse the CD fine

 but I still cannot play stuff there... I have to intercept the call to
mplayer, and be sure the CD is not unmounted while mplayer is trying
playing the music in it; where do I find it?

a.
--- /usr/share/pyshared/freevo/directory.py~orig	2008-08-04 11:13:11.000000000 +0200
+++ /usr/share/pyshared/freevo/directory.py	2008-08-04 12:03:14.000000000 +0200
@@ -520,8 +520,8 @@
         # are we on a ROM_DRIVE and have to mount it first?
         for media in config.REMOVABLE_MEDIA:
             if self.dir.find(media.mountdir) == 0:
-                util.mount(self.dir)
                 self.media = media
+                self.media.mount()
 
         if vfs.isfile(self.dir + '/.password'):
             print 'password protected dir'
@@ -971,6 +971,7 @@
         self.item_menu     = None
         self.dir           = None
         self.files         = None
+        self.media         = None
         self.poll_interval = 100 # 1 sec
 
         plugin.register(self, 'Dirwatcher')
@@ -1002,11 +1003,25 @@
         self.item      = item
         self.item_menu = item_menu
         self.dir       = dir
+        # are we on a ROM_DRIVE and have to mount it first?
+        self.media = None
+        if self.dir:
+            for media in config.REMOVABLE_MEDIA:
+                if self.dir.find(media.mountdir) == 0:
+                    self.media = media
+        print 'CWD to DIR %s MEDIA %s' % (dir,media)
+
         try:
             self.last_time = item.__dirwatcher_last_time__
             self.files     = item.__dirwatcher_last_files__
         except AttributeError:
+            need_umount = False
+            if self.media:
+                need_umount = not self.media.is_mounted()
+                self.media.mount()
             self.last_time = vfs.mtime(self.dir)
+            if need_umount:
+                self.media.umount()
             self.files     = self.listoverlay()
             self.item.__dirwatcher_last_time__  = self.last_time
             self.item.__dirwatcher_last_files__ = self.files
@@ -1015,6 +1030,12 @@
     def scan(self):
         if not self.dir:
             return
+
+        need_umount = False
+        if self.media:
+            need_umount = not self.media.is_mounted()
+            self.media.mount()
+
         try:
             if vfs.mtime(self.dir) <= self.last_time:
                 return True
@@ -1052,6 +1073,9 @@
         self.files = self.listoverlay()
         self.item.__dirwatcher_last_files__ = self.files
 
+        if need_umount:
+            self.media.umount()
+
 
     def poll(self):
         if self.dir and self.menuw and \
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to