No description
Find a file
Alok Saboo f57dc66444 Deezer: Improve requests error handling
## Description

This PR adds gracefully handling requests error in teh Deezer plugin. Right now, it errors out when it receives error:

```bash
Traceback (most recent call last):
  File "/home/arsaboo/.local/bin/beet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/__init__.py", line 1865, in main
    _raw_main(args)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/__init__.py", line 1852, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/commands.py", line 1395, in import_func
    import_files(lib, paths, query)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/ui/commands.py", line 1326, in import_files
    session.run()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 360, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 447, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/util/pipeline.py", line 195, in coro
    func(*(args + (task,)))
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 1497, in lookup_candidates
    task.lookup_candidates()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/importer.py", line 688, in lookup_candidates
    artist, album, prop = autotag.tag_album(
                          ^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/autotag/match.py", line 548, in tag_album
    for matched_candidate in hooks.album_candidates(
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 593, in decorated
    for v in generator(*args, **kwargs):
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/autotag/hooks.py", line 759, in album_candidates
    yield from plugins.candidates(items, artist, album, va_likely, extra_tags)
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 390, in candidates
    yield from plugin.candidates(
               ^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beets/plugins.py", line 772, in candidates
    results = self._search_api(query_type="album", filters=query_filters)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arsaboo/.local/lib/python3.12/site-packages/beetsplug/deezer.py", line 282, in _search_api
    response.raise_for_status()
  File "/home/arsaboo/.local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.deezer.com/search/album?q=album%3A%22Y+Hate+%3F%22+artist%3A%22Parmish+Verma%22
```

## To Do

