1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2025-12-17 19:40:21 +01:00
Files
pygtktalog/deviceHelper.py
gryf e980ebb97c * Rename appllication into pyGTKtalog.
* Added new files to the project.
2006-11-25 08:23:25 +00:00

29 lines
532 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
device (cd, dvd) helper
"""
import string
import os
def volname(dev):
"""read volume name from cd/dvd"""
try:
a = open(dev,"rb")
a.seek(32808)
b = a.read(32).strip()
a.close()
except:
return None
return b
def volmount(dev):
"""mount device, return True/False"""
stout,stin,sterr = popen3("mount %s" % dev)
error = sterr.readline()
stout.close()
stin.close()
sterr.close()
return len(error) == 0