dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
912 stars 115 forks source link

Crash because of lower key attribute #14

Closed SDERAWI closed 13 years ago

SDERAWI commented 13 years ago
Traceback (most recent call last):
  File "/usr/bin/tvnamer", line 9, in <module>
    load_entry_point('tvnamer==2.0', 'console_scripts', 'tvnamer')()
  File "/usr/lib/python2.7/site-packages/tvnamer/main.py", line 351, in main
    tvnamer(paths = sorted(args))
  File "/usr/lib/python2.7/site-packages/tvnamer/main.py", line 268, in tvnamer
    processFile(tvdb_instance, episode)
  File "/usr/lib/python2.7/site-packages/tvnamer/main.py", line 121, in processFile
    correctedSeriesName, epName = getEpisodeName(tvdb_instance, episode)
  File "/usr/lib/python2.7/site-packages/tvnamer/utils.py", line 52, in getEpisodeName
    show = tvdb_instance[episode.seriesname]
  File "/usr/lib/python2.7/site-packages/tvdb_api.py", line 772, in __getitem__
    key = key.lower() # make key lower case
AttributeError: 'NoneType' object has no attribute 'lower'
dbr commented 13 years ago

What was the filename you ran it on?

SDERAWI commented 13 years ago

Actually I ran it on a 2 Terabyte drive , so I don't know exactly which files cause a problem. Further more I did a "for i in ls ; do tvnamer -r * ; done" to make it go into each directory and the same crash occured in each directory.

SDERAWI commented 13 years ago

I accidenatally hit "Comment and Close" in the previous comment instead of just "Comment"

SDERAWI commented 13 years ago

I think one of the files is " /Seinfeld/S1E00 - The Pilot - Good News, Bad News.avi "

dbr commented 13 years ago

Ohh, that explains it! Running it on a file named S1E00 blah.avi causes the same error.

This is a bug - the regex's match filenames without a series name, for use in other applications, but tvnamer can't use such filenames usefully, so it should either skip them, or prompt for a series name (although I want to handle filenames-without-series-names in a better way, as prompting for a series name would be annoying with multiple files, and couldn't work in batch mode)

Will fix this soon, thanks for letting me know!