Beispiel #1
0
def strm_update():
    xbmc.executebuiltin('Notification(%s, %s, %d, %s)' %
                        (ADDON_NAME, "Updating!", itime, represent))
    try:
        #kodiDB.musicDatabase()
        if xbmcvfs.exists(MediaList_LOC) and len(thelist) > 0:
            listLen = len(thelist)
            for i in range(len(thelist)):
                cType, name, url = ((thelist[i]).strip().split('|', 2))
                # time.sleep(2) # delays for 2 seconds just to make sure Hodor can read the message
                #                        pDialog.update(j, ADDON_NAME + " Update: " + name.decode('utf-8'))
                try:
                    xbmc.executebuiltin('Notification(%s, %s, %d, %s)' %
                                        (name, " Items left: " + str(listLen),
                                         itime, represent))
                    create.fillPluginItems(url,
                                           strm=True,
                                           strm_name=name,
                                           strm_type=cType)
                    listLen -= 1
                except:  #
                    pass

            xbmc.executebuiltin('Notification(%s, %s, %d, %s)' %
                                (ADDON_NAME, "Next update in: " +
                                 Automatic_Update_Time + "h", 5000, represent))
    except IOError as (errno, strerror):
        print("I/O error({0}): {1}").format(errno, strerror)
Beispiel #2
0
def strm_update(selectedItems=None):
    try:
        if xbmcvfs.exists(MediaList_LOC):
            thelist = readMediaList(
            ) if selectedItems is None else selectedItems
            if len(thelist) > 0:
                dialogeBG = xbmcgui.DialogProgressBG()
                dialogeBG.create("OSMOSIS: ", 'Total Update-Progress:')

                listLen = len(thelist)
                step = j = 100 / listLen
                for entry in thelist:
                    splits = entry.strip().split('|')
                    cType, name, url = splits[0], splits[1], splits[2]

                    try:
                        plugin_id = re.search('%s([^\/\?]*)' % ("plugin:\/\/"),
                                              url)
                        if plugin_id:
                            module = moduleUtil.getModule(plugin_id.group(1))
                            if module and hasattr(module, 'update'):
                                url = module.update(name, url, 'video',
                                                    thelist)

                        dialogeBG.update(
                            j, "OSMOSIS total update process: ",
                            "Current Item: " +
                            name.replace('++RenamedTitle++', '') +
                            " Items left: " + str(listLen))
                        j += step

                        create.fillPluginItems(url,
                                               strm=True,
                                               strm_name=name,
                                               strm_type=cType)
                        listLen -= 1
                    except:
                        pass
                dialogeBG.close()
                xbmc.executebuiltin(
                    'Notification(%s, %s, %d, %s)' %
                    (ADDON_NAME, "Next update in: " + Automatic_Update_Time +
                     "h", 5000, represent))
    except IOError as (errno, strerror):
        print("I/O error({0}): {1}").format(errno, strerror)
Beispiel #3
0
 def strm_update():
     if xbmcvfs.exists(MediaList_LOC) and len(thelist) > 0:
         pDialog = xbmcgui.DialogProgressBG()
         pDialog.create(ADDON_NAME, "Updating")
         j = 100 / len(thelist)
             
         for i in range(len(thelist)):
                 cType , name, url = ((thelist[i]).strip().split('|', 2))
                 # time.sleep(2) # delays for 2 seconds just to make sure Hodor can read the message 
                 pDialog.update(j, ADDON_NAME + " Update: " + name.decode('utf-8')) 
                 try:
                     create.fillPluginItems(url, strm=True, strm_name=name, strm_type=cType)
                 except:  #
                     pass
                     
                 j = j + 100 / len(thelist)
                 
         pDialog.update(100, ADDON_NAME + " Update: Done") 
         pDialog.close()
         xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (ADDON_NAME, "Next update in: " + Automatic_Update_Time , itime, represent))
Beispiel #4
0
def strm_update():
    guIFix(False)
   
    #xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (ADDON_NAME, "Updating!" , itime, represent))
    try:
        #kodiDB.musicDatabase()
        if xbmcvfs.exists(MediaList_LOC):
            thelist = readMediaList()
            if len(thelist) > 0:
                dialogeBG = xbmcgui.DialogProgressBG()
                dialogeBG.create("OSMOSIS: " ,  'Total Update-Progress:')

                listLen = len(thelist)
                j = 100 / len(thelist)
                for i in range(len(thelist)):                     
                    cType , name, url = ((thelist[i]).strip().split('|', 2))
                    # time.sleep(2) # delays for 2 seconds just to make sure Hodor can read the message 
