Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
frdfsnlght committed Dec 3, 2014
1 parent d089715 commit c69c0a4
Show file tree
Hide file tree
Showing 32 changed files with 780 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

# Images
*.png binary
*.jpg binary
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.px-state
*.py[co]
desktop.ini
Thumbs.db
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
KODI-SickRage
=====
Addon for SickRage.

## Features
- Manage shows (add/delete, review seasons/episodes)
- View upcoming episodes
- View download history
- View backlog
- View failed downloads
- Customizable date/time format

## Screenshots
[Main](http://imgur.com/EwPYPWW)<br>
[Shows](http://imgur.com/QJ5cH3T)<br>
[Episodes](http://imgur.com/YAMmx1h)<br>
[Upcoming](http://imgur.com/sWg8pXx)<br>
[History](http://imgur.com/9JHBfnO)<br>
[Backlog](http://imgur.com/zeyxAYe)

## Install
Coming soon.
46 changes: 46 additions & 0 deletions addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import resources.lib.util as util

# wrap this in a try/catch to catch broken API calls (can't connect, timeout, etc)

try:
if 'vf' in util.pluginArgs:
vf = util.pluginArgs['vf']
if vf == 'shows':
import resources.lib.shows as shows
shows.menu()
elif vf == 'upcoming':
import resources.lib.upcoming as upcoming
upcoming.menu()
elif vf == 'history':
import resources.lib.history as history
history.menu()
elif vf == 'backlog':
import resources.lib.backlog as backlog
backlog.menu()
elif vf == 'failed':
import resources.lib.failed as failed
failed.menu()
elif vf == 'seasons':
import resources.lib.seasons as seasons
seasons.menu()
elif vf == 'episodes':
import resources.lib.episodes as episodes
episodes.menu()
else:
util.log('invalid folder "' + vf + '"')
import resources.lib.main as main
main.menu()
elif 'action' in util.pluginArgs:
action = util.pluginArgs['action']
if action == 'showAdd':
import resources.lib.showAdd as showAdd
showAdd.action()
else:
util.log('invalid folder "' + vf + '"')
else:
import resources.lib.main as main
main.menu()

except IOError as ioe:
util.message('Error', '%s' % ioe)

17 changes: 17 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.program.sickrage"
name="SickRage"
version="1.0.0"
provider-name="frdfsnlght">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>SickRage integration into XBMC</summary>
<description>Provides the ability to control SickRage from within XBMC.</description>
<platform>all</platform>
</extension>
</addon>
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v1.0
Initial version

Binary file added icon-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy file to make this directory a package.
Binary file added resources/icons/downloaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/later.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/showAdd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/snatched.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/soon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/today.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy file to make this directory a package.
31 changes: 31 additions & 0 deletions resources/lib/backlog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import xbmcplugin
import xbmcgui
import urllib
import re

import util as util

def menu():
shows = util.api.getBacklog()
shows.sort(key = lambda show: re.sub(r'^(?i)(the)\s+', '', show['show_name']))

for show in shows:
url = util.getShowURL(show['indexerid'])
for ep in show['episodes']:
ep['show_name'] = show['show_name']
listItem = xbmcgui.ListItem(
label = util.formatEpisodeName(ep),
iconImage = util.getIcon('wanted' if ep['status'] == 3 else 'qual')
)
listItem.addContextMenuItems([
('Refresh list', util.getContextCommand('refresh'))
], True)
xbmcplugin.addDirectoryItem(
handle = util.pluginId,
url = url,
listitem = listItem,
isFolder = True
)

xbmcplugin.endOfDirectory(util.pluginId)

36 changes: 36 additions & 0 deletions resources/lib/episodes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import xbmcplugin
import xbmcgui
import urllib

import util as util

def menu():
showId = util.pluginArgs['id']
season = int(util.pluginArgs['season'])
episodes = util.api.getSeasons(showId, {'season': season})
episodeNums = episodes.keys()
episodeNums.sort(key = int)
thumbnailImage = util.api.getShowPoster(showId)

for episodeNum in episodeNums:
episode = episodes[episodeNum]

listItem = xbmcgui.ListItem(
label = episodeNum + '. ' + episode['status'] + ': ' + episode['name'],
thumbnailImage = thumbnailImage
)
listItem.addContextMenuItems([
('Set Episode Status', util.getContextCommand('episodeStatus', [showId, season, episodeNum])),
('Set Season Status', util.getContextCommand('seasonStatus', [showId, season])),
('Manual Search', util.getContextCommand('episodeSearch', [showId, season, episodeNum])),
('Refresh list', util.getContextCommand('refresh'))
], True)
xbmcplugin.addDirectoryItem(
handle = util.pluginId,
url = '',
listitem = listItem,
isFolder = False
)

xbmcplugin.endOfDirectory(util.pluginId)

27 changes: 27 additions & 0 deletions resources/lib/failed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import xbmcplugin
import xbmcgui
import urllib
import re

import util as util

def menu():
releases = util.api.getFailed()
releases.sort(key = lambda release: re.sub(r'^(?i)(the)\s+', '', release['release']))

for release in releases:
listItem = xbmcgui.ListItem(
label = str(release['release'])
)
listItem.addContextMenuItems([
('Refresh list', util.getContextCommand('refresh'))
], True)
xbmcplugin.addDirectoryItem(
handle = util.pluginId,
url = None,
listitem = listItem,
isFolder = False
)

xbmcplugin.endOfDirectory(util.pluginId)

37 changes: 37 additions & 0 deletions resources/lib/history.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import xbmcplugin
import xbmcgui
import urllib
import re

import util as util

def menu():
history = util.api.getHistory()
shows = {}

for show in history:
uId = str(show['tvdbid']) + '-' + str(show['season']) + '-' + str(show['episode'])
if (not uId in shows) or (show['status'] == 'Downloaded'):
shows[uId] = show

shows = shows.values()
shows.sort(key = lambda show: show['date'], reverse = True)

for show in shows:
url = util.getShowURL(show['tvdbid'])
listItem = xbmcgui.ListItem(
label = util.formatDateTime(show['date']) + ': ' + show['status'] + ' ' + util.formatEpisodeName(show),
iconImage = util.getIcon('downloaded' if show['status'] == 'Downloaded' else 'snatched')
#thumbnailImage = util.api.getShowPosterThumbnail(show['tvdbid'])
)
listItem.addContextMenuItems([
('Refresh list', util.getContextCommand('refresh'))
], True)
xbmcplugin.addDirectoryItem(
handle = util.pluginId,
url = url,
listitem = listItem,
isFolder = True
)

xbmcplugin.endOfDirectory(util.pluginId)
12 changes: 12 additions & 0 deletions resources/lib/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import xbmcplugin
import xbmcgui

import resources.lib.util as util

def menu():
util.xbmcAddDirectory('Shows', 'shows')
util.xbmcAddDirectory('Upcoming', 'upcoming')
util.xbmcAddDirectory('History', 'history')
util.xbmcAddDirectory('Backlog', 'backlog')
util.xbmcAddDirectory('Failed Downloads', 'failed')
util.xbmcEndDirectory()
3 changes: 3 additions & 0 deletions resources/lib/refresh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import xbmc

xbmc.executebuiltin('Container.Refresh')
34 changes: 34 additions & 0 deletions resources/lib/seasons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import xbmcplugin
import xbmcgui
import urllib

import util as util

def menu():
showId = util.pluginArgs['id']
seasons = util.api.getSeasonList(showId)
seasons.sort()
thumbnailImage = util.api.getShowPoster(showId)

for season in seasons:
url = util.pluginURL + '?' + urllib.urlencode({
'vf': 'episodes',
'id': showId,
'season': season
})
listItem = xbmcgui.ListItem(
label = ('Season ' + str(season)) if season > 0 else 'Extras',
thumbnailImage = thumbnailImage
)
listItem.addContextMenuItems([
('Refresh list', util.getContextCommand('refresh'))
], True)
xbmcplugin.addDirectoryItem(
handle = util.pluginId,
url = url,
listitem = listItem,
isFolder = True
)

xbmcplugin.endOfDirectory(util.pluginId)

Loading

0 comments on commit c69c0a4

Please sign in to comment.