- [ ] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under `docs/` to describe it.)
- [x] Changelog. (Add an entry to `docs/changelog.rst` to the bottom of one of the lists near the top of the document.)
- [ ] Tests. (Very much encouraged but not strictly required.)
2024-09-15 11:34:29 -04:00
.github Do not install reflink for tests on Windows 2024-09-04 18:56:19 +01:00
beets Update dependencies and do not install reflink on Windows for tests (#5407) 2024-09-08 12:31:02 +01:00
beetsplug Deezer: Improve requests error handling 2024-09-15 11:34:29 -04:00
docs Deezer: Improve requests error handling 2024-09-15 11:34:29 -04:00
extra release.py: introduce pyproject.toml 2024-06-10 13:10:17 +01:00
test Update dependencies and do not install reflink on Windows for tests (#5407) 2024-09-08 12:31:02 +01:00
.gitignore Utilize new way of declaring a NamedTuple 2024-08-25 16:26:19 +02:00
.pre-commit-config.yaml Update versions 2024-03-01 15:21:25 +10:00
.readthedocs.yaml Fix path typo 2023-09-22 15:29:39 -04:00
CODE_OF_CONDUCT.rst Integrate code of conduct 2023-10-27 21:55:13 +10:00
codecov.yml Disable CodeCov annotations (see #4337) 2022-05-17 14:15:17 -04:00
CONTRIBUTING.rst Remove tox 2024-06-10 13:46:25 +01:00
LICENSE Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
MANIFEST.in Include extra bits in the source distribution 2016-08-22 23:54:36 -07:00
poetry.lock Update dependencies 2024-09-04 19:06:55 +01:00
pyproject.toml Do not install reflink for tests on Windows 2024-09-04 18:56:19 +01:00
README.rst Fix some broken/outdated links 2023-11-18 08:37:10 -05:00
README_kr.rst Fix all occurences of Discourse to GH-Discussions 2023-10-23 09:51:52 +02:00
SECURITY.md Create security policy 2021-12-22 09:34:41 -08:00
setup.cfg Make LazyClassProperty / cached_classproperty reusable 2024-06-21 08:49:10 +01:00

.. image:: https://img.shields.io/pypi/v/beets.svg
    :target: https://pypi.python.org/pypi/beets

.. image:: https://img.shields.io/codecov/c/github/beetbox/beets.svg
    :target: https://codecov.io/github/beetbox/beets

.. image:: https://github.com/beetbox/beets/workflows/ci/badge.svg?branch=master
    :target: https://github.com/beetbox/beets/actions

.. image:: https://repology.org/badge/tiny-repos/beets.svg
    :target: https://repology.org/project/beets/versions


beets
=====

Beets is the media library management system for obsessive music geeks.

The purpose of beets is to get your music collection right once and for all.
It catalogs your collection, automatically improving its metadata as it goes.
It then provides a bouquet of tools for manipulating and accessing your music.

Here's an example of beets' brainy tag corrector doing its thing::

  $ beet import ~/music/ladytron
  Tagging:
      Ladytron - Witching Hour
  (Similarity: 98.4%)
   * Last One Standing      -> The Last One Standing
   * Beauty                 -> Beauty*2
   * White Light Generation -> Whitelightgenerator
   * All the Way            -> All the Way...

Because beets is designed as a library, it can do almost anything you can
imagine for your music collection. Via `plugins`_, beets becomes a panacea:

- Fetch or calculate all the metadata you could possibly need: `album art`_,
  `lyrics`_, `genres`_, `tempos`_, `ReplayGain`_ levels, or `acoustic
  fingerprints`_.
- Get metadata from `MusicBrainz`_, `Discogs`_, and `Beatport`_. Or guess
  metadata using songs' filenames or their acoustic fingerprints.
- `Transcode audio`_ to any format you like.
- Check your library for `duplicate tracks and albums`_ or for `albums that
  are missing tracks`_.
- Clean up crufty tags left behind by other, less-awesome tools.
- Embed and extract album art from files' metadata.
- Browse your music library graphically through a Web browser and play it in any
  browser that supports `HTML5 Audio`_.
- Analyze music files' metadata from the command line.
- Listen to your library with a music player that speaks the `MPD`_ protocol
  and works with a staggering variety of interfaces.

If beets doesn't do what you want yet, `writing your own plugin`_ is
shockingly simple if you know a little Python.

.. _plugins: https://beets.readthedocs.org/page/plugins/
.. _MPD: https://www.musicpd.org/
.. _MusicBrainz music collection: https://musicbrainz.org/doc/Collections/
.. _writing your own plugin:
    https://beets.readthedocs.org/page/dev/plugins.html
.. _HTML5 Audio:
    https://html.spec.whatwg.org/multipage/media.html#the-audio-element
.. _albums that are missing tracks:
    https://beets.readthedocs.org/page/plugins/missing.html
.. _duplicate tracks and albums:
    https://beets.readthedocs.org/page/plugins/duplicates.html
.. _Transcode audio:
    https://beets.readthedocs.org/page/plugins/convert.html
.. _Discogs: https://www.discogs.com/
.. _acoustic fingerprints:
    https://beets.readthedocs.org/page/plugins/chroma.html
.. _ReplayGain: https://beets.readthedocs.org/page/plugins/replaygain.html
.. _tempos: https://beets.readthedocs.org/page/plugins/acousticbrainz.html
.. _genres: https://beets.readthedocs.org/page/plugins/lastgenre.html
.. _album art: https://beets.readthedocs.org/page/plugins/fetchart.html
.. _lyrics: https://beets.readthedocs.org/page/plugins/lyrics.html
.. _MusicBrainz: https://musicbrainz.org/
.. _Beatport: https://www.beatport.com

Install
-------

You can install beets by typing ``pip install beets`` or directly from Github (see details `here`_).
Beets has also been packaged in the `software repositories`_ of several
distributions. Check out the `Getting Started`_ guide for more information.

.. _here: https://beets.readthedocs.io/en/latest/faq.html#run-the-latest-source-version-of-beets
.. _Getting Started: https://beets.readthedocs.org/page/guides/main.html
.. _software repositories: https://repology.org/project/beets/versions

Contribute
----------

Thank you for considering contributing to ``beets``! Whether you're a
programmer or not, you should be able to find all the info you need at
`CONTRIBUTING.rst`_.

.. _CONTRIBUTING.rst: https://github.com/beetbox/beets/blob/master/CONTRIBUTING.rst

Read More
---------

Learn more about beets at `its Web site`_. Follow `@b33ts`_ on Mastodon for
news and updates.

.. _its Web site: https://beets.io/
.. _@b33ts: https://fosstodon.org/@beets

Contact
-------
* Encountered a bug you'd like to report? Check out our `issue tracker`_!
    * If your issue hasn't already been reported, please `open a new ticket`_
      and we'll be in touch with you shortly.
    * If you'd like to vote on a feature/bug, simply give a :+1: on issues
      you'd like to see prioritized over others.
* Need help/support, would like to start a discussion, have an idea for a new
  feature, or would just like to introduce yourself to the team? Check out
  `GitHub Discussions`_!

.. _GitHub Discussions: https://github.com/beetbox/beets/discussions
.. _issue tracker: https://github.com/beetbox/beets/issues
.. _open a new ticket: https://github.com/beetbox/beets/issues/new/choose

Authors
-------

Beets is by `Adrian Sampson`_ with a supporting cast of thousands.

.. _Adrian Sampson: https://www.cs.cornell.edu/~asampson/