#                        pDialog.update(j, ADDON_NAME + " Update: " + name.decode('utf-8')) 
                    try:
                        r_pluginname = re.search('plugin:\/\/([^\/]*)', url)
                        if r_pluginname:
                            module = moduleUtil.getModule(r_pluginname.group(1))
                            if module and hasattr(module, 'update'):
                                url = module.update(name, url, 'video', thelist)

                        dialogeBG.update( j, "OSMOSIS total update process: " , "Current Item: " + name.replace('++RenamedTitle++','') + " Items left: " + str(listLen) )
                        j = j + 100 / len(thelist)
                        #xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (name, " Items left: " + str(listLen) , itime, represent))
                        create.fillPluginItems(url, strm=True, strm_name=name, strm_type=cType)
                        listLen -= 1
                    except:  #
                        pass
                dialogeBG.close()
                xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (ADDON_NAME, "Next update in: " + Automatic_Update_Time + "h" , 5000, represent))
    except IOError as (errno, strerror):
        print ("I/O error({0}): {1}").format(errno, strerror)
Beispiel #5
0
 elif mode == 1:
     create.fillPlugins(url)
     if not fileSys.writeTutList("select:Addon"):
         tutWin = [
             "Adding content to your library",
             "Here, you can select the Add-on: ",
             "The selected Add-on should provide Video/Music content in the right structure ",
             "Take a look at ++ Naming video files/TV shows ++ http://kodi.wiki/view/naming_video_files/TV_shows"
         ]
         dialoge.PopupWindow(tutWin)
     try:
         xbmcplugin.endOfDirectory(int(sys.argv[1]))
     except:
         pass
 elif mode == 2:
     create.fillPluginItems(url)
     try:
         xbmcplugin.endOfDirectory(int(sys.argv[1]))
     except:
         pass
 elif mode == 4:
     create.removeItemsFromMediaList('list')
 elif mode == 5:
     create.removeItemsFromMediaList('list')
 elif mode == 666:
     updateAll.strm_update()
 elif mode == 10:
     meta = ""
     # Split url to get tags
     purl = url.split('|')[0]
     utils.addon_log("setResolvedUrl")
Beispiel #6
0
 #createNFO.setNamePath(STRM_LOC + "\\TV-Shows(de)", 'The Walking Dead', STRM_LOC) 
 if mode == None:
     utils.addon_log("getSources")
     guiTools.getSources()
     try:
         xbmcplugin.endOfDirectory(int(sys.argv[1]))
     except:
         pass
 elif mode == 1:   
     create.fillPlugins(url)
     try:
         xbmcplugin.endOfDirectory(int(sys.argv[1]))
     except:
         pass
 elif mode == 2:
     create.fillPluginItems(url)
     try:
         xbmcplugin.endOfDirectory(int(sys.argv[1]))
     except:
         pass 
 elif mode == 4:
     create.removeItemsFromMediaList('list') 
 elif mode == 5:
     create.removeItemsFromMediaList('list') 
 elif mode == 10:
     meta = ""
     # Split url to get tags
     purl = url.split('|')[0]
     utils.addon_log("setResolvedUrl")
     item = xbmcgui.ListItem(path=url)
     # Gest infos from selectet media
Beispiel #7
0
def strm_update(selectedItems=None, actor=0):
    try:
        if xbmcvfs.exists(MediaList_LOC):
            thelist = selectedItems if selectedItems else readMediaList()
            if len(thelist) > 0:
                dialogeBG = xbmcgui.DialogProgressBG()
                dialogeBG.create("OSMOSIS: ", 'Total Update-Progress:')

                iUrls = 0
                splittedEntries = []
                for entry in thelist:
                    splits = entry.strip().split('|')
                    iUrls += len(splits[2].split('<next>'))
                    splittedEntries.append(splits)

                step = j = 100 / iUrls
                for splittedEntry in splittedEntries:
                    cType, name, url = splittedEntry[0], splittedEntry[
                        1], splittedEntry[2]

                    urls = url.split('<next>')
                    for url in urls:
                        try:
                            plugin_id = re.search('plugin:\/\/([^\/\?]*)', url)
                            if plugin_id:
                                module = moduleUtil.getModule(
                                    plugin_id.group(1))
                                if module and hasattr(module, 'update'):
                                    url = module.update(
                                        name, url, 'video',
                                        readMediaList()
                                        if selectedItems else thelist)

                            dialogeBG.update(
                                j, "OSMOSIS total update process: ",
                                "Current Item: %s Items left: %d" %
                                (stringUtils.getStrmname(name), iUrls))
                            j += step

                            create.fillPluginItems(url,
                                                   strm=True,
                                                   strm_name=name,
                                                   strm_type=cType)
                            iUrls -= 1
                        except:
                            pass

                dialogeBG.close()
                if actor == actor_update_periodictime:
                    xbmc.executebuiltin(
                        'Notification(%s, %s, %d, %s)' %
                        (addon.getAddonInfo('name'), "Next update in: " +
                         addon.getSetting('Automatic_Update_Time') + "h", 5000,
                         represent))
                elif actor == actor_update_fixtime:
                    next_run = addon.getSetting('update_time')[:5]
                    xbmc.executebuiltin(
                        'Notification(%s, %s, %d, %s)' %
                        (addon.getAddonInfo('name'),
                         "Next update: " + next_run + "h", 5000, represent))
    except IOError as (errno, strerror):
        print("I/O error({0}): {1}").format(errno, strerror)