Skip to content

Instantly share code, notes, and snippets.

@holtbp
Created September 26, 2011 19:30
Show Gist options
  • Save holtbp/1243165 to your computer and use it in GitHub Desktop.
Save holtbp/1243165 to your computer and use it in GitHub Desktop.
Turntable FM Cache File type converter
import os, glob, shutil, sys
path = os.environ['LOCALAPPDATA'] + "/Google/Chrome/User Data/Default/Cache/"
listing = os.listdir(path)
for infile in listing:
if "f_" in infile:
abs_path = path + infile
statinfo = os.stat(abs_path)
if statinfo.st_size > 1000000: #checking to see if the file > 1MB
print 'Checking ' + infile + ' | Name: ' + repr(statinfo.st_size) + ' | Size: ' + repr(statinfo.st_size)
print statinfo
if not "mp3" in infile:
newfile = abs_path + '.mp3'
print 'Renaming: ' + newfile
os.rename(abs_path, newfile)
abs_path = newfile
infile += ".mp3"
#TODO: Set this value for destination directory
dest = ""
if "mp3" in infile:
try:
shutil.move(abs_path, dest)
except:
print "Unexpected error:", sys.exc_info()[0]
@enormouspoon
Copy link

enormouspoon commented Mar 15, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment