def _validateExtension(ext, info):
    # use Kodi's supported media to check for valid extension or return default
    if info.get('media_type') == 'video':
        if ext not in xbmc.getSupportedMedia('video'):
            return 'mp4'
    elif info.get('media_type') == 'audio':
        if ext not in xbmc.getSupportedMedia('music'):
            return 'mp3'
    elif info.get('media_type') == 'image':
        if ext not in xbmc.getSupportedMedia('picture'):
            return 'jpg'
    return ext
Exemplo n.º 2
0
def supported_video_extensions():
    supported_video_extensions = xbmc.getSupportedMedia('video').split('|')
    unsupported = [
        '', '.url', '.bin', '.zip', '.rar', '.001', '.disc', '.7z', '.tar.gz',
        '.tar.bz2', '.tar.xz', '.tgz', '.tbz2', '.gz', '.bz2', '.xz', '.tar'
    ]
    return [i for i in supported_video_extensions if i not in unsupported]
Exemplo n.º 3
0
def supported_video_extensions():
    supported_video_extensions = xbmc.getSupportedMedia('video').split('|')
    return [i for i in supported_video_extensions if i != '' and i != '.zip']
Exemplo n.º 4
0
from contextlib    import contextmanager
from simplecache   import use_cache, SimpleCache
from kodi_six      import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs, py2_encode, py2_decode

# Plugin Info
ADDON_ID       = 'screensaver.videosaver'
REAL_SETTINGS  = xbmcaddon.Addon(id=ADDON_ID)
ADDON_NAME     = REAL_SETTINGS.getAddonInfo('name')
ADDON_VERSION  = REAL_SETTINGS.getAddonInfo('version')
ICON           = REAL_SETTINGS.getAddonInfo('icon')
ADDON_PATH     = REAL_SETTINGS.getAddonInfo('path')
SETTINGS_LOC   = REAL_SETTINGS.getAddonInfo('profile')
LANGUAGE       = REAL_SETTINGS.getLocalizedString

ACTION_STOP    = 13
MEDIA_EXTS     = (xbmc.getSupportedMedia('video')).split('|')
VIDEO_LIMIT    = int(REAL_SETTINGS.getSetting("VideoLimit"))
SINGLE_FLE     = int(REAL_SETTINGS.getSetting("VideoSource")) == 0
DEBUG          = REAL_SETTINGS.getSetting('Enable_Debugging') == 'true'
PLAYLIST_FLE   = REAL_SETTINGS.getSetting("VideoFile").endswith(('.xsp','.xml'))
RANDOM_PLAY    = REAL_SETTINGS.getSetting("VideoRandom") == "true"
KEYLOCK        = REAL_SETTINGS.getSetting("LockAction") == 'true'
DISABLE_TRAKT  = REAL_SETTINGS.getSetting("TraktDisable") == 'true'
VIDEO_FILE     = REAL_SETTINGS.getSetting("VideoFile")
VIDEO_PATH     = REAL_SETTINGS.getSetting("VideoFolder")

def log(msg, level=xbmc.LOGDEBUG):
    if DEBUG == False and level != xbmc.LOGERROR: return
    if level == xbmc.LOGERROR: '%s, %s'%(msg,traceback.format_exc())
    xbmc.log('%s-%s-%s'%(ADDON_ID,ADDON_VERSION,msg),level)
    
Exemplo n.º 5
0
SETTINGS_LOC        = REAL_SETTINGS.getAddonInfo('profile')
ADDON_PATH          = REAL_SETTINGS.getAddonInfo('path')
ADDON_VERSION       = REAL_SETTINGS.getAddonInfo('version')
ICON                = REAL_SETTINGS.getAddonInfo('icon')
FANART              = REAL_SETTINGS.getAddonInfo('fanart')
LANGUAGE            = REAL_SETTINGS.getLocalizedString

MY_MONITOR          = xbmc.Monitor()
MY_PLAYER           = xbmc.Player()

OVERLAY_FLE         = "%s.overlay.xml"%(ADDON_ID)
CHANNELFLE_DEFAULT  = os.path.join(ADDON_PATH,'channels.json')
GENREFLE_DEFAULT    = os.path.join(ADDON_PATH,'genres.xml')
SETTINGS_FLE        = os.path.join(SETTINGS_LOC,'settings.xml')
CHANGELOG_FLE       = os.path.join(ADDON_PATH,'changelog.txt')
VIDEO_EXTS          = xbmc.getSupportedMedia('video')
MUSIC_EXTS          = xbmc.getSupportedMedia('music')
IMAGE_EXTS          = xbmc.getSupportedMedia('picture')

IMAGE_LOC           = os.path.join(ADDON_PATH,'resources','images')
MEDIA_LOC           = os.path.join(ADDON_PATH,'resources','skins','default','media')
COLOR_LOGO          = os.path.join(MEDIA_LOC,'logo.png')
MONO_LOGO           = os.path.join(MEDIA_LOC,'wlogo.png')

PVR_CLIENT          = 'pvr.iptvsimple'
LANG                = 'en' #todo
DTFORMAT            = '%Y%m%d%H%M%S'
MAX_IMPORT          = 5
EPG_HRS             = 10800  # 3hr in seconds, Min. EPG guidedata
RADIO_ITEM_LIMIT    = 250
CLOCK_SEQ           = 70420
def _isValidMediaExtension(ext):
    # use Kodi's supported media to check for valid extension
    if ext in xbmc.getSupportedMedia('video') or ext in xbmc.getSupportedMedia(
            'music') or ext in xbmc.getSupportedMedia('picture'):
        return True
    return False
Exemplo n.º 7
0
# You should have received a copy of the GNU General Public License
# along with Video ScreenSaver.  If not, see <http://www.gnu.org/licenses/>.

import sys, traceback

from kodi_six import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs, py2_encode, py2_decode

# Plugin Info
ADDON_ID = 'screensaver.videosaver'
REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID)
ADDON_NAME = REAL_SETTINGS.getAddonInfo('name')
ADDON_VERSION = REAL_SETTINGS.getAddonInfo('version')
ICON = REAL_SETTINGS.getAddonInfo('icon')
FANART = REAL_SETTINGS.getAddonInfo('fanart')
LANGUAGE = REAL_SETTINGS.getLocalizedString
VIDEO_EXTS = xbmc.getSupportedMedia('video')


def selectDialog(list,
                 header=ADDON_NAME,
                 preselect=None,
                 useDetails=True,
                 autoclose=0,
                 multi=True):
    if multi == True:
        if preselect is None: preselect = []
        select = xbmcgui.Dialog().multiselect(header, list, autoclose,
                                              preselect, useDetails)
    else:
        if preselect is None: preselect = -1
        select = xbmcgui.Dialog().select(header, list, autoclose, preselect,