Python xbmcgui.NOTIFICATION_ERROR Examples

The following are 29 code examples of xbmcgui.NOTIFICATION_ERROR(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcgui , or try the search function .
Example #1
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
def user_playlist_move_entry(playlist_id, entry_no, item_id):
    dialog = xbmcgui.Dialog()
    playlist = session.user.selectPlaylistDialog(headline=_T(30248), allowNew=True)
    if playlist and playlist.id <> playlist_id:
        session.show_busydialog(_T(30265), playlist.name)
        try:
            ok = session.user.add_playlist_entries(playlist=playlist, item_ids=[item_id])
            if ok:
                ok = session.user.remove_playlist_entry(playlist_id, entry_no=entry_no)
            else:
                dialog.notification(plugin.name, _T('API Call Failed'), xbmcgui.NOTIFICATION_ERROR)
        except Exception, e:
            log(str(e), level=xbmc.LOGERROR)
            traceback.print_exc()
        session.hide_busydialog()
        xbmc.executebuiltin('Container.Refresh()') 
Example #2
Source File: koditidal2.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
def get_album_json_thread(self):
        try:
            while not xbmc.Monitor().waitForAbort(timeout=0.01) and not self.abortAlbumThreads:
                try:
                    album_id = self.albumQueue.get_nowait()
                except:
                    break
                try:
                    self.get_album(album_id, withCache=False)
                except requests.HTTPError as e:
                    r = e.response
                    msg = _T(30505)
                    try:
                        msg = r.reason
                        msg = r.json().get('userMessage')
                    except:
                        pass
                    log('Error getting Album ID %s' % album_id, xbmc.LOGERROR)
                    if r.status_code == 429 and not self.abortAlbumThreads:
                        self.abortAlbumThreads = True
                        log('Too many requests. Aborting Workers ...', xbmc.LOGERROR)
                        self.albumQueue._init(9999)
                        xbmcgui.Dialog().notification(plugin.name, msg, xbmcgui.NOTIFICATION_ERROR)
        except Exception, e:
            traceback.print_exc() 
Example #3
Source File: default.py    From script.artwork.beef with MIT License 6 votes vote down vote up
def make_local():
    fileman = FileManager()
    def downloadforitem(mediaitem):
        try:
            fileman.downloadfor(mediaitem)
            newart = dict((k, v) for k, v in mediaitem.downloadedart.iteritems()
                if not v or not v.startswith('http'))
            for arttype in newart:
                # remove old URL from texture cache
                if mediaitem.art.get(arttype, '').startswith('http'):
                    quickjson.remove_texture_byurl(mediaitem.art[arttype])
            return newart
        except FileError as ex:
            mediaitem.error = ex.message
            log(ex.message, xbmc.LOGERROR)
            xbmcgui.Dialog().notification("Artwork Beef", ex.message, xbmcgui.NOTIFICATION_ERROR)
            return {}
    downloaded = runon_medialist(downloadforitem, L(M.MAKE_LOCAL), fg=True)
    xbmcgui.Dialog().ok("Artwork Beef", L(M.DOWNLOAD_COUNT).format(downloaded)
        + ' - {0:0.2f}MB'.format(fileman.size / 1000000.00)) 
Example #4
Source File: kodiui.py    From plugin.video.mediathekview with MIT License 6 votes vote down vote up
def show_notification(self, heading, message, icon=xbmcgui.NOTIFICATION_INFO, time=5000, sound=True):
        """
        Shows a notification to the user

        Args:
            heading(str|int): Heading text of the notification.
                Can be a string or a numerical id to a localized text.

            message(str|int): Text of the notification.
                Can be a string or a numerical id to a localized text.

            icon(id, optional): xbmc id of the icon. Can be `xbmcgui.NOTIFICATION_INFO`,
                `xbmcgui.NOTIFICATION_WARNING` or `xbmcgui.NOTIFICATION_ERROR`.
                Default is `xbmcgui.NOTIFICATION_INFO`

            time(int, optional): Number of milliseconds the notification stays
                visible. Default is 5000.

            sound(bool, optional): If `True` a sound is played. Default is `True`
        """
        heading = self.language(heading) if isinstance(
            heading, int) else heading
        message = self.language(message) if isinstance(
            message, int) else message
        xbmcgui.Dialog().notification(heading, message, icon, time, sound) 
Example #5
Source File: kodiui.py    From plugin.video.mediathekview with MIT License 6 votes vote down vote up
def show_error(self, heading, message, time=8000, sound=True):
        """
        Shows an error notification to the user

        Args:
            heading(str|int): Heading text of the notification.
                Can be a string or a numerical id to a localized text.

            message(str|int): Text of the notification.
                Can be a string or a numerical id to a localized text.

            time(int, optional): Number of milliseconds the notification stays
                visible. Default is 5000.

            sound(bool, optional): If `True` a sound is played. Default is `True`
        """
        self.show_notification(
            heading, message, xbmcgui.NOTIFICATION_ERROR, time, sound) 
Example #6
Source File: default.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def playList(url):
    song = music.getPlayList(url)[0]
    if len(song) == 5:
        play(*song)
    else:
        xbmcgui.Dialog().notification(url, song[0], xbmcgui.NOTIFICATION_ERROR) 
Example #7
Source File: platformtools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
    dialog = xbmcgui.Dialog()
    try:
        l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
        dialog.notification(heading, message, l_icono[icon], time, sound)
    except:
        dialog_ok(heading, message) 
Example #8
Source File: control.py    From script.module.openscrapers with GNU General Public License v3.0 5 votes vote down vote up
def notification(title=None, message=None, icon=None, time=3000, sound=False):
	if title == 'default' or title is None:
		title = addonName()
	heading = str(title)
	body = str(message)
	if icon is None or icon == '' or icon == 'default':
		icon = addonIcon()
	elif icon == 'INFO':
		icon = xbmcgui.NOTIFICATION_INFO
	elif icon == 'WARNING':
		icon = xbmcgui.NOTIFICATION_WARNING
	elif icon == 'ERROR':
		icon = xbmcgui.NOTIFICATION_ERROR
	dialog.notification(heading, body, icon, time, sound=sound) 
Example #9
Source File: addon.py    From plugin.audio.tidal2 with GNU General Public License v3.0 5 votes vote down vote up
def login():
    username = addon.getSetting('username')
    password = addon.getSetting('password')
    subscription_type = [SubscriptionType.hifi, SubscriptionType.premium][int('0' + addon.getSetting('subscription_type'))]

    if not username or not password:
        # Ask for username/password
        dialog = xbmcgui.Dialog()
        username = dialog.input(_T(30008), username)
        if not username:
            return
        password = dialog.input(_T(30009), option=xbmcgui.ALPHANUM_HIDE_INPUT)
        if not password:
            return
        selected = dialog.select(_T(30010), [SubscriptionType.hifi, SubscriptionType.premium])
        if selected < 0:
            return
        subscription_type = [SubscriptionType.hifi, SubscriptionType.premium][selected]

    ok = session.login(username, password, subscription_type)
    if ok and (not addon.getSetting('username') or not addon.getSetting('password')):
        # Ask about remembering username/password
        dialog = xbmcgui.Dialog()
        if dialog.yesno(plugin.name, _T(30209)):
            addon.setSetting('username', username)
            addon.setSetting('password', password)
        else:
            addon.setSetting('password', '')
    if not ok:
        xbmcgui.Dialog().notification(plugin.name, _T(30253) , icon=xbmcgui.NOTIFICATION_ERROR)
    xbmc.executebuiltin('Container.Refresh()') 
Example #10
Source File: config.py    From plugin.video.stalker with GNU General Public License v2.0 5 votes vote down vote up
def configSerialNumber(number):
	global go;
	
	send_serial = addon.getSetting('send_serial_' + number);
	custom_serial = addon.getSetting('custom_serial_' + number);
	serial_number = addon.getSetting('serial_number_' + number);
	device_id = addon.getSetting('device_id_' + number);
	device_id2 = addon.getSetting('device_id2_' + number);
	signature = addon.getSetting('signature_' + number);

	
	if send_serial != 'true':
		return None;
	
	elif send_serial == 'true' and custom_serial == 'false':
		return {'custom' : False};
		
	elif send_serial == 'true' and custom_serial == 'true':
	
		if serial_number == '' or device_id == '' or device_id2 == '' or signature == '':
			xbmcgui.Dialog().notification(addonname, 'Serial information is invalid.', xbmcgui.NOTIFICATION_ERROR );
			go=False;
			return None;
	
		return {'custom' : True, 'sn' : serial_number, 'device_id' : device_id, 'device_id2' : device_id2, 'signature' : signature};
		
	return None; 
Example #11
Source File: config.py    From plugin.video.stalker with GNU General Public License v2.0 5 votes vote down vote up
def configMac(number):
	global go;
	
	custom_mac = addon.getSetting('custom_mac_' + number);
	portal_mac = addon.getSetting('portal_mac_' + number);
	
	if custom_mac != 'true':
		portal_mac = '';
		
	elif not (custom_mac == 'true' and re.match("[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", portal_mac.lower()) != None):
		xbmcgui.Dialog().notification(addonname, 'Custom Mac ' + number + ' is Invalid.', xbmcgui.NOTIFICATION_ERROR );
		portal_mac = '';
		go=False;
		
	return portal_mac; 
Example #12
Source File: addon.py    From plugin.video.stalker with GNU General Public License v2.0 5 votes vote down vote up
def playLevel():
	
	dp = xbmcgui.DialogProgressBG();
	dp.create('IPTV', 'Loading ...');
	
	title 	= args['title'][0];
	cmd 	= args['cmd'][0];
	tmp 	= args['tmp'][0];
	genre_name 	= args['genre_name'][0];
	logo_url 	= args['logo_url'][0];
	
	
	try:
		if genre_name != 'VoD':
			url = load_channels.retriveUrl(portal['mac'], portal['url'], portal['serial'], cmd, tmp);
		else:
			url = load_channels.retriveVoD(portal['mac'], portal['url'], portal['serial'], cmd);

	
	except Exception as e:
		dp.close();
		xbmcgui.Dialog().notification(addonname, str(e), xbmcgui.NOTIFICATION_ERROR );
		return;
	
	dp.update(80);
	
	title = title.decode("utf-8");
	
	title += ' (' + portal['name'] + ')';
	
	li = xbmcgui.ListItem(title, iconImage=logo_url);
	li.setInfo('video', {'Title': title, 'Genre': genre_name});
	xbmc.Player().play(item=url, listitem=li);
	
	dp.update(100);
	
	dp.close(); 
Example #13
Source File: ipwww_common.py    From plugin.video.iplayerwww with GNU General Public License v2.0 5 votes vote down vote up
def InitialiseCookieJar():
    cookie_file = os.path.join(DIR_USERDATA,'iplayer.cookies')
    cj = cookielib.LWPCookieJar(cookie_file)
    if(os.path.exists(cookie_file)):
        try:
            cj.load(ignore_discard=True)
        except:
            xbmcgui.Dialog().notification(translation(30400), translation(30402), xbmcgui.NOTIFICATION_ERROR)
    return cj 
Example #14
Source File: webservice.py    From plugin.video.emby with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        import objects
        ''' Workaround for widgets only playback.
            Widgets start with a music playlist, this causes bugs in skin, etc.
            Create a new video playlist for the item and play it.
        '''
        xbmc.sleep(200) # Let Kodi catch up
        LOG.info("-->[ widget play ]")
        play = None

        xbmc.PlayList(xbmc.PLAYLIST_MUSIC).clear()
        xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
        objects.utils.enable_busy_dialog()

        try:
            server = self.params.get('server')

            if not server and not window('emby_online.bool'):
                dialog("notification", heading="{emby}", message=_(33146), icon=xbmcgui.NOTIFICATION_ERROR)

                raise Exception("NotConnected")

            play = objects.PlayStrm(self.params, server)
            play.play()

        except Exception as error:
            LOG.exception(error)
            objects.utils.disable_busy_dialog()
            xbmc.Player().stop() # mute failed playback pop up
            xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()        
        else:
            objects.utils.disable_busy_dialog()
            window('emby.play.widget.bool', True)
            play.start_playback()

        self.server.pending = []
        LOG.info("--<[ widget play ]") 
Example #15
Source File: control.py    From plugin.video.brplay with GNU General Public License v3.0 5 votes vote down vote up
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '':
        icon = addonIcon()
    elif icon == 'INFO':
        icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING':
        icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR':
        icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading=heading, message=message, icon=icon, time=time, sound=sound) 
Example #16
Source File: platformtools.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
def dialog_notification(heading, message, icon=0, time=5000, sound=True):
    dialog = xbmcgui.Dialog()
    try:
        l_icono = xbmcgui.NOTIFICATION_INFO, xbmcgui.NOTIFICATION_WARNING, xbmcgui.NOTIFICATION_ERROR
        dialog.notification(heading, message, l_icono[icon], time, sound)
    except:
        dialog_ok(heading, message) 
Example #17
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_login_failed_notify(self):
        """
        Shows notification that the login failed

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30008),
            message=self.get_local_string(string_id=30009),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog 
Example #18
Source File: artworkprocessor.py    From script.artwork.beef with MIT License 5 votes vote down vote up
def notify_warning(self, message, header=None, error=False):
        if settings.progressdisplay != PROGRESS_DISPLAY_NONE:
            header = "Artwork Beef: " + header if header else "Artwork Beef"
            xbmcgui.Dialog().notification(header, message,
                xbmcgui.NOTIFICATION_ERROR if error else xbmcgui.NOTIFICATION_WARNING) 
Example #19
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_request_error_notify(self):
        """
        Shows notification that a request error occured

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30051),
            message=self.get_local_string(string_id=30052),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog 
Example #20
Source File: control.py    From plugin.video.sparkle with GNU General Public License v3.0 5 votes vote down vote up
def infoDialog(message, heading=addonInfo('name'), icon='', time=3000, sound=False):
    if icon == '': icon = addonIcon()
    elif icon == 'INFO': icon = xbmcgui.NOTIFICATION_INFO
    elif icon == 'WARNING': icon = xbmcgui.NOTIFICATION_WARNING
    elif icon == 'ERROR': icon = xbmcgui.NOTIFICATION_ERROR
    dialog.notification(heading, message, icon, time, sound=sound) 
Example #21
Source File: addon.py    From Kodi with GNU Lesser General Public License v3.0 5 votes vote down vote up
def message_error(message):
        xbmcgui.Dialog().notification("Soap4.me", message, icon=xbmcgui.NOTIFICATION_ERROR, sound=False) 
Example #22
Source File: service.py    From plugin.video.sendtokodi with MIT License 5 votes vote down vote up
def showErrorNotification(message):
    xbmcgui.Dialog().notification("SendToKodi", message,
                                  xbmcgui.NOTIFICATION_ERROR, 5000)


# Get the plugin url in plugin:// notation. 
Example #23
Source File: Dialogs.py    From plugin.video.netflix with MIT License 5 votes vote down vote up
def show_invalid_pin_notify(self):
        """
        Shows notification that a wrong adult pin was given

        :returns: bool - Dialog shown
        """
        dlg = xbmcgui.Dialog()
        dialog = dlg.notification(
            heading=self.get_local_string(string_id=30006),
            message=self.get_local_string(string_id=30007),
            icon=xbmcgui.NOTIFICATION_ERROR,
            time=self.notify_time)
        return dialog 
Example #24
Source File: addon.py    From plugin.video.stalker with GNU General Public License v2.0 4 votes vote down vote up
def genreLevel():
	
	try:
		data = load_channels.getGenres(portal['mac'], portal['url'], portal['serial'], addondir);
		
	except Exception as e:
		xbmcgui.Dialog().notification(addonname, str(e), xbmcgui.NOTIFICATION_ERROR );
		
		return;

	data = data['genres'];
		
	url = build_url({
		'mode': 'vod', 
		'portal' : json.dumps(portal)
	});
			
	li = xbmcgui.ListItem('VoD', iconImage='DefaultVideo.png')
	xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True);
	
	
	for id, i in data.iteritems():

		title 	= i["title"];
		
		url = build_url({
			'mode': 'channels', 
			'genre_id': id, 
			'genre_name': title.title(), 
			'portal' : json.dumps(portal)
			});
			
		if id == '10':
			iconImage = 'OverlayLocked.png';
		else:
			iconImage = 'DefaultVideo.png';
			
		li = xbmcgui.ListItem(title.title(), iconImage=iconImage)
		xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True);
		

	xbmcplugin.endOfDirectory(addon_handle); 
