xboxscene.org forums

Author Topic: Auto Thumb Renamer  (Read 184 times)

Bomb Bloke

  • Archived User
  • Hero Member
  • *
  • Posts: 2398
Auto Thumb Renamer
« on: October 18, 2009, 10:54:00 PM »

This is just a silly little thing, but what the heck, someone might find it useful so I'm posting it.

A while back arnova was working on some special "patched builds" which, among other things, included an automatic video thumbnail generator for the Xbox builds (something other ports have had for a long time now).

Unfortunately he decided to scrap that feature, and thumbs those builds created can't be used with the main Xbox trunk because of the naming convention (they have the term "auto-" prefixed to their filenames).

Of course, I'm not about to give up my freshly gained thumbs in a hurry, but neither did I want to manually rename ~3000 files... Hence this script.  wink.gif

Simply put, you take any video thumbs generated with the old "patched" builds, shove them in the UserData of the build you actually want to use, and run this from your scripts folder. Auto-genned thumbs will have their names fixed, or if this would cause a naming conflict, they'll simply be removed.

AutoThumbRenamer.py

CODE
import os, xbmcgui

paths = '0123456789abcdef'

for i in range(0, 16):
    os.chdir("t:\\Thumbnails\\Video\\"+paths)
    
    for filename in os.listdir(os.getcwd()):
        if filename[0:5] == 'auto-':
            if os.path.exists(os.getcwd()+"\\"+filename[5:17]):
                os.remove(os.getcwd()+"\\"+filename)
            else:
                os.rename(os.getcwd()+"\\"+filename,os.getcwd()+"\\"+filename[5:17])

xbmcgui.Dialog().ok('Auto Thumb Renamer','All video thumbnails have been processed.')
Logged