mythtv-scripts/python/hash_videos.py
Raymond Wagner 0cef6ebbb5 Add two more scripts. One to hash any content with a hash of 'NULL',
and the other to remove any files with duplicate hashes.
(cherry picked from commit 71a489768c83b80b328fb3d0665bcbf3591fbccc)
2011-04-29 00:57:31 -04:00

25 lines
616 B
Python
Executable File

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#---------------------------
# Name: hash_videos.py
# Python Script
# Author: Raymond Wagner
# Purpose
# This script will regenerate the hash values associated with
# videos in the MythVideo database.
#---------------------------
from MythTV import Video
def print_aligned(left, right):
indent = 100 - len(left)
print left, indent*' ', right
for vid in Video.getAllEntries():
if vid.hash != 'NULL':
print_aligned(vid.filename, 'skipped')
continue
vid.hash = vid.getHash()
vid.update()
print_aligned(vid.filename, vid.hash)