Example #25
Source File: addon.py    From plugin.video.stalker with GNU General Public License v2.0 4 votes vote down vote up
def vodLevel():
	
	try:
		data = load_channels.getVoD(portal['mac'], portal['url'], portal['serial'], addondir);
		
	except Exception as e:
		xbmcgui.Dialog().notification(addonname, str(e), xbmcgui.NOTIFICATION_ERROR );
		return;
	
	
	data = data['vod'];
	
		
	for i in data:
		name 	= i["name"];
		cmd 	= i["cmd"];
		logo 	= i["logo"];
		
		
		if logo != '':
			logo_url = portal['url'] + logo;
		else:
			logo_url = 'DefaultVideo.png';
				
				
		url = build_url({
				'mode': 'play', 
				'cmd': cmd, 
				'tmp' : '0', 
				'title' : name.encode("utf-8"),
				'genre_name' : 'VoD',
				'logo_url' : logo_url, 
				'portal' : json.dumps(portal)
				});
			

		li = xbmcgui.ListItem(name, iconImage=logo_url, thumbnailImage=logo_url)
		li.setInfo(type='Video', infoLabels={ "Title": name })

		xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
	
	xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_UNSORTED);
	xbmcplugin.addSortMethod(addon_handle, xbmcplugin.SORT_METHOD_TITLE);
	xbmcplugin.endOfDirectory(addon_handle); 
