clalancette / pycdlib

Python library to read and write ISOs
GNU Lesser General Public License v2.1
150 stars 38 forks source link

Iso label #40

Open atrdev-rgb opened 4 years ago

atrdev-rgb commented 4 years ago

How create udf image from python with pycdlib, and take him custom label (name of disk)?

clalancette commented 4 years ago

So, as of right now, pycdlib supports creating UDF images, but only in the "bridged" format along with ISO9660. That is, the resulting disc will be a hybrid UDF/ISO9660 ISO. I've been doing some ongoing work to allow pure UDF discs, but it isn't complete yet.

If you are OK with this limitation, then you should be able to do something like this:

import pycdlib
iso = pycdlib.PyCdlib()
iso.new(vol_ident='custom label', udf='2.60')
iso.add_file('local_filename', udf_path='filename_on_iso')
iso.add_directory(udf_path='dir_name_on_iso')
etc.
iso.write('output_file.iso')
iso.close()

Does this answer your question?

atrdev-rgb commented 4 years ago

after creating the image, when mounting it or recording it in the program, the name of the disc does not change, namely title "CDROM". vol_ident='custom label' not working

default vol_ident takes from:

class UDFFileSetDescriptor(object): def new(self): self.log_vol_ident = _ostaunicode_zero_pad('CDROM', 128)

and not change on custom

atrdev-rgb commented 4 years ago

Hi friend. so with a bug when creating udf. how to do with your disk name. i am install on python. pip install pycdlib

clalancette commented 4 years ago

Yeah, sorry, I see what you mean about this. Basically, we need to pass the vol_ident from the new() method down into the UDF creation stuff, and then set it as appropriate.

I'll put this on my list of things to do, but I may not get to it for a little while. If you open a pull request to do this, I'm happy to review it.

vtgdias commented 2 years ago

So, as of right now, pycdlib supports creating UDF images, but only in the "bridged" format along with ISO9660. That is, the resulting disc will be a hybrid UDF/ISO9660 ISO. I've been doing some ongoing work to allow pure UDF discs, but it isn't complete yet.

If you are OK with this limitation, then you should be able to do something like this:

import pycdlib
iso = pycdlib.PyCdlib()
iso.new(vol_ident='custom label', udf='2.60')
iso.add_file('local_filename', udf_path='filename_on_iso')
iso.add_directory(udf_path='dir_name_on_iso')
etc.
iso.write('output_file.iso')
iso.close()

Does this answer your question?

I am using the exact same code but could not make it work. Always show CDROM, no matter what.

self.iso = pycdlib.PyCdlib()
self.iso.new(vol_ident='Test', vol_set_ident='Test', udf='2.60')

I oppened the resulting iso image with windows (builtin mount) and with burnimg. BurnImg indicates me that the version of UDF i am using is 1.02 (not the one i set with udf='2.60'), this is because of the bridge?

I made my own function to add directories recursivelly but was wondering if there is a better way or maybe a flag to do that (i used os.walk).

tks in advance