Exemplo n.º 1
0
    def test_pretty_file_size(self):
        tests = {
            None: '',
            '': '',
            u'': '',
            '1024': '1.00 KB',
            u'1024': '1.00 KB',
            '1024.5': '',
            u'1024.5': '',
            -42.5: '-42.50 B',
            -42: '-42.00 B',
            0: '0.00 B',
            25: '25.00 B',
            25.5: '25.50 B',
            2 ** 10: '1.00 KB',
            50 * 2 ** 10 + 25: '50.02 KB',
            2 ** 20: '1.00 MB',
            100 * 2 ** 20 + 50 * 2 ** 10 + 25: '100.05 MB',
            2 ** 30: '1.00 GB',
            200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '200.10 GB',
            2 ** 40: '1.00 TB',
            400 * 2 ** 40 + 200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '400.20 TB',
            2 ** 50: '1.00 PB',
            800 * 2 ** 50 + 400 * 2 ** 40 + 200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '800.39 PB',
            2 ** 60: 2 ** 60,
        }

        for (size, result) in tests.iteritems():
            self.assertEqual(pretty_file_size(size), result)
Exemplo n.º 2
0
    def test_pretty_file_size(self):
        """
        Test pretty file size
        """
        test_cases = {
            None:
            '0.00 B',
            '':
            '0.00 B',
            '1024':
            '1.00 KB',
            '1024.5':
            '1.00 KB',
            -42.5:
            '0.00 B',
            -42:
            '0.00 B',
            0:
            '0.00 B',
            25:
            '25.00 B',
            25.5:
            '25.50 B',
            2**10:
            '1.00 KB',
            50 * 2**10 + 25:
            '50.02 KB',
            2**20:
            '1.00 MB',
            100 * 2**20 + 50 * 2**10 + 25:
            '100.05 MB',
            2**30:
            '1.00 GB',
            200 * 2**30 + 100 * 2**20 + 50 * 2**10 + 25:
            '200.10 GB',
            2**40:
            '1.00 TB',
            400 * 2**40 + 200 * 2**30 + 100 * 2**20 + 50 * 2**10 + 25:
            '400.20 TB',
            2**50:
            '1.00 PB',
            800 * 2**50 + 400 * 2**40 + 200 * 2**30 + 100 * 2**20 + 50 * 2**10 + 25:
            '800.39 PB',
            2**60:
            2**60,
        }

        unicode_test_cases = {
            '': '0.00 B',
            '1024': '1.00 KB',
            '1024.5': '1.00 KB',
        }

        for tests in test_cases, unicode_test_cases:
            for (size, result) in six.iteritems(tests):
                self.assertEqual(pretty_file_size(size), result)
Exemplo n.º 3
0
    def test_pretty_file_size(self):
        """
        Test pretty file size
        """
        test_cases = {
            None: '0.00 B',
            '': '0.00 B',
            '1024': '1.00 KB',
            '1024.5': '1.00 KB',
            -42.5: '0.00 B',
            -42: '0.00 B',
            0: '0.00 B',
            25: '25.00 B',
            25.5: '25.50 B',
            2 ** 10: '1.00 KB',
            50 * 2 ** 10 + 25: '50.02 KB',
            2 ** 20: '1.00 MB',
            100 * 2 ** 20 + 50 * 2 ** 10 + 25: '100.05 MB',
            2 ** 30: '1.00 GB',
            200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '200.10 GB',
            2 ** 40: '1.00 TB',
            400 * 2 ** 40 + 200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '400.20 TB',
            2 ** 50: '1.00 PB',
            800 * 2 ** 50 + 400 * 2 ** 40 + 200 * 2 ** 30 + 100 * 2 ** 20 + 50 * 2 ** 10 + 25: '800.39 PB',
            2 ** 60: 2 ** 60,
        }

        unicode_test_cases = {
            u'': '0.00 B',
            u'1024': '1.00 KB',
            u'1024.5': '1.00 KB',
        }

        for tests in test_cases, unicode_test_cases:
            for (size, result) in iteritems(tests):
                self.assertEqual(pretty_file_size(size), result)
