Skip to content

Python module that wraps libbluray to provide Python access to Bluray disc structure

Notifications You must be signed in to change notification settings

cmlburnett/PyBluRead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyBluRead -- A wrapper library around libbluray

This Python module wraps libbluray to provide Python access to BR structural information.
This does not fully wrap libbluray as my needs are not that extensive.

Please note that this module uses libbluray to directly access a DVD disc if the device path is provided.
This means that execution speed will depend on disc access, which can be slow. Just be aware of this.

---------
:Install:
---------

	python3 setup.py build
	python3 setup.py install
	
---------
:Windows:
---------

* Install the build tools for your version of Python - https://wiki.python.org/moin/WindowsCompilers
* Download and extract prebuilt static binaries of libbluray into deps/ - https://github.com/ShiftMediaProject/libbluray/releases 
* Edit the setup.py

	include_dirs = ['deps/include/libbluray'],
	libraries = ['bluray'],
	library_dirs=['deps/lib/x64'],

---------------
:Documentation:
---------------

Use Python's online help to get the documentation from the classes.

	$ python3
	>>> import bluread
	>>> help(bluread)

	class Bluray(_bluread.Bluray)
	 |  Entry object into parsing Bluray structure.
	 |  Pass the device path to the init function, and then call Open() to initiate reading.
	 |  Also, provide a path to KEYDB.cfg file if you feel so inclined (which is passed through libbluray as libbluray does not decrypt).
	 |  
	 |  A Bluray has titles.
	 |  A Title has chapters.
	 |  
	 |  Method resolution order:
	 |      Bluray
	 |      _bluread.Bluray
	 |      builtins.object
	.................


-------
:Usage:
-------

A simple script is needed to parse the structure of a BR:

	import bluread

	with bluread.Bluray("/dev/sr0") as b:
		b.Open(min_duration=30)

		print("Volume ID: %s" % b.VolumeId)
		print("Org ID: %s" % b.OrgId)
		print("Number of titles on disc: %d" % b.NumberOfTitles)

		for i in range(b.NumberOfTitles):
			t = b.GetTitle(i)

			# Filter out special features, etc.
			if t.Length < 300000000: continue

			print("Title %d has %d angles, %d chapters, %d clips, and runs for %s" % (i, t.NumberOfAngles, t.NumberOfChapters, t.NumberOfClips, t.LengthFancy))

Output:

	$ python3 foo.py
	bdplus_config.c:255: VM configuration not found
	bdplus.c:169: bdplus_init() failed! (0x24044e0)
	dec.c:239: bdplus_init() failed
	Volume ID: LIVE_FREE_DIE_HARD
	Org ID: 446973632
	Number of titles on disc: 67
	Title 0 has 1 angles, 37 chapters, 1 clips, and runs for 02:08:42.715
	Title 60 has 1 angles, 11 chapters, 11 clips, and runs for 01:37:15.729

--------------
:Organization:
--------------

This module contains two parts:
1) C implementation to wrap libbluray and provide basic PyObject types for use within Python
2) Python implementation to wrap PyObject types created in C

The C objects are defined within the /src/ directory and the Python objects in the /bluread/ directory. The C objects are defined in the _bluread module and the Python objects in the bluread module.

About

Python module that wraps libbluray to provide Python access to Bluray disc structure

Resources

Stars

Watchers

Forks

Packages

No packages published