Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kolanos committed May 11, 2012
0 parents commit 14d68ed
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
build
env
*.pyc
19 changes: 19 additions & 0 deletions README.md
@@ -0,0 +1,19 @@
DVD Fingerprint
===============

This is a Python implementation of the disc fingerprinting technique used by the
[Discident Database](http://discident.com/). Works by traversing a directory (from a
DVD drive or ripped) and creating a unique hash for that disc.

# Usage

Command line:

$ dvdfingerprint /Volumes/DVD_VIDEO/

From your own code:

import dvdfingerprint
dvdfingerprint.fingerprint("/Volumes/DVD_VIDEO/")

Adapted from Erik Kastner's Ruby implementation [dvd_fingerprint](https://github.com/kastner/dvd_fingerprint).
10 changes: 10 additions & 0 deletions bin/dvdfingerprint
@@ -0,0 +1,10 @@
#!/usr/bin/env python

import sys
import dvdfingerprint

if __name__ == "__main__":
if len(sys.argv) == 2:
print dvdfingerprint.fingerprint(sys.argv[1])
else:
print "Usage: dvdfingerprint <path>"
Binary file added dist/dvdfingerprint-0.1.0-py2.7.egg
Binary file not shown.
10 changes: 10 additions & 0 deletions dvdfingerprint.egg-info/PKG-INFO
@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: dvdfingerprint
Version: 0.1.0
Summary: DVD Fingerprint
Home-page: http://discident.com
Author: Michael Lavers
Author-email: kolanos@gmail.com
License: BSD
Description: UNKNOWN
Platform: UNKNOWN
7 changes: 7 additions & 0 deletions dvdfingerprint.egg-info/SOURCES.txt
@@ -0,0 +1,7 @@
setup.py
bin/dvdfingerprint
dvdfingerprint/__init__.py
dvdfingerprint.egg-info/PKG-INFO
dvdfingerprint.egg-info/SOURCES.txt
dvdfingerprint.egg-info/dependency_links.txt
dvdfingerprint.egg-info/top_level.txt
1 change: 1 addition & 0 deletions dvdfingerprint.egg-info/dependency_links.txt
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions dvdfingerprint.egg-info/top_level.txt
@@ -0,0 +1 @@
dvdfingerprint
34 changes: 34 additions & 0 deletions dvdfingerprint/__init__.py
@@ -0,0 +1,34 @@
import hashlib
import os
import sys

__VERSION__ = "0.1.0"


def generate_hash(s):
s = hashlib.md5(s).hexdigest().upper()
return "-".join([s[:8], s[8:12], s[12:16], s[16:20], s[20:]])


def get_paths(root_dir):
file_list = []
for root, subFolders, files in os.walk(root_dir):
for file in files:
f = os.path.join(root, file)
s = os.path.getsize(f)
f = f.replace(root_dir, '')
if not f.startswith('/'):
f = '/%s' % f
file_list.append("%s:%d" % (f, s))
return file_list


def combine_files(f):
f.sort()
return ":%s" % ":".join(f)


def fingerprint(path):
p = get_paths(path)
s = combine_files(p)
return generate_hash(s)
18 changes: 18 additions & 0 deletions setup.py
@@ -0,0 +1,18 @@
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

setup(
name='dvdfingerprint',
description='DVD Fingerprint',
author='Michael Lavers',
author_email='kolanos@gmail.com',
url='http://discident.com',
version='0.1.0',
license='BSD',
install_requires=[],
test_suite='',
packages=['dvdfingerprint'],
scripts=['bin/dvdfingerprint']
)
Empty file added tests/dvd/VIDEO_TS/VIDEO_TS.BUP
Empty file.
Empty file added tests/dvd/VIDEO_TS/VIDEO_TS.IFO
Empty file.
Empty file added tests/dvd/VIDEO_TS/VIDEO_TS.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_0.BUP
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_0.IFO
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_0.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_1.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_2.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_3.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_4.VOB
Empty file.
Empty file added tests/dvd/VIDEO_TS/VTS_01_5.VOB
Empty file.

0 comments on commit 14d68ed

Please sign in to comment.