Example #26
Source File: service.py    From xbmc-addons-chinese with GNU General Public License v2.0 4 votes vote down vote up
def Detail(id):
    try:
        os.makedirs(__temp__)
    except:
        pass

    token = __addon__.getSetting("customToken") or DEFAULT_TOKEN
    url = '%s/v1/sub/detail?id=%s&xbmc=1' % (API_BASE, id)
    r = sess.post(url, headers={'Authorization': 'Bearer %s' % token})
    result = r.json()
    if result['status']:
        dialog = xbmcgui.Dialog()
        if result['status'] == 30900 and token == DEFAULT_TOKEN:
            dialog.notification(__language__(32009), '',
                                xbmcgui.NOTIFICATION_INFO, 3000)
        else:
            dialog.notification(__language__(32010) + '(%d): %s' % (result['status'], result['errmsg']),
                                '', xbmcgui.NOTIFICATION_ERROR, 3000)
        return []
    sub = result['sub']['subs'][0]
    if 'filelist' not in sub or len(sub['filelist']) == 0:
        ext = os.path.splitext(sub['filename'])[1].lower()
        if ext not in SUBTYPE_EXT:
            r = sess.get(sub['url'])
            data = r.content
            return extractArchive(data)
        # single file, not archive
        url = sub['url']
    elif len(sub['filelist']) == 1:
        url = sub['filelist'][0]['url']
        ext = os.path.splitext(sub['filelist'][0]['f'])[1].lower()
    else:
        allfiles = CheckSubList([f["f"] for f in sub['filelist']])
        common_prefix = getCommon(allfiles)
        sel = xbmcgui.Dialog().select(__language__(32006), [
            f[len(common_prefix):].lstrip('.') for f in allfiles])
        if sel == -1:
            return []
        url = sub['filelist'][sel]['url']
        ext = os.path.splitext(sub['filelist'][sel]['f'])[1].lower()
    r = sess.get(url)
    # XXX: use unicode path may not work on some android devices
    filename = os.path.join(__temp__, "%x.ass" % (random.getrandbits(48)))
    with open(filename, "wb") as f:
        f.write(r.content)
    ChangeFileEndcoding(filename)
    return [filename] 
