jack-cli-cd-ripper / jack

Jack command-line CD ripper
GNU General Public License v2.0
14 stars 5 forks source link

Make release year usable in name templates #40

Closed madmartin closed 2 years ago

madmartin commented 3 years ago

Read in the release year from musicbrainz data. This allows use of %y in rename templates. Example:

jack --dir-template '%a/%l (%y)' -R

Signed-off-by: Martin Dummer martin.dummer@gmx.net

madmartin commented 2 years ago

Hello @zzarne and @pimzand, do you have any comments to my pullrequest?

zzarne commented 2 years ago

I'll accept it and then change it to

    # remove line 225:     year = None

    # try to use year from chosen release array element
    if cf['_year'] is None:
        try:
            mb_date = query_data['result']['releases'][chosen_release]['date']
            cf['_year'] = datetime.datetime.fromisoformat(mb_date).year
            debug("using year from ['releases'][chosen_release]['date']"
                  + f" = { repr(mb_date) } -> { cf['_year'] }")
        except Exception as e:
            warning("could not parse year from ['releases'][chosen_release]"
                    + f"['date']: { e }")

I recommend using something like

dir_template:%a - %l
append_year:% (%y)

in ~/.jack3rc so you won't get errors when no release date is set.

madmartin commented 2 years ago

Hi, yes, try/except is far better of course. I am a python noob....

zzarne commented 2 years ago

Thank you for your pull request. This has been bugging me since forever.

pimzand commented 2 years ago

Hi Arne,

It seems we are updating the same code, and you were just ahead of me in writing the remote album art code. I first wanted to add the code for searching local art, which I just did.

I was then going to add the fetching of remote album art, but  I was going to let that depend on the success of finding local art. That is, if no local art found, download it, cache it as jack.cover.jpg and automatically embed it.

What do you think?

Regards, Pim

madmartin commented 2 years ago

I'm sorry to write without being asked - my opinion is that it sounds reasonable!

pimzand commented 2 years ago

Hi Arne,

Another thing, you are allowing to download back covers, but all of my code removes any art that is not marked as front cover. I have never seen any files containing back covers, nor any player that does something useful with it.

Regards, Pim

On 1/9/22 21:17, Pim Zandbergen wrote:

Hi Arne,

It seems we are updating the same code, and you were just ahead of me in writing the remote album art code. I first wanted to add the code for searching local art, which I just did.

I was then going to add the fetching of remote album art, but  I was going to let that depend on the success of finding local art. That is, if no local art found, download it, cache it as jack.cover.jpg and automatically embed it.

What do you think?

Regards, Pim

pimzand commented 2 years ago

Sorry, my remarks are getting into the wrong issue.

zzarne commented 2 years ago

Hi Pim!

I agree. I'd like jack to be able to download any type of album art, but of course only the front should be embedded. Everything else just should go to reasonably named files. We should probably allow "[artist] - [album] - [art].[ext]" etc. for people who want multiple albums in one directory, so another template or naming album art files would be best.

Feel free to change my code and config options.

Greetings and keep it up! :)

zzarne commented 2 years ago

Off topic or not, I think albumart_ignorecase should default to 1 and the albumart_max_width and height to at least 1200, for all the hi-res devices out there. And wishlist: scale (only down!) the image if it doesn't meet the resolution or size constraints.