Exemplo n.º 4
0
def render_body(context, curListType, myShowList, **pageargs):
    __M_caller = context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(curListType=curListType,
                                      pageargs=pageargs,
                                      myShowList=myShowList)
        _import_ns = {}
        _mako_get_namespace(context, '__anon_0x7f617e93e310')._populate(
            _import_ns, [u'renderQualityPill'])
        show_stat = _import_ns.get('show_stat',
                                   context.get('show_stat', UNDEFINED))
        renderQualityPill = _import_ns.get(
            'renderQualityPill', context.get('renderQualityPill', UNDEFINED))
        static_url = _import_ns.get('static_url',
                                    context.get('static_url', UNDEFINED))
        bool = _import_ns.get('bool', context.get('bool', UNDEFINED))
        srRoot = _import_ns.get('srRoot', context.get('srRoot', UNDEFINED))
        str = _import_ns.get('str', context.get('str', UNDEFINED))
        ValueError = _import_ns.get('ValueError',
                                    context.get('ValueError', UNDEFINED))
        _ = _import_ns.get('_', context.get('_', UNDEFINED))
        __M_writer = context.writer()
        __M_writer(u'\n')
        __M_writer(u'\n')
        __M_writer(u'\n\n')
        if sickbeard.HOME_LAYOUT == 'poster':
            __M_writer(u'    <div id="')
            __M_writer(
                unicode(
                    ('container', 'container-anime')[curListType == 'Anime']))
            __M_writer(
                u'" class="show-grid clearfix">\n        <div class="posterview">\n'
            )
            for curLoadingShow in sickbeard.showQueueScheduler.action.loading_show_list:
                __M_writer(u'                ')
                loading_show = curLoadingShow.info

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['loading_show']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer(
                    u'\n                <div class="show-container" data-name="'
                )
                __M_writer(unicode(loading_show.sort_name))
                __M_writer(
                    u'" data-date="1" data-network="0" data-progress="0">\n                    <div class="show-image">\n                        <img alt="" title="'
                )
                __M_writer(unicode(loading_show.name))
                __M_writer(
                    u'" class="show-image" style="border-bottom: 1px solid #111;" src="" data-src="'
                )
                __M_writer(unicode(srRoot))
                __M_writer(u'/showPoster/?show=')
                __M_writer(filters.url_escape(unicode(loading_show.id)))
                __M_writer(
                    u'&amp;which=poster_thumb" />\n                    </div>\n                    <div class="show-information">\n                        <div class="progressbar hidden-print" style="position:relative;" data-show-id="'
                )
                __M_writer(filters.url_escape(unicode(loading_show.id)))
                __M_writer(
                    u'" data-progress-percentage="0"></div>\n                        <div class="show-title">'
                )
                __M_writer(unicode(_('Loading')))
                __M_writer(u' (')
                __M_writer(unicode(loading_show.name))
                __M_writer(
                    u')</div>\n                        <div class="show-date">&nbsp;</div>\n                        <div class="show-details">\n                            <table class="show-details" width="100%" cellspacing="1" border="0" cellpadding="0">\n                                <tr>\n                                    <td class="show-table">\n                                        <span class="show-dlstats" title="'
                )
                __M_writer(unicode('Loading'))
                __M_writer(u'">')
                __M_writer(unicode('Loading'))
                __M_writer(
                    u'</span>\n                                    </td>\n                                    <td class="show-table">\n                                        <span title="'
                )
                __M_writer(unicode(loading_show.network))
                __M_writer(
                    u'"><img class="show-network-image" src="" data-src="')
                __M_writer(unicode(srRoot))
                __M_writer(u'/showPoster/?show=')
                __M_writer(filters.url_escape(unicode(loading_show.id)))
                __M_writer(u'&amp;which=network" alt="')
                __M_writer(unicode(loading_show.network))
                __M_writer(u'" title="')
                __M_writer(unicode(loading_show.network))
                __M_writer(
                    u'" /></span>\n                                    </td>\n                                    <td class="show-table">\n                                        '
                )
                __M_writer(
                    unicode(
                        renderQualityPill(loading_show.quality,
                                          showTitle=True,
                                          overrideClass="show-quality")))
                __M_writer(
                    u'\n                                    </td>\n                                </tr>\n                            </table>\n                        </div>\n                    </div>\n                </div>\n'
                )
            for curShow in myShowList:
                __M_writer(u'                ')

                if sickbeard.showQueueScheduler.action.is_in_remove_queue(
                        curShow
                ) or sickbeard.showQueueScheduler.action.is_being_removed(
                        curShow):
                    continue

                cur_airs_next = ''
                cur_snatched = 0
                cur_downloaded = 0
                cur_total = 0
                download_stat_tip = ''
                display_status = curShow.status

                if display_status:
                    if re.search(r'(?i)(?:new|returning)\s*series',
                                 curShow.status):
                        display_status = 'Continuing'
                    elif re.search(r'(?i)(?:nded)', curShow.status):
                        display_status = 'Ended'

                if curShow.indexerid in show_stat:
                    cur_airs_next = show_stat[
                        curShow.indexerid]['ep_airs_next']

                    cur_snatched = show_stat[
                        curShow.indexerid]['ep_snatched'] or 0
                    cur_downloaded = show_stat[
                        curShow.indexerid]['ep_downloaded'] or 0
                    cur_total = show_stat[curShow.indexerid]['ep_total'] or 0

                download_stat = str(cur_downloaded)
                download_stat_tip = _('Downloaded') + ": " + str(
                    cur_downloaded)

                if cur_snatched:
                    download_stat = download_stat + "+" + str(cur_snatched)
                    download_stat_tip = download_stat_tip + "&#013;" + _(
                        'Snatched') + ": " + str(cur_snatched)

                download_stat = download_stat + " / " + str(cur_total)
                download_stat_tip = download_stat_tip + "&#013;" + _(
                    'Total') + ": " + str(cur_total)

                nom = cur_downloaded
                if cur_total:
                    den = cur_total
                else:
                    den = 1
                    download_stat_tip = _('Unaired')

                progressbar_percent = nom * 100 / den

                data_date = '6000000000.0'
                if cur_airs_next:
                    data_date = calendar.timegm(
                        sbdatetime.sbdatetime.convert_to_setting(
                            network_timezones.parse_date_time(
                                cur_airs_next, curShow.airs,
                                curShow.network)).timetuple())
                elif display_status:
                    if display_status != 'Ended' and curShow.paused:
                        data_date = '5000000500.0'
                    elif display_status == 'Continuing':
                        data_date = '5000000000.0'
                    elif display_status == 'Ended':
                        data_date = '5000000100.0'

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in [
                            'nom', 'cur_downloaded', 'display_status',
                            'cur_total', 'cur_snatched', 'progressbar_percent',
                            'cur_airs_next', 'den', 'download_stat',
                            'data_date', 'download_stat_tip'
                        ] if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer(
                    u'\n                <div class="show-container" id="show')
                __M_writer(unicode(curShow.indexerid))
                __M_writer(u'" data-name="')
                __M_writer(unicode(curShow.sort_name))
                __M_writer(u'" data-date="')
                __M_writer(unicode(data_date))
                __M_writer(u'" data-network="')
                __M_writer(unicode(curShow.network))
                __M_writer(u'" data-progress="')
                __M_writer(unicode(progressbar_percent))
                __M_writer(
                    u'">\n                    <div class="show-image">\n                        <a href="'
                )
                __M_writer(unicode(srRoot))
                __M_writer(u'/home/displayShow?show=')
                __M_writer(unicode(curShow.indexerid))
                __M_writer(
                    u'"><img alt="" class="show-image" src="" data-src="')
                __M_writer(unicode(srRoot))
                __M_writer(u'/showPoster/?show=')
                __M_writer(unicode(curShow.indexerid))
                __M_writer(
                    u'&amp;which=poster_thumb" /></a>\n                    </div>\n\n                    <div class="show-information">\n                        <div class="progressbar hidden-print" style="position:relative;" data-show-id="'
                )
                __M_writer(unicode(curShow.indexerid))
                __M_writer(u'" data-progress-percentage="')
                __M_writer(unicode(progressbar_percent))
                __M_writer(
                    u'"></div>\n\n                        <div class="show-title">\n                            '
                )
                __M_writer(unicode(curShow.name))
                __M_writer(
                    u'\n                        </div>\n\n                        <div class="show-date">\n'
                )
                if cur_airs_next:
                    __M_writer(u'                            ')
                    ldatetime = sbdatetime.sbdatetime.convert_to_setting(
                        network_timezones.parse_date_time(
                            cur_airs_next, curShow.airs, curShow.network))

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in ['ldatetime']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    __M_writer(u'\n                            ')

                    try:
                        out = str(sbdatetime.sbdatetime.sbfdate(ldatetime))
                    except ValueError:
                        out = _('Invalid date')
                        pass

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in ['out']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    __M_writer(u'\n                            ')
                    __M_writer(unicode(out))
                    __M_writer(u'\n')
                else:
                    __M_writer(u'                            ')

                    output_html = '?'
                    display_status = curShow.status
                    if display_status:
                        if display_status != 'Ended' and curShow.paused:
                            output_html = 'Paused'
                        elif display_status:
                            output_html = display_status

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in ['display_status', 'output_html']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    __M_writer(u'\n                            ')
                    __M_writer(unicode(_(output_html)))
                    __M_writer(u'\n')
                __M_writer(
                    u'                        </div>\n\n                        <div class="show-details">\n                            <table class="show-details" width="100%" cellspacing="1" border="0" cellpadding="0">\n                                <tr>\n                                    <td class="show-table">\n                                        <span class="show-dlstats" title="'
                )
                __M_writer(unicode(download_stat_tip))
                __M_writer(u'">')
                __M_writer(unicode(download_stat))
                __M_writer(
                    u'</span>\n                                    </td>\n\n                                    <td class="show-table">\n'
                )
                if curShow.network:
                    __M_writer(
                        u'                                            <span title="'
                    )
                    __M_writer(unicode(curShow.network))
                    __M_writer(
                        u'"><img class="show-network-image" src="" data-src="')
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/showPoster/?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'&amp;which=network" alt="')
                    __M_writer(unicode(curShow.network))
                    __M_writer(u'" title="')
                    __M_writer(unicode(curShow.network))
                    __M_writer(u'" /></span>\n')
                else:
                    __M_writer(
                        u'                                            <span title="'
                    )
                    __M_writer(unicode(_('No Network')))
                    __M_writer(
                        u'"><img class="show-network-image" src="" data-src="')
                    __M_writer(
                        unicode(static_url('images/network/nonetwork.png')))
                    __M_writer(
                        u'" alt="No Network" title="No Network" /></span>\n')
                __M_writer(
                    u'                                    </td>\n                                    <td class="show-table">\n                                        '
                )
                __M_writer(
                    unicode(
                        renderQualityPill(curShow.quality,
                                          showTitle=True,
                                          overrideClass="show-quality")))
                __M_writer(
                    u'\n                                    </td>\n                                </tr>\n                            </table>\n                        </div>\n                    </div>\n                </div>\n'
                )
            __M_writer(u'        </div>\n    </div>\n')
        else:
            __M_writer(
                u'    <div class="horizontal-scroll">\n        <table id="showListTable'
            )
            __M_writer(unicode(curListType))
            __M_writer(
                u'" class="tablesorter" cellspacing="1" border="0" cellpadding="0">\n            <thead>\n                <tr>\n                    <th class="nowrap">'
            )
            __M_writer(unicode(_('Next Ep')))
            __M_writer(u'</th>\n                    <th class="nowrap">')
            __M_writer(unicode(_('Prev Ep')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Show')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Network')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Quality')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Downloads')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Size')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Active')))
            __M_writer(u'</th>\n                    <th>')
            __M_writer(unicode(_('Status')))
            __M_writer(
                u'</th>\n                </tr>\n            </thead>\n            <tfoot class="hidden-print">\n                <tr>\n                    <th rowspan="1" colspan="1" align="center"><a href="'
            )
            __M_writer(unicode(static_url("addShows/", include_version=False)))
            __M_writer(u'">')
            __M_writer(unicode(_('Add')))
            __M_writer(u' ')
            __M_writer(unicode(
                (_('Show'), _('Anime'))[curListType == 'Anime']))
            __M_writer(
                u'</a></th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                    <th>&nbsp;</th>\n                </tr>\n            </tfoot>\n            <tbody>\n'
            )
            for curLoadingShow in sickbeard.showQueueScheduler.action.loading_show_list:
                __M_writer(u'                    ')
                loading_show = curLoadingShow.info

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['loading_show']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer(
                    u'\n                    <tr>\n                        <td align="center">('
                )
                __M_writer(unicode(_('loading')))
                __M_writer(u')</td><td align="center"></td>\n')
                if sickbeard.HOME_LAYOUT == 'small':
                    __M_writer(
                        u'                            <td class="tvShow">\n                                <div class="imgsmallposter '
                    )
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'">\n')
                    if curLoadingShow.show:
                        __M_writer(
                            u'                                        <a href="'
                        )
                        __M_writer(unicode(srRoot))
                        __M_writer(u'/home/displayShow?show=')
                        __M_writer(filters.url_escape(unicode(
                            loading_show.id)))
                        __M_writer(u'" title="')
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u'">\n')
                    else:
                        __M_writer(
                            u'                                        <span title="'
                        )
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u'">\n')
                    __M_writer(
                        u'                                    <img src="" data-src="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/showPoster/?show=')
                    __M_writer(filters.url_escape(unicode(loading_show.id)))
                    __M_writer(u'&amp;which=poster_thumb" class="')
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'" alt="')
                    __M_writer(unicode(loading_show.name))
                    __M_writer(u'"/>\n')
                    if curLoadingShow.show:
                        __M_writer(
                            u'                                        </a>\n                                        <a href="'
                        )
                        __M_writer(unicode(srRoot))
                        __M_writer(u'/home/displayShow?show=')
                        __M_writer(filters.url_escape(unicode(
                            loading_show.id)))
                        __M_writer(u'" style="vertical-align: middle;">')
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u'</a>\n')
                    else:
                        __M_writer(
                            u'                                        </span>\n                                        <span style="vertical-align: middle;">'
                        )
                        __M_writer(unicode(_('Loading...')))
                        __M_writer(u' (')
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u')</span>\n')
                    __M_writer(
                        u'                                </div>\n                            </td>\n'
                    )
                elif sickbeard.HOME_LAYOUT == 'banner':
                    __M_writer(
                        u'                            <td>\n                                <span style="display: none;">'
                    )
                    __M_writer(unicode(_('Loading...')))
                    __M_writer(u' (')
                    __M_writer(unicode(loading_show.name))
                    __M_writer(
                        u')</span>\n                                <div class="imgbanner '
                    )
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'">\n')
                    if curLoadingShow.show:
                        __M_writer(
                            u'                                        <a href="'
                        )
                        __M_writer(unicode(srRoot))
                        __M_writer(u'/home/displayShow?show=')
                        __M_writer(filters.url_escape(unicode(
                            loading_show.id)))
                        __M_writer(u'">\n')
                    __M_writer(
                        u'                                    <img src="" data-src="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/showPoster/?show=')
                    __M_writer(filters.url_escape(unicode(loading_show.id)))
                    __M_writer(u'&amp;which=banner" class="')
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'" alt="')
                    __M_writer(unicode(loading_show.name))
                    __M_writer(u'" title="')
                    __M_writer(unicode(loading_show.name))
                    __M_writer(u'"/>\n')
                    if curLoadingShow.show:
                        __M_writer(
                            u'                                        </a>\n')
                    __M_writer(
                        u'                                </div>\n                            </td>\n'
                    )
                elif sickbeard.HOME_LAYOUT == 'simple':
                    __M_writer(
                        u'                            <td class="tvShow">\n')
                    if curLoadingShow.show:
                        __M_writer(
                            u'                                    <a href="')
                        __M_writer(unicode(srRoot))
                        __M_writer(u'/home/displayShow?show=')
                        __M_writer(filters.url_escape(unicode(
                            loading_show.id)))
                        __M_writer(u'">')
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u'</a>\n')
                    else:
                        __M_writer(
                            u'                                    <span title="">'
                        )
                        __M_writer(unicode(_('Loading...')))
                        __M_writer(u' (')
                        __M_writer(unicode(loading_show.name))
                        __M_writer(u')</span>\n')
                    __M_writer(u'                            </td>\n')
                __M_writer(
                    u'                        <td></td>\n                        <td></td>\n                        <td></td>\n                        <td></td>\n                        <td></td>\n                        <td></td>\n                    </tr>\n'
                )
            for curShow in myShowList:
                __M_writer(u'                    ')

                if sickbeard.showQueueScheduler.action.is_in_remove_queue(
                        curShow
                ) or sickbeard.showQueueScheduler.action.is_being_removed(
                        curShow):
                    continue

                cur_airs_next = ''
                cur_airs_prev = ''
                cur_snatched = 0
                cur_downloaded = 0
                cur_total = 0
                show_size = 0
                download_stat_tip = ''

                if curShow.indexerid in show_stat:
                    cur_airs_next = show_stat[
                        curShow.indexerid]['ep_airs_next']
                    cur_airs_prev = show_stat[
                        curShow.indexerid]['ep_airs_prev']

                    cur_snatched = show_stat[curShow.indexerid]['ep_snatched']
                    if not cur_snatched:
                        cur_snatched = 0

                    cur_downloaded = show_stat[
                        curShow.indexerid]['ep_downloaded']
                    if not cur_downloaded:
                        cur_downloaded = 0

                    cur_total = show_stat[curShow.indexerid]['ep_total']
                    if not cur_total:
                        cur_total = 0

                    show_size = show_stat[curShow.indexerid]['show_size']

                download_stat = str(cur_downloaded)
                download_stat_tip = _('Downloaded') + ": " + str(
                    cur_downloaded)

                if cur_snatched:
                    download_stat = download_stat + "+" + str(cur_snatched)
                    download_stat_tip = download_stat_tip + "&#013;" + _(
                        'Snatched') + ": " + str(cur_snatched)

                download_stat = download_stat + " / " + str(cur_total)
                download_stat_tip = download_stat_tip + "&#013;" + _(
                    'Total') + ": " + str(cur_total)

                nom = cur_downloaded
                if cur_total:
                    den = cur_total
                else:
                    den = 1
                    download_stat_tip = _('Unaired')

                progressbar_percent = nom * 100 / den

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in [
                            'nom', 'cur_airs_prev', 'cur_downloaded',
                            'cur_total', 'cur_snatched', 'show_size',
                            'progressbar_percent', 'cur_airs_next', 'den',
                            'download_stat', 'download_stat_tip'
                        ] if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer(u'\n                    <tr>\n')
                if cur_airs_next:
                    __M_writer(u'                            ')
                    airDate = sbdatetime.sbdatetime.convert_to_setting(
                        network_timezones.parse_date_time(
                            cur_airs_next, curShow.airs, curShow.network))

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in ['airDate']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    __M_writer(u'\n')
                    try:
                        __M_writer(
                            u'                                <td align="center" class="nowrap">\n                                    <time datetime="'
                        )
                        __M_writer(unicode(airDate.isoformat('T')))
                        __M_writer(u'" class="date">')
                        __M_writer(
                            unicode(sbdatetime.sbdatetime.sbfdate(airDate)))
                        __M_writer(
                            u'</time>\n                                </td>\n'
                        )
                    except ValueError:
                        __M_writer(
                            u'                                <td align="center" class="nowrap"></td>\n'
                        )
                else:
                    __M_writer(
                        u'                            <td align="center" class="nowrap"></td>\n'
                    )
                __M_writer(u'\n')
                if cur_airs_prev:
                    __M_writer(u'                            ')
                    airDate = sbdatetime.sbdatetime.convert_to_setting(
                        network_timezones.parse_date_time(
                            cur_airs_prev, curShow.airs, curShow.network))

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in ['airDate']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    __M_writer(u'\n')
                    try:
                        __M_writer(
                            u'                                <td align="center" class="nowrap">\n                                    <time datetime="'
                        )
                        __M_writer(unicode(airDate.isoformat('T')))
                        __M_writer(u'" class="date">')
                        __M_writer(
                            unicode(sbdatetime.sbdatetime.sbfdate(airDate)))
                        __M_writer(
                            u'</time>\n                                </td>\n'
                        )
                    except ValueError:
                        __M_writer(
                            u'                                <td align="center" class="nowrap"></td>\n'
                        )
                else:
                    __M_writer(
                        u'                            <td align="center" class="nowrap"></td>\n'
                    )
                __M_writer(u'\n')
                if sickbeard.HOME_LAYOUT == 'small':
                    __M_writer(
                        u'                            <td class="tvShow">\n                                <div class="imgsmallposter '
                    )
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(
                        u'">\n                                    <a href="')
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/home/displayShow?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'" title="')
                    __M_writer(unicode(curShow.name))
                    __M_writer(
                        u'">\n                                        <img src="" data-src="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/showPoster/?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'&amp;which=poster_thumb" class="')
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'" alt="')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(
                        u'"/>\n                                    </a>\n                                    <a href="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/home/displayShow?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'" style="vertical-align: middle;">')
                    __M_writer(unicode(curShow.name))
                    __M_writer(
                        u'</a>\n                                </div>\n                            </td>\n'
                    )
                elif sickbeard.HOME_LAYOUT == 'banner':
                    __M_writer(
                        u'                            <td>\n                                <span style="display: none;">'
                    )
                    __M_writer(unicode(curShow.name))
                    __M_writer(
                        u'</span>\n                                <div class="imgbanner '
                    )
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(
                        u'">\n                                    <a href="')
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/home/displayShow?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(
                        u'">\n                                        <img src="" data-src="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/showPoster/?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'&amp;which=banner" class="')
                    __M_writer(unicode(sickbeard.HOME_LAYOUT))
                    __M_writer(u'" alt="')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'" title="')
                    __M_writer(unicode(curShow.name))
                    __M_writer(
                        u'"/>\n                                    </a>\n                                </div>\n                            </td>\n'
                    )
                elif sickbeard.HOME_LAYOUT == 'simple':
                    __M_writer(
                        u'                            <td class="tvShow"><a href="'
                    )
                    __M_writer(unicode(srRoot))
                    __M_writer(u'/home/displayShow?show=')
                    __M_writer(unicode(curShow.indexerid))
                    __M_writer(u'">')
                    __M_writer(unicode(curShow.name))
                    __M_writer(u'</a></td>\n')
                __M_writer(u'\n')
                if sickbeard.HOME_LAYOUT != 'simple':
                    __M_writer(
                        u'                            <td align="center">\n')
                    if curShow.network:
                        __M_writer(
                            u'                                    <span title="'
                        )
                        __M_writer(unicode(curShow.network))
                        __M_writer(
                            u'" class="hidden-print"><img id="network" width="54" height="27" src="" data-src="'
                        )
                        __M_writer(unicode(srRoot))
                        __M_writer(u'/showPoster/?show=')
                        __M_writer(unicode(curShow.indexerid))
                        __M_writer(u'&amp;which=network" alt="')
                        __M_writer(unicode(curShow.network))
                        __M_writer(u'" title="')
                        __M_writer(unicode(curShow.network))
                        __M_writer(
                            u'" /></span>\n                                    <span class="visible-print-inline">'
                        )
                        __M_writer(unicode(curShow.network))
                        __M_writer(u'</span>\n')
                    else:
                        __M_writer(
                            u'                                    <span title="No Network" class="hidden-print"><img id="network" width="54" height="27" src="" data-src="'
                        )
                        __M_writer(
                            unicode(
                                static_url('images/network/nonetwork.png')))
                        __M_writer(
                            u'" alt="No Network" title="No Network" /></span>\n                                    <span class="visible-print-inline">'
                        )
                        __M_writer(unicode(_('No Network')))
                        __M_writer(u'</span>\n')
                    __M_writer(u'                            </td>\n')
                else:
                    __M_writer(
                        u'                            <td>\n                                <span title="'
                    )
                    __M_writer(unicode(curShow.network))
                    __M_writer(u'">')
                    __M_writer(unicode(curShow.network))
                    __M_writer(u'</span>\n                            </td>\n')
                __M_writer(u'\n                        <td align="center">')
                __M_writer(
                    unicode(renderQualityPill(curShow.quality,
                                              showTitle=True)))
                __M_writer(
                    u'</td>\n\n                        <td align="center">\n')
                __M_writer(
                    u'                            <span style="display: none;">'
                )
                __M_writer(unicode(download_stat))
                __M_writer(
                    u'</span>\n                            <div class="progressbar hidden-print" style="position:relative;" data-show-id="'
                )
                __M_writer(unicode(curShow.indexerid))
                __M_writer(u'" data-progress-percentage="')
                __M_writer(unicode(progressbar_percent))
                __M_writer(u'" data-progress-text="')
                __M_writer(unicode(download_stat))
                __M_writer(u'" data-progress-tip="')
                __M_writer(unicode(download_stat_tip))
                __M_writer(
                    u'"></div>\n                            <span class="visible-print-inline">'
                )
                __M_writer(unicode(download_stat))
                __M_writer(
                    u'</span>\n                        </td>\n\n                        <td align="center" data-show-size="'
                )
                __M_writer(unicode(show_size))
                __M_writer(u'">')
                __M_writer(unicode(pretty_file_size(show_size)))
                __M_writer(
                    u'</td>\n\n                        <td align="center">\n                            <span class="displayshow-icon-'
                )
                __M_writer(
                    unicode(("disable", "enable")[not bool(curShow.paused)]))
                __M_writer(u'" title="')
                __M_writer(unicode(('No', 'Yes')[not bool(curShow.paused)]))
                __M_writer(
                    u'"></span>\n                        </td>\n\n                        <td align="center">\n                            '
                )

                display_status = curShow.status
                if display_status:
                    if re.search(r'(?i)(?:new|returning)\s*series',
                                 curShow.status):
                        display_status = 'Continuing'
                    elif re.search('(?i)(?:nded)', curShow.status):
                        display_status = 'Ended'

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['display_status']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                __M_writer(u'\n                            ')
                __M_writer(unicode(_(display_status)))
                __M_writer(
                    u'\n                        </td>\n                    </tr>\n'
                )
            __M_writer(u'            </tbody>\n        </table>\n    </div>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()