Example #27
Source File: artworkprocessor.py    From script.artwork.beef with MIT License 4 votes vote down vote up
def _manual_item_process(self, mediaitem, busy):
        self._process_item(mediaitem, True, False)
        busy.close()
        if mediaitem.availableart or mediaitem.forcedart:
            availableart = dict(mediaitem.availableart)
            if mediaitem.mediatype == mediatypes.TVSHOW and 'fanart' in availableart:
                # add unseasoned backdrops as manual-only options for each season fanart
                unseasoned_backdrops = [dict(art) for art in availableart['fanart'] if not art.get('hasseason')]
                if unseasoned_backdrops:
                    for season in mediaitem.seasons.keys():
                        key = 'season.{0}.fanart'.format(season)
                        if key in availableart:
                            availableart[key].extend(unseasoned_backdrops)
                        else:
                            availableart[key] = list(unseasoned_backdrops)
            if mediaitem.mediatype in (mediatypes.MOVIE, mediatypes.MOVIESET) and 'poster' in availableart:
                # add no-language posters from TMDB as manual-only options for 'keyart'
                nolang_posters = [dict(art) for art in availableart['poster'] if not art['language']]
                for art in nolang_posters:
                    if art['provider'].sort == 'themoviedb.org':
                        if 'keyart' not in availableart:
                            availableart['keyart'] = []
                        availableart['keyart'].append(art)
            tag_forcedandexisting_art(availableart, mediaitem.forcedart, mediaitem.art)
            selectedarttype, selectedart = prompt_for_artwork(mediaitem.mediatype, mediaitem.label,
                availableart, self.monitor)
            if selectedarttype and selectedarttype not in availableart:
                self.manual_id(mediaitem)
                return
            if selectedarttype and selectedart:
                if mediatypes.get_artinfo(mediaitem.mediatype, selectedarttype)['multiselect']:
                    selectedart = info.fill_multiart(mediaitem.art, selectedarttype, selectedart)
                else:
                    selectedart = {selectedarttype: selectedart}

                selectedart = get_simpledict_updates(mediaitem.art, selectedart)
                mediaitem.selectedart = selectedart
                toset = dict(selectedart)
                if settings.remove_deselected_files:
                    self.downloader.remove_deselected_files(mediaitem)
                if mediatypes.downloadanyartwork(mediaitem.mediatype):
                    try:
                        self.downloader.downloadfor(mediaitem, False)
                    except FileError as ex:
                        mediaitem.error = ex.message
                        log(ex.message, xbmc.LOGERROR)
                        xbmcgui.Dialog().notification("Artwork Beef", ex.message, xbmcgui.NOTIFICATION_ERROR)
                    toset.update(mediaitem.downloadedart)
                if toset:
                    mediaitem.updatedart = toset.keys()
                    add_art_to_library(mediaitem.mediatype, mediaitem.seasons, mediaitem.dbid, toset)
                self.cachelocal(mediaitem, toset)

                reporting.report_item(mediaitem, True, True, self.downloader.size)
                if not mediaitem.error:
                    notifycount(len(toset))
        else:
            xbmcgui.Dialog().notification(L(NOT_AVAILABLE_MESSAGE),
                L(SOMETHING_MISSING) + ' ' + L(FINAL_MESSAGE), '-', 8000)
        self.finish_run() 
