def test_5(finfo): translations = settings.get_list('global', 'translations') for tr in translations: if tr != 'en_US': yield finfo.file_exists( os.path.join(APP_PATH, 'locale/%s/LC_MESSAGES/kontext.mo' % tr))
def test_5(finfo): translations = settings.get_list('global', 'translations') for tr in translations: if tr != 'en-US': yield finfo.file_exists( os.path.join( APP_PATH, f'locale/{tr.replace("-", "_")}/LC_MESSAGES/kontext.mo'))
def add_globals(self, request, result, methodname, action_metadata): super().add_globals(request, result, methodname, action_metadata) conc_args = self._get_mapped_attrs(WordlistArgsMapping + ConcArgsMapping) q = request.args.get('q') if q: conc_args['q'] = [q] result['Globals'] = conc_args result['conc_dashboard_modules'] = settings.get_list('global', 'conc_dashboard_modules')
def fcs2html(self, req): """ Returns XSL template for rendering FCS XML. """ self._headers['Content-Type'] = 'text/xsl; charset=utf-8' custom_hd_inject_path = settings.get('fcs', 'template_header_inject_file', None) if custom_hd_inject_path: with open(custom_hd_inject_path) as fr: custom_hdr_inject = fr.read() else: custom_hdr_inject = None return dict(fcs_provider_heading=settings.get('fcs', 'provider_heading', 'KonText FCS Data Provider'), fcs_provider_website=settings.get('fcs', 'provider_website', None), fcs_template_css_url=settings.get_list('fcs', 'template_css_url'), fcs_custom_hdr_inject=custom_hdr_inject)
def test_get_list_scalar_val(self): v = settings.get_list('global', 'foo') self.assertListEqual(v, ['bar'])
def test_get_list_non_existing(self): v = settings.get_list('global', 'zzz') self.assertListEqual(v, [])
def test_get_list(self): v = settings.get_list('global', 'items') self.assertListEqual(v, ['a', 'b', 'c'])
def test_5(finfo): translations = settings.get_list('global', 'translations') for tr in translations: yield finfo.file_exists( os.path.join(APP_PATH, 'locale/%s/formats.json' % tr))
def test_5(finfo): translations = settings.get_list('global', 'translations') for tr in translations: if tr != 'en_US': yield finfo.file_exists(os.path.join(APP_PATH, 'locale/%s/LC_MESSAGES/kontext.mo' % tr))
import sys import logging import subprocess import argparse from multiprocessing.dummy import Pool # dummy makes it threads from settings import STREAM_DUMP, get_list logger = logging.getLogger("ydb_stream") logging.basicConfig(level=logging.INFO) SEP = "_" RETRY_TIME = 100 PAD_SIZE = 2 F_EXT = ".mp4" SL = get_list("stream") def process(args): output, link = args mpv_cmd = [ "mpv", "--no-resume-playback", "--stream-dump={}".format(output), "-" ] ydl_cmd = ["youtube-dl", "--output", "-"] ydl_cmd.append(link) yds = subprocess.Popen(ydl_cmd, stdout=subprocess.PIPE, shell=False) writeout = subprocess.Popen(mpv_cmd, stdin=yds.stdout, shell=False) writeout.communicate()
""" import os import sys import logging import argparse import subprocess from os.path import join from collections import OrderedDict as OD from settings import DOWNLOAD_PATH, ARCHIVE, get_list logging.basicConfig(level=logging.DEBUG, stream=sys.stdout) logger = logging.getLogger("ydb_main") VL = get_list("video") def match_channels(ident, **kwargs): """ Checks for identifiers in the dict and overwrites any kwargs that are explicitly passed. If no identifiers are given, takes all in `DIC_DEFS` with only one letter, i.e. the main ones. """ qwargs = {k: v for k, v in kwargs.items() if v} for each in identifier(ident): myDic = VL[each] myDic.update(qwargs) logger.debug("myDic: {}".format(myDic)) ydl_caller(**myDic)