norkunas / youtube-dl-php

A PHP wrapper for youtube-dl or yt-dlp.
MIT License
456 stars 158 forks source link

Options `--no-write-comments`, `--no-write-description`, `--no-write-thumbnail`, `--no-write-sub`, `--no-write-auto-sub` #225

Open 9x3l6 opened 10 months ago

9x3l6 commented 10 months ago

I'm using these options in my scripts and have added them to my fork of your code. Just putting this here for reference, and if you'd like to add them that would be awesome.

private bool $noWriteComments = false;

    /**
     * Don't write video comments inside .info.json file.
     */
    public function noWriteComments(bool $noWriteComments): self {
        $new = clone $this;
        $new->noWriteComments = $noWriteComments;

        return $new;
    }

'no-write-comments' => $this->noWriteComments,
private bool $noWriteDescription = false;

    /**
     * Don't write video description to a .description file.
     */
    public function noWriteDescription(bool $noWriteDescription): self {
        $new = clone $this;
        $new->noWriteDescription = $noWriteDescription;

        return $new;
    }

'no-write-description' => $this->noWriteDescription,
private bool $noWriteThumbnail = false;

    /**
     * Don't write thumbnail image to disk.
     */
    public function noWriteThumbnail(bool $noWriteThumbnail): self {
        $new = clone $this;
        $new->noWriteThumbnail = $noWriteThumbnail;

        return $new;
    }

'no-write-thumbnail' => $this->noWriteThumbnail,
private ?bool $noWriteSub = false;

    /**
     * Don't write subtitle file.
     */
    public function noWriteSub(bool $noWriteSub): self {
        $new = clone $this;
        $new->noWriteSub = $noWriteSub;

        return $new;
    }

'no-write-sub' => $this->noWriteSub,
private ?bool $noWriteAutoSub = false;

    /**
     * Write automatically generated subtitle file (YouTube only).
     */
    public function noWriteAutoSub(bool $noWriteAutoSub): self {
        $new = clone $this;
        $new->noWriteAutoSub = $noWriteAutoSub;

        return $new;
    }

'no-write-auto-sub' => $this->noWriteAutoSub,
norkunas commented 10 months ago

But is it really worth it? By default that options are disabled, that means it's already using no-write-** all of them unless you pass write-** ? If you enabled the write-** via option, you can also disable it just by passing false flag to these options

9x3l6 commented 8 months ago

I think its worth having a full set of options to enable and disable as a project requires it. I'm still playing around with the options to see what works best and what to enable and what to disable and so when I figure it out some more I'll update this issue. Thank you for working on this, you've done a great job.

norkunas commented 8 months ago

I think its worth having a full set of options to enable and disable as a project requires it. I'm still playing around with the options to see what works best and what to enable and what to disable

Okay, so in the end if you'll really need it, then make a PR, I won't mind :)

Thank you for working on this, you've done a great job.

Thank you for your kind words :heart:

9x3l6 commented 7 months ago

Okay sure, I'm still working things out on my side over here and will make a PR when I'm ready, so let's just keep this issue open for now, I plan on making a PR at some point in the near future, just I've been busy with so many different other things so it's taking a while. You're welcome. I appreciate the work you're doing.