Example #28
Source File: crunchyroll.py    From plugin.video.crunchyroll with GNU Affero General Public License v3.0 4 votes vote down vote up
def check_mode(args):
    """Run mode-specific functions
    """
    if hasattr(args, "mode"):
        mode = args.mode
    elif hasattr(args, "id"):
        # call from other plugin
        mode = "videoplay"
        args.url = "/media-" + args.id
    elif hasattr(args, "url"):
        # call from other plugin
        mode = "videoplay"
        args.url = args.url[26:]
    else:
        mode = None

    if not mode:
        showMainMenue(args)

    elif mode == "queue":
        controller.showQueue(args)
    elif mode == "search":
        controller.searchAnime(args)
    elif mode == "history":
        controller.showHistory(args)
    elif mode == "random":
        controller.showRandom(args)

    elif mode == "anime":
        showMainCategory(args, "anime")
    elif mode == "drama":
        showMainCategory(args, "drama")

    elif mode == "featured":
        controller.listSeries(args, "featured")
    elif mode == "popular":
        controller.listSeries(args, "popular")
    elif mode == "simulcast":
        controller.listSeries(args, "simulcast")
    elif mode == "updated":
        controller.listSeries(args, "updated")
    elif mode == "newest":
        controller.listSeries(args, "newest")
    elif mode == "alpha":
        controller.listSeries(args, "alpha")
    elif mode == "season":
        controller.listFilter(args, "season")
    elif mode == "genre":
        controller.listFilter(args, "genre")

    elif mode == "series":
        controller.viewSeries(args)
    elif mode == "episodes":
        controller.viewEpisodes(args)
    elif mode == "videoplay":
        controller.startplayback(args)
    else:
        # unkown mode
        xbmc.log("[PLUGIN] %s: Failed in check_mode '%s'" % (args._addonname, str(mode)), xbmc.LOGERROR)
        xbmcgui.Dialog().notification(args._addonname, args._addon.getLocalizedString(30061), xbmcgui.NOTIFICATION_ERROR)
        showMainMenue(args) 
Example #29
Source File: webservice.py    From plugin.video.emby with GNU General Public License v3.0 4 votes vote down vote up
def run(self):
        import objects
        ''' Workaround for playing folders only (context menu on a series/season folder > play)
            Due to plugin paths being returned within the strm, the entries are mislabelled.
            Queue items after the first item was setup and started playing via plugin above.
        '''
        xbmc.sleep(200) # Let Kodi catch up
        LOG.info("-->[ folder play ]")
        play = None
        position = 1 # play folder should always create a new playlist.

        while True:
            if not window('emby.playlist.plugin.bool'): # default.py wait for initial item to start up
                try:
                    try:
                        params = self.server.queue.get(timeout=0.01)
                    except Queue.Empty:
                        break

                    server = params.get('server')

                    if not server and not window('emby_online.bool'):
                        dialog("notification", heading="{emby}", message=_(33146), icon=xbmcgui.NOTIFICATION_ERROR)

                        raise Exception("NotConnected")

                    play = objects.PlayStrm(params, server)
                    position = play.play_folder(position)

                except Exception as error:
                    LOG.exception(error)

                    xbmc.Player().stop() # mute failed playback pop up
                    xbmc.PlayList(xbmc.PLAYLIST_VIDEO).clear()
                    self.server.queue.queue.clear()

                    break

                self.server.queue.task_done()

        self.server.threads.remove(self)
        self.server.pending = []
        LOG.info("--<[ folder play ]")