On 01/19/14 13:53, Stephan Loescher wrote:
Would it be possible (as a new feature) to filter/search/sort for
recordings by recording-lifetime and/or if it is SD or HD?
I had the same problem (long time ago).
As a simple solution, I wrote a small python script
that creates folders with "virtual" recordings
(symbolic links to the real recordings).
The tool creates /video/Surround, /video/HD
and /video/Surround+HD. Inside each of them
there is the same subfolder structure as under
/video, except that they contain only the corresponding
subset.
Here is the source:
import os
import shutil
import sys
video_dir = "/video"
def linkto(root, name):
components = []
for root_component in root.split('/')[2:]:
components.append(root_component)
if root_component.startswith('%'):
break
source = os.path.join(video_dir, '/'.join(components))
target = os.path.join(video_dir, name, '/'.join(components))
target_parent = os.path.join(video_dir, name, '/'.join(components[:-1]))
if not os.path.exists(target_parent):
os.makedirs(target_parent)
os.symlink(source, target)
for subdir in ("Surround", "HD", "Surround+HD"):
path = os.path.join(video_dir, subdir)
if os.path.exists(path):
shutil.rmtree(path)
os.mkdir(path)
surround_dirs = []
hd_dirs = []
surround_hd_dirs = []
for root, dummy_dirs, files in os.walk(video_dir, followlinks=True):
if '%' in root and ("info" in files or "info.vdr" in files):
surround = False
hd = False
for line in open(os.path.join(root, "info" if "info" in files else "info.vdr")):
if line.startswith("X "):
if " 5.1" in line:
surround = True
elif "high definition Video" in line:
hd = True
if surround:
surround_dirs.append(root)
if hd:
hd_dirs.append(root)
if surround and hd:
surround_hd_dirs.append(root)
for root in surround_dirs:
linkto(root, "Surround")
for root in hd_dirs:
linkto(root, "HD")
for root in surround_hd_dirs:
linkto(root, "Surround+HD")
Cheers, Carsten.
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr