Sorrow446 / Nugs-Downloader

Nugs downloader written in Go.
92 stars 15 forks source link

Adding logic to skip video-only albums if "skipVideos" is set to true in configuration #38

Closed twalker1998 closed 5 months ago

twalker1998 commented 5 months ago

First off, thanks so much for this amazing tool!

Onto my proposed change- I have a bash script I'm running to download, well, everything from nugs. Basically just a while loop that decrements the release ID and calls this script with an argument of "https://play.nugs.net/release/"$RELEASE_ID.

However, I don't want to download anything with videos, just audio.

For others who might want to do something similar, I modified two things:

  1. The config.json accepts the skipVideos argument
  2. If a release is a video-only release (i.e., no audio tracks), and skipVideos is set to true in either config.json or in the CLI arguments, the release will be skipped, and no video downloaded

I'm more than happy to write a unit test proving this works, or collaborate on a better solution to this problem, if this isn't sufficient in your eyes.

I tested locally with https://play.nugs.net/release/29001, and the video will still be downloaded as long as skipVideos is not set to true.

Sorrow446 commented 5 months ago

You're welcome. I don't often implement any new options into the config file as it's more effort for users to re-download and re-fill it in. Is there a reason why you can't pass --skip-videos or is it just preference? Thank you for the pull.

twalker1998 commented 5 months ago

@Sorrow446 it is just preference.

However, even passing this argument, videos aren't skipped when an album only contains a video (and no audio tracks). This behavior is fixed via the condition I added on line 953 to the album function.

If you'd prefer to not implement a new option in the config file, I could revert my changes in the parseCfg function.

And, perhaps there is a better way to implement this in the album function. This is just what I'd come up with, but open to other suggestions.

Sorrow446 commented 5 months ago

The skip vids option was only meant for releases that have both audio and videos, but I don't have a problem with it if it applies to vid-only ones as well.

That'd be fine, just remove the config file stuff and change the print to something like "Video-only release, skipped." Thank you.

twalker1998 commented 5 months ago

@Sorrow446 changes are pushed.