Metadata-Version: 2.4
Name: pydvdid2
Version: 2.0.0
Summary: A pure Python implementation of the Windows API IDvdInfo2::GetDiscID method, as used by Windows Media Center to compute a 'practically unique' 64-bit CRC for metadata retrieval
Author-email: Sam Vervaeck <samvv@pm.me>, Steve Wood <octocat@nym.hush.com>
Maintainer-email: Sam Vervaeck <samvv@pm.me>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/samvv/pydvdid2
Project-URL: Bug Reports, https://github.com/samvv/pydvdid2/issues
Project-URL: Source, https://github.com/samvv/pydvdid2
Keywords: sample,setuptools,development
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Home Automation
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pycdlib>=1.10.0
Requires-Dist: python-dateutil>=2.8.1
Provides-Extra: dev
Requires-Dist: check-manifest; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

pydvdid2
========

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydvdid2?style=for-the-badge)](https://pypi.org/project/pydvdid2)
[![PyPI - Downloads](https://img.shields.io/pypi/dw/pydvdid2?style=for-the-badge)](https://pypi.org/project/pydvdid2)

## Overview

[_pydvdid2_][pydvdid2] is a continuation of the stale [pydvdid][pydvdid] Python
package. Just like its predecessor, this library is a pure Python
implementation of the Windows API [`IDvdInfo2::GetDiscID`][winmethod] method,
as used by Windows Media Center to compute a 'practically unique' 64-bit
[CRC][crc] for metadata retrieval.

[pydvdid2]: https://github.com/samvv/pydvdid2
[pydvdid]: https://github.com/sjwood/pydvdid
[winmethod]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd376453.aspx
[dvdid]: http://dvdid.cjkey.org.uk/
[crc]: https://en.wikipedia.org/wiki/Cyclic_redundancy_check

## Differences from `pydvdid`

 - Integrated [pull request #1][pull] by
   [rlaphoenix](https://github.com/rlaphoenix) in the original repo, making it
   possible to calculate the CRC64 without mounting the disk
 - Introduced a `pyproject.toml`
 - Dependencies have been updated
 - Typings have been added where possible
 - Fixed some logic error discovered during typing

[pull]: https://github.com/sjwood/pydvdid/pull/1

## Motivation

I needed a zero-knowledge way to recover some basic information about an
inserted DVD or a mounted ISO image, and whilst googling ran across
[dvdid][dvdid]. A compiled solution didn't fit with my requirement, so I
re-implemented it as a Python module. Kudos go to Christopher Key for
originally developing dvdid and documenting the algorithm so thoroughly.

pydvdid2 is envisaged to be useful for DVD ripping scripts, custom Growl
notifications, and media centre related home automation tasks.

## Compatibility

Works only with Python 3.

Support for Windows, Mac OS and Linux.

## Availability

Get it from PyPI or directly from GitHub.

### PyPI

|PyPI status|
|PyPI version|
|PyPI format|
|PyPI python versions|

```sh
pip install pydvdid2
```

### GitHub

Download a tagged version from the releases page, if available.

## Examples

### From the shell

```sh
$ crc64=$(pydvdid2 /dev/sr0)
$ echo $crc64
f8f9d45140065acc
$ curl --get https://1337server.pythonanywhere.com/api/v1/?mode=s&crc64=$crc64
{
  "mode": "search",
  "results": {
    "0": {
      "crc_id": "f8f9d45140065acc",
      "date_added": "2023-02-04 20:47:28.839849",
      "disctype": "None",
      "hasnicetitle": "True",
      "imdb_id": "tt0208092",
      "label": "SNATCH",
      "no_of_titles": "None",
      "poster_img": "None",
      "title": "Snatch",
      "tmdb_id": "None",
      "validated": "False",
      "video_type": "movie",
      "year": "2000"
    }
  },
  "success": true
}
```

### From Python

pydvdid2 has a decidely simple API, with the important bits imported into the package level so they can be conveniently imported directly from the package.


```python
>>> from pydvdid import compute
>>> crc64 = compute("/dev/sr0")  # or "E:" e.t.c
>>> str(crc64)
'f8f9d45140065acc'
>>> from urllib import urlopen
>>> urlopen(f"https://1337server.pythonanywhere.com/api/v1/?mode=s&crc64={crc64}").read()
{
  "mode": "search",
  "results": {
    "0": {
      "crc_id": "f8f9d45140065acc",
      "date_added": "2023-02-04 20:47:28.839849",
      "disctype": "None",
      "hasnicetitle": "True",
      "imdb_id": "tt0208092",
      "label": "SNATCH",
      "no_of_titles": "None",
      "poster_img": "None",
      "title": "Snatch",
      "tmdb_id": "None",
      "validated": "False",
      "video_type": "movie",
      "year": "2000"
    }
  },
  "success": true
}
```

## License

Apache License, Version 2.0
