diff options
Diffstat (limited to 'zx2c4support/thumblisting.py')
-rwxr-xr-x | zx2c4support/thumblisting.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/zx2c4support/thumblisting.py b/zx2c4support/thumblisting.py new file mode 100755 index 0000000..7524e9c --- /dev/null +++ b/zx2c4support/thumblisting.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- + +from ftplib import FTP +import os +import os.path + +print "Content-Type: text/plain" +print + +if not os.path.exists("framedcache"): + os.mkdir("framedcache") +ftp = FTP("ftp2.edgecastcdn.net") +ftp.login("chris@anyclip.com", "ChrisEdge1234") +for movie in ftp.nlst("thumbnails"): + movieCode = movie[movie.find("/") + 1:] + if os.path.exists("framedcache/%s" % movieCode): + cache = open("framedcache/%s" % movieCode, "r") + print movieCode, + print cache.read() + cache.close() + continue + biggest = -1 + for thumb in ftp.nlst(movie): + try: + timeCode = int(thumb[thumb.find("_") + 1:thumb.rfind("_")]) + except: + timeCode = -1 + if timeCode > biggest: + biggest = timeCode + if biggest > -1: + cache = open("framedcache/%s" % movieCode, "w") + cache.write(str(biggest)) + cache.close() + print movieCode, + print biggest
\ No newline at end of file |