rectifyer/script.trakt — pull request #99 by nate1280 (2013-04-14 16:17:08+00:00)
Title: Few fixes in sync

Fix for a bug posted by Martijn on XBMC forums, and also a couple of other tweaks.

The culprit for the bug was the following entry in watched.json data.

```
{
"title": null,
"year": 0,
"imdb_id": null,
"tvdb_id": null,
"tvrage_id": null,
"seasons": [
{
"season": 1,
"episodes": [1,2,3]
}
]
}
```

Of course, needs testing (and feedback), and should be merged beforre 2.2.0 is made public.

Changes done:

- Handle NoneType for tvdb_id and imdb_id for tv shows (like done for movies).
- Default to empty string if tvdb_id, tmdb_id are None, instead of 0.
- Change findMovie to use isdigit() instead of > 0.
- Add title and year to findMovie, findShow search.
- Cleanup traktLoadShows, remove watched array update from initial loop, and move it to 2nd loop, like how traktLoadMovies does it, saw 50% speed improvement (on a fast machine, did not test on other).
- Rewrite findInList to use named optional arguments, this allows for multiple fields to be compared now.
- Add case sensitive option to findInList, defaults to True.
- Fix typo in debug entry.