rectifyer/script.trakt — pull request #107 by nate1280 (2013-04-25 16:54:45+00:00)
Title: Add script function to trigger a manual rating.

Added the ability to trigger a manual rating.

## Supported methods:

To rate the currently selected item:
```
RunScript(script.trakt,action=rate)
```

To rate a specific item:
```
RunScript(script.trakt,action=rate,media_type=,dbid=#)
```

## Information

Rating the currently selected item **only** works in the various video library views, so either Movies, or TV Shows.

Manual rating only works with library items, it will not work with non-library items and there is no plans to add this support.

The best way to do this is to add a custom mapping `RunScript(script.trakt,action=rate)` to your keyboard.xml. For example, in testing, I used the key V to trigger a manual rate.

I needed to make a change to the traktRequest call to support manual rating of tv shows, so this needs testing to make sure every other function still works. Of course, feedback is welcome.

I also had to update the language translation of string 1167, I probably got it completely wrong, but they needed %s in them for the changes to rating submission being more descriptive, otherwise it would crash. If I got it wrong, please just add a comment and I'll update them.

Lots of stuff done/moved/change, hoping I covered everything.

## Changes:

- Rename manual_sync.py to script.py
- Add a script function to trigger a manual rating from either a keypress association, or from within a skin.
- Can manually rate a movie, base tv show, or episode.
- Use, RunScript(script.trakt,action=rate) to trigger a manual rating.
- Check the type of media currently selected based on the currently visible container (movie, tvshow, season, episode).
- Allow overriding the media_type and ID for manual rating.
- Add error checking when getting data from XBMC
- Add setting to allow re-rating of media.
- Signal service thread with type of media and DB id of currently selected item to perform a manual rating.
- Add signaling check in service thread for manual rating.
- Clear properties used when calling manual functions, as to not re-trigger them if service crashes before clearing properties.
- Add isShow, getShowDetailsFromXBMC and isValidMediaType helper functions.
- Add supporting calls to traktapi class.
- Alter check for status/error fields in traktRequest, since show summary has a status field which is not success/failure, this caused an error.
- Rename getShowSummary to getEpisodeSummary
- Rename getTVShowSummary to getShowSummary
- Add season/episode to rating dialog, now shows - S##E## - .
- If media is already rated, and re-rating is not enabled, always show notification, even on a rate after a scrobble.
- Add ability to show notification that a show/episode/movie has already been rated.
- Make already rated notification more descriptive
- Make rating submission notification more descriptive
- Add new notification header string for ratings
- If re-rating media, set current rating as focus on dialog.
- Updated all translations of string 1167, they're probably wrong, but without %s would have caused a crash.