2011-03-01, 04:17
Hi there,
I am working on a little script to assist in learning Python that will look at a directory and check the XBMC database to see if there are any files that are unscraped. I have everything done, the only issue I'm running into is that the file names coming from the XBMC database are not coming out cleanly. Here is the code that I'm using:
This all works just fine, except that the files end up looking like this:
(u'Happy Gilmore (1996) [DVDRip].avi',)
Whereas when I use the os.listdir() function, I get a nice clean file name like:
Happy Gilmore (1996) [DVDRip].avi
Does anybody know how I can get my file names out of the database more cleanly? Or how I can go about cleaning them up? I need them to come out identical to the os.listdir() function because I will ultimately be comparing the lists to look for unscraped files.
Take it easy on me, this is my first real use of Python!
I greatly appreciate any assistance you could offer
I am working on a little script to assist in learning Python that will look at a directory and check the XBMC database to see if there are any files that are unscraped. I have everything done, the only issue I'm running into is that the file names coming from the XBMC database are not coming out cleanly. Here is the code that I'm using:
Code:
database = sqlite3.connect('C:\\MyVideos34.db') #Copied here for testing
cursor = database.cursor()
cursor.execute('SELECT strFilename FROM files,movie WHERE files.idFile = movie.idFile')
datalist = []
for row in cursor:
datalist.append(row)
print datalist
This all works just fine, except that the files end up looking like this:
(u'Happy Gilmore (1996) [DVDRip].avi',)
Whereas when I use the os.listdir() function, I get a nice clean file name like:
Happy Gilmore (1996) [DVDRip].avi
Does anybody know how I can get my file names out of the database more cleanly? Or how I can go about cleaning them up? I need them to come out identical to the os.listdir() function because I will ultimately be comparing the lists to look for unscraped files.
Take it easy on me, this is my first real use of Python!
I greatly appreciate any assistance you could offer