<commit_before># ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import subprocess
import re
import shlex

from svtplay_dl.log import log
from svtplay_dl.utils import is_py2
from svtplay_dl.fetcher import VideoRetriever

class RTMP(VideoRetriever):
    def download(self):
        """ Get the stream from RTMP """
        args = []
        if self.options.live:
            args.append("-v")

        if self.options.resume:
            args.append("-e")

        extension = re.search(r"(\.[a-z0-9]+)$", self.url)
        if self.options.output != "-":
            if not extension:
                self.options.output = "%s.flv" % self.options.output
            else:
                self.options.output = self.options.output + extension.group(1)
            log.info("Outfile: %s", self.options.output)
            args += ["-o", self.options.output]
        if self.options.silent or self.options.output == "-":
            args.append("-q")
        if self.options.other:
            if is_py2:
                args += shlex.split(self.options.other.encode("utf-8"))
            else:
                args += shlex.split(self.options.other)

        if self.options.verbose:
            args.append("-V")

        command = ["rtmpdump", "-r", self.url] + args
        log.debug("Running: %s", " ".join(command))
        try:
            subprocess.call(command)
        except OSError as e:
            log.error("Could not execute rtmpdump: " + e.strerror)<commit_msg>rtmp: complain when the file exists<commit_after># ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import subprocess
import re
import shlex
import os

from svtplay_dl.log import log
from svtplay_dl.utils import is_py2
from svtplay_dl.fetcher import VideoRetriever

class RTMP(VideoRetriever):
    def download(self):
        """ Get the stream from RTMP """
        args = []
        if self.options.live:
            args.append("-v")

        if self.options.resume:
            args.append("-e")

        extension = re.search(r"(\.[a-z0-9]+)$", self.url)
        if self.options.output != "-":
            if not extension:
                self.options.output = "%s.flv" % self.options.output
            else:
                self.options.output = self.options.output + extension.group(1)
            log.info("Outfile: %s", self.options.output)
            if os.path.isfile(self.options.output) and not self.options.force:
                log.info("File already exists. use --force to overwrite")
                return
            args += ["-o", self.options.output]
        if self.options.silent or self.options.output == "-":
            args.append("-q")
        if self.options.other:
            if is_py2:
                args += shlex.split(self.options.other.encode("utf-8"))
            else:
                args += shlex.split(self.options.other)

        if self.options.verbose:
            args.append("-V")

        command = ["rtmpdump", "-r", self.url] + args
        log.debug("Running: %s", " ".join(command))
        try:
            subprocess.call(command)
        except OSError as e:
            log.error("Could not execute rtmpdump: " + e.strerror)
{'fraction_non_alphanumeric': 0.1375980687990344, 'fraction_numerical': 0.006638503319251659, 'mean_word_length': 1.9677708146821844, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3805234', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1006, 'n_words': 225}