Skip to content

Commit

Permalink
use a common lib
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnKaijser committed Dec 21, 2013
1 parent af6339a commit e3e1583
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
18 changes: 11 additions & 7 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,21 @@
import datetime
import _strptime
import urllib
import lib.common

if sys.version_info < (2, 7):
import simplejson
else:
import json as simplejson

__addon__ = xbmcaddon.Addon()
__addonversion__ = __addon__.getAddonInfo('version')
__addonid__ = __addon__.getAddonInfo('id')
__addonname__ = __addon__.getAddonInfo('name')
__localize__ = __addon__.getLocalizedString
### get addon info
__addon__ = lib.common.__addon__
__addonid__ = lib.common.__addonid__
__addonname__ = lib.common.__addonname__
__addonpath__ = lib.common.__addonpath__
__addonprofile__ = lib.common.__addonprofile__
__localize__ = lib.common.__localize__
__version__ = lib.common.__version__

def log(txt):
message = '%s: %s' % (__addonname__, txt.encode('ascii', 'ignore'))
Expand Down Expand Up @@ -780,9 +784,9 @@ def onPlayBackStopped(self):
self.type = ""

if (__name__ == "__main__"):
log('script version %s started' % __addonversion__)
log('script version %s started' % __version__)
Main()
del Widgets_Monitor
del Widgets_Player
del Main
log('script version %s stopped' % __addonversion__)
log('script version %s stopped' % __version__)
1 change: 1 addition & 0 deletions lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from common import *
32 changes: 32 additions & 0 deletions lib/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2013 Martijn Kaijser
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import xbmc
import xbmcaddon

### get addon info
__addon__ = xbmcaddon.Addon(id='service.skin.widgets')
__addonid__ = __addon__.getAddonInfo('id')
__addonname__ = __addon__.getAddonInfo('name')
__author__ = __addon__.getAddonInfo('author')
__version__ = __addon__.getAddonInfo('version')
__addonpath__ = __addon__.getAddonInfo('path')
__addonprofile__= xbmc.translatePath(__addon__.getAddonInfo('profile')).decode('utf-8')
__icon__ = __addon__.getAddonInfo('icon')
__localize__ = __addon__.getLocalizedString

0 comments on commit e3e1583

Please sign in to comment.