sdaqo / anipy-cli

Little tool in python to watch and download anime from the terminal (the better way to watch anime). Also applicable as an API
https://sdaqo.github.io/anipy-cli
GNU General Public License v3.0
263 stars 39 forks source link

Is is possible to modify the way files are downloaded? #162

Closed Codixer closed 4 months ago

Codixer commented 4 months ago

I'm interested to know if it's possible to format the final filename of a download. For example, if I could have them only have episode number as it's name, and starting to count up from a number (See mushoku tensei as an example why )

Codixer commented 4 months ago

So as an example, /anime/\<showname>/\<season>/\<episode>

sdaqo commented 4 months ago

Yes that is possible,

  1. open your config file, located here: anipy-cli --config-path
  2. modify download_name_format like this:
    download_name_format: '{episode_number}'
Codixer commented 4 months ago

:O

sdaqo commented 4 months ago

So as an example, /anime///

you can not sperate the showname and seasons, you will always have the season in the showname. For example "Mushoku Tensei Season 2", because that is how they are named on the site we scrape.

Edit: It can only be /anime/<showname + season number>/<episode>

Codixer commented 4 months ago

oh yeah that is fair, I somewhat bypass it with the following: download_name_format: '{episode_number}. {show_name} - ({type})'

Codixer commented 4 months ago

Since I use Jellyfin to watch everything

sdaqo commented 4 months ago

Maybe try activating this option, this should merge the different seasons into one show, if they are all recognised by jellyfin/your plugins image

Codixer commented 4 months ago

Oh that works how I intended it to, the episode number just needs to be first

Codixer commented 4 months ago

I just work the location of the season into the command anipy-cli -D --location "/opt/anime/storage/My Hero Academia/Season 2" --ffmpeg

sdaqo commented 4 months ago

Well I guess that works. If it works for you, just close the issue!

Codixer commented 4 months ago

Is it possible to remove the additional folder it creates?

Codixer commented 4 months ago

Or is the /anime/\<showname + season number>/ a requirement?

sdaqo commented 4 months ago

Well, that is how it currently works. I guess I could put it on my todo list to think about this, especially when using the --ocation argument. But you can always work around this with some bash script. How about running something like this after the download command:

#!/bin/bash

# $1 = path where the anime got downloaded (this is the first argument)

# Move all files from the sub folder in the parent one
mv "$1"/*/* "$1"
# Remove the subfolder
rm -R -- "$1"/*/

Save this somewhere to mover.sh and do chmod +x mover.sh So with this you could then run (I am using the -s flag here to automate it even more, you may omit it): anipy-cli -D --search "my hero academia 2:1-12:sub" --location "/opt/anime/storage/My Hero Academia/Season 2" --ffmpeg && ./path-to-mover.sh "/opt/anime/storage/My Hero Academia/Season 2"

Edit: fix the script