pycdlib icon indicating copy to clipboard operation
pycdlib copied to clipboard

Iso label

Open atrdev-rgb opened this issue 6 years ago • 6 comments

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

atrdev-rgb avatar Jan 17 '20 15:01 atrdev-rgb

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?

clalancette avatar Jan 18 '20 21:01 clalancette

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 avatar Jan 19 '20 09:01 atrdev-rgb

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

atrdev-rgb avatar Feb 11 '20 17:02 atrdev-rgb

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.

clalancette avatar Feb 26 '20 13:02 clalancette

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

vtgdias avatar Mar 30 '22 22:03 vtgdias