Skip to main content

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

Project description

pydvdid2

PyPI - Python Version PyPI - Downloads

Overview

pydvdid2 is a continuation of the stale pydvdid Python package. Just like its predecessor, this library is 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.

Differences from pydvdid

  • Integrated pull request #1 by 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

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. 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|

pip install pydvdid2

GitHub

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

Examples

From the shell

$ 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.

>>> 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydvdid2-2.0.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydvdid2-2.0.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pydvdid2-2.0.0.tar.gz.

File metadata

  • Download URL: pydvdid2-2.0.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pydvdid2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ae73fd0b4df31b46855d0aa799a22abb825c77ee5e2615be33748237f79015f9
MD5 08c42dea2c93307fb2ffe9e2da649da5
BLAKE2b-256 4fa2bfb5d59c83b8d71318d66ee199dce505bee097fefa388a4759138cbc0949

See more details on using hashes here.

File details

Details for the file pydvdid2-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydvdid2-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for pydvdid2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be5ac55d34be114197806aa186a7e500928c2be0a8d852e1cf1dce23aea88cd8
MD5 8462a63ec6e874858975d94584370295
BLAKE2b-256 691bd6a34528a3998848c130feb7b36726f1dc6bb4b46641ae3417ffa68a2454

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page