[Rhythmbox-devel] RFC: removable media



Right now in rhythmbox the handling of removable media is a pain. 
If a userhas a USB/FW drive that is not connected when rhythmbox starts
up, rhythmbox assumes that those files have been deleted, and removes
them from the database. Another problem is say you have one mount point
for all of your USB/FW drives, depending on which one is plugged in when
RB is loaded, files may be removed from the database. 

I have given this some thought and have come up with this solution:

For each file in the database, we need a new attribute representing 
its physical location, that is unique to the physical device but not
unique to its order of being plugged in. I suggest we use the device's
serial number along with the partition number, so the physical location
attribute would be "SERIAL#_PARTITION#" (For devices with out partitions
PARTITION# can just be blank). When rhythmbox scans its database
we can now take more intelligent actions:

	if file is not present and file path has the same physical
	location attribute, then the file has been deleted or moved, and
	rhythmbox should remove the file from the database.

	if the file is not present, and the file path has a different 	physical
location attribute, then the device is not present, 
	and rhythmbox should tag the file as being temporarily 	unavailable.

Other considerations:

a device is removed: rhythmbox gets this event, scans the database for
all entries with the physical location attribute, and tags them as
temporarily unavailable.

a device is inserted: rhythmbox gets this event, scans the database for
temporarily unavailable entries with a matching physical location
attribute, and makes them available.

how to let the user know that a file is unavailable: A new source is
added
that shows unavailable files. With this the user could also remove
files from the database, in the case that the physical device will never
be returning.

How can this be implemented in a portable way?

Hal can be used to get the device's serial number and partition number.
Hal can also be used to notify rhythmbox when a device is inserted
or removed.

What about things file-systems like NFS?
the physical location attribute could be the NFS address or some other
unique identifier.

What do people think about this approach?

John




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]