#!/usr/bin/env python2
import os
+import random
import re
import socket
import sys
# Now find all the recordings we have at the moment
cursor.execute("""
- SELECT title, subtitle, starttime, basename, watched FROM recorded
-""")
+ SELECT
+ title,
+ subtitle,
+ CONVERT_TZ(starttime, 'UTC', '%s') as starttime,
+ basename,
+ watched
+ FROM recorded
+""" % "Australia/Sydney")
for row in cursor:
title = row["title"]
starttime = str(row["starttime"]).replace(":", "-")
if not os.path.isfile(source):
continue
+ if os.path.isfile(dest):
+ dest = os.path.splitext(dest)[0] + ' - unique' + str(random.randint(1000, 9999)) + extn
+
dirnames = dest.split("/")[:-1]
for i in xrange(1, len(dirnames)+1):
dirname = "/".join(dirnames[:i])
if not os.path.isdir(dirname):
os.mkdir(dirname)
- os.symlink(source, dest)
-
+ try:
+ os.symlink(source, dest)
+ except Exception, e:
+ print e, "--", source, "->", dest
+ sys.exit(1)