示例#1
0
文件: default.py 项目: camster1/RTOTV
    def report(self):
        global setting
        ### log results and notify user
        # Download totals to log and to download report
        create_report(reportdata, download_counter, failed_items)

        # Build dialog messages
        summary = __localize__(32012) + ': %s ' % download_counter[
            'Total Artwork'] + __localize__(32020)
        summary_notify = ': %s ' % download_counter[
            'Total Artwork'] + __localize__(32020)
        provider_msg1 = __localize__(32001)
        provider_msg2 = __localize__(32184) + ' | ' + __localize__(
            32185) + ' | ' + __localize__(32186)
        # Close dialog in case it was open before doing a notification
        time.sleep(2)
        dialog_msg('close', background=setting['background'])
        # Some dialog checks
        if setting['notify']:
            log('Notify on finished/error enabled')
            setting['background'] = False
        if (xbmc.Player().isPlayingVideo() or startup['silent']
                or startup['mode'] in ['gui', 'customgui', 'custom']):
            log('Silent finish because of playing a video or silent mode')
            setting['background'] = True
        if not setting['failcount'] < setting['failthreshold']:
            log('Network error detected, script aborted', xbmc.LOGERROR)
            dialog_msg('okdialog',
                       line1=__localize__(32010),
                       line2=__localize__(32011),
                       background=setting['background'])
        if not xbmc.abortRequested:
            # Show dialog/notification
            if setting['background']:
                dialog_msg('okdialog',
                           line0=summary_notify,
                           line1=provider_msg1 + ' ' + provider_msg2,
                           background=setting['background'],
                           cancelled=cancelled)
            else:
                # When chosen no in the 'yes/no' dialog execute the viewer.py and parse 'downloadreport'
                if dialog_msg('yesno',
                              line1=summary,
                              line2=provider_msg1,
                              line3=provider_msg2,
                              background=setting['background'],
                              nolabel=__localize__(32027),
                              yeslabel=__localize__(32028)):
                    runcmd = os.path.join(__addonpath__, 'lib/viewer.py')
                    xbmc.executebuiltin('XBMC.RunScript (%s,%s) ' %
                                        (runcmd, 'downloadreport'))
        else:
            dialog_msg('okdialog',
                       line1=__localize__(32010),
                       line2=summary,
                       background=setting['background'])
        # Container refresh
        if startup['mode'] in ['gui', 'customgui']:
            if download_succes:
                xbmc.executebuiltin('Container.Refresh')
    def report(self):
        global setting
        ### log results and notify user
        # Download totals to log and to download report
        create_report(reportdata, download_counter, failed_items)

        # Build dialog messages
        summary = __localize__(32012) + ': %s ' % download_counter['Total Artwork'] + __localize__(32020)
        summary_notify = ': %s ' % download_counter['Total Artwork'] + __localize__(32020)
        provider_msg1 = __localize__(32001)
        provider_msg2 = __localize__(32184) + ' | ' + __localize__(32185) + ' | ' + __localize__(32186)
        # Close dialog in case it was open before doing a notification
        time.sleep(2)
        dialog_msg('close',
                   background = setting['background'])
        # Some dialog checks
        if setting['notify']:
            log('Notify on finished/error enabled')
            setting['background'] = False
        if (xbmc.Player().isPlayingVideo() or startup['silent'] or 
                                              startup['mode'] in ['gui', 'customgui', 'custom']):
            log('Silent finish because of playing a video or silent mode')
            setting['background'] = True
        if not setting['failcount'] < setting['failthreshold']:
            log('Network error detected, script aborted', xbmc.LOGERROR)
            dialog_msg('okdialog',
                       line1 = __localize__(32010),
                       line2 = __localize__(32011),
                       background = setting['background'])
        if not xbmc.abortRequested:
            # Show dialog/notification
            if setting['background']:
                dialog_msg('okdialog',
                           line0 = summary_notify,
                           line1 = provider_msg1 + ' ' + provider_msg2,
                           background = setting['background'],
                           cancelled = cancelled)
            else:
                # When chosen no in the 'yes/no' dialog execute the viewer.py and parse 'downloadreport'
                if dialog_msg('yesno',
                              line1 = summary,
                              line2 = provider_msg1,
                              line3 = provider_msg2,
                              background = setting['background'],
                              nolabel = __localize__(32027),
                              yeslabel = __localize__(32028)):
                    runcmd = os.path.join(__addonpath__, 'lib/viewer.py')
                    xbmc.executebuiltin('XBMC.RunScript (%s,%s) '%(runcmd, 'downloadreport'))
        else:
            dialog_msg('okdialog',
                       line1 = __localize__(32010),
                       line2 = summary,
                       background = setting['background'])
        # Container refresh
        if startup['mode'] in ['gui','customgui']:
            if download_succes:
                xbmc.executebuiltin('Container.Refresh')