コード例 #1
0
ファイル: __init__.py プロジェクト: Creone33/SiCKRAGE
    def log_url(response, **kwargs):
        """Response hook to log request URL."""
        request = response.request
        sickrage.app.log.debug('{} URL: {} [Status: {}]'.format(request.method, request.url, response.status_code))
        sickrage.app.log.debug('User-Agent: {}'.format(request.headers['User-Agent']))

        if request.method.upper() == 'POST':
            if isinstance(request.body, unicode):
                sickrage.app.log.debug('With post data: {}'.format(request.body))
            else:
                sickrage.app.log.debug('With post data: {}'.format(to_unicode(request.body)))
コード例 #2
0
ファイル: __init__.py プロジェクト: gborri/SiCKRAGE
    def log_url(response, **kwargs):
        """Response hook to log request URL."""
        request = response.request
        sickrage.app.log.debug('{} URL: {} [Status: {}]'.format(request.method, request.url, response.status_code))
        sickrage.app.log.debug('User-Agent: {}'.format(request.headers['User-Agent']))

        if request.method.upper() == 'POST':
            if isinstance(request.body, unicode):
                sickrage.app.log.debug('With post data: {}'.format(request.body))
            else:
                sickrage.app.log.debug('With post data: {}'.format(to_unicode(request.body)))
コード例 #3
0
ファイル: srdatetime.py プロジェクト: gfediere/SiCKRAGE-1
    def srfdatetime(self, show_seconds=False, d_preset=None, t_preset=None):
        """
        Show datetime in SR format

        :param show_seconds: Boolean, show seconds as well
        :param d_preset: Preset date format
        :param t_preset: Preset time format
        :return: datetime string
        """

        strd = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if d_preset is not None:
                strd = self.dt.strftime(d_preset)
            else:
                strd = self.dt.strftime(sickrage.app.config.date_preset)

            try:
                if self.has_locale:
                    locale.setlocale(
                        locale.LC_TIME,
                        locale.normalize(sickrage.app.config.gui_lang))
            except Exception:
                try:
                    if self.has_locale:
                        locale.setlocale(locale.LC_TIME, self.en_US_norm)
                except Exception:
                    self.has_locale = False

            if t_preset is not None:
                strd += ', {}'.format(self.dt.strftime(t_preset))
            elif show_seconds:
                strd += ', {}'.format(
                    self.dt.strftime(
                        sickrage.app.config.time_preset_w_seconds))
            else:
                strd += ', {}'.format(
                    self.dt.strftime(sickrage.app.config.time_preset))
        finally:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, '')
            except Exception:
                self.has_locale = False

        return encoding.to_unicode(strd)
コード例 #4
0
ファイル: srdatetime.py プロジェクト: SiCKRAGETV/SiCKRAGE
    def srfdatetime(self, show_seconds=False, d_preset=None, t_preset=None):
        """
        Show datetime in SR format

        :param show_seconds: Boolean, show seconds as well
        :param d_preset: Preset date format
        :param t_preset: Preset time format
        :return: datetime string
        """

        strd = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if d_preset is not None:
                strd = self.dt.strftime(d_preset)
            else:
                strd = self.dt.strftime(sickrage.app.config.date_preset)

            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, locale.normalize(sickrage.app.config.gui_lang))
            except Exception:
                try:
                    if self.has_locale:
                        locale.setlocale(locale.LC_TIME, self.en_US_norm)
                except Exception:
                    self.has_locale = False

            if t_preset is not None:
                strd += ', {}'.format(self.dt.strftime(t_preset))
            elif show_seconds:
                strd += ', {}'.format(self.dt.strftime(sickrage.app.config.time_preset_w_seconds))
            else:
                strd += ', {}'.format(self.dt.strftime(sickrage.app.config.time_preset))
        finally:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, '')
            except Exception:
                self.has_locale = False

        return encoding.to_unicode(strd)
コード例 #5
0
ファイル: srdatetime.py プロジェクト: gfediere/SiCKRAGE-1
    def srftime(self, show_seconds=False, t_preset=None):
        """
        Display time in SR format

        :param show_seconds: Boolean, show seconds
        :param t_preset: Preset time format
        :return: time string
        """

        strt = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if self.has_locale:
                locale.setlocale(
                    locale.LC_TIME,
                    locale.normalize(sickrage.app.config.gui_lang))
        except Exception:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, self.en_US_norm)
            except Exception:
                self.has_locale = False

        try:
            if t_preset is not None:
                strt = self.dt.strftime(t_preset)
            elif show_seconds:
                strt = self.dt.strftime(
                    sickrage.app.config.time_preset_w_seconds)
            else:
                strt = self.dt.strftime(sickrage.app.config.time_preset)
        finally:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, '')
            except Exception:
                self.has_locale = False

        return encoding.to_unicode(strt)
コード例 #6
0
ファイル: srdatetime.py プロジェクト: SiCKRAGETV/SiCKRAGE
    def srftime(self, show_seconds=False, t_preset=None):
        """
        Display time in SR format

        :param show_seconds: Boolean, show seconds
        :param t_preset: Preset time format
        :return: time string
        """

        strt = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if self.has_locale:
                locale.setlocale(locale.LC_TIME, locale.normalize(sickrage.app.config.gui_lang))
        except Exception:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, self.en_US_norm)
            except Exception:
                self.has_locale = False

        try:
            if t_preset is not None:
                strt = self.dt.strftime(t_preset)
            elif show_seconds:
                strt = self.dt.strftime(sickrage.app.config.time_preset_w_seconds)
            else:
                strt = self.dt.strftime(sickrage.app.config.time_preset)
        finally:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, '')
            except Exception:
                self.has_locale = False

        return encoding.to_unicode(strt)
コード例 #7
0
ファイル: srdatetime.py プロジェクト: gfediere/SiCKRAGE-1
    def srfdate(self, d_preset=None):
        """
        Display date in SR format

        :param d_preset: Preset date format
        :return: date string
        """

        strd = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if self.has_locale:
                locale.setlocale(
                    locale.LC_TIME,
                    locale.normalize(sickrage.app.config.gui_lang))
        except Exception:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, self.en_US_norm)
            except Exception:
                self.has_locale = False

        try:
            if d_preset is not None:
                strd = self.dt.strftime(d_preset)
            else:
                strd = self.dt.strftime(sickrage.app.config.date_preset)
        finally:
            try:
                locale.setlocale(locale.LC_TIME, '')
            except Exception:
                pass

        return encoding.to_unicode(strd)
コード例 #8
0
ファイル: srdatetime.py プロジェクト: SiCKRAGETV/SiCKRAGE
    def srfdate(self, d_preset=None):
        """
        Display date in SR format

        :param d_preset: Preset date format
        :return: date string
        """

        strd = ''

        try:
            locale.setlocale(locale.LC_TIME, '')
        except Exception:
            pass

        try:
            if self.has_locale:
                locale.setlocale(locale.LC_TIME, locale.normalize(sickrage.app.config.gui_lang))
        except Exception:
            try:
                if self.has_locale:
                    locale.setlocale(locale.LC_TIME, self.en_US_norm)
            except Exception:
                self.has_locale = False

        try:
            if d_preset is not None:
                strd = self.dt.strftime(d_preset)
            else:
                strd = self.dt.strftime(sickrage.app.config.date_preset)
        finally:
            try:
                locale.setlocale(locale.LC_TIME, '')
            except Exception:
                pass

        return encoding.to_unicode(strd)