Commit graph

64 commits

Author SHA1 Message Date
Šarūnas Nejus
4c1f217ce0
missing: support non-musicbrainz data sources 2025-04-14 02:28:42 +01:00
Šarūnas Nejus
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Alok Saboo
7f74d3db4c
Update beetsplug/deezer.py
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2024-09-17 13:23:11 -04:00
Alok Saboo
afe43dc360 Fix lint errors 2024-09-15 11:36:16 -04:00
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
Lev Gorodetskiy
2130404217
Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
Alok Saboo
a4ce25fce0 Changed debug logs to error 2023-12-01 12:09:47 -05:00
Alok Saboo
7ffbd040a1 Updated error handling 2023-12-01 08:43:14 -05:00
Alok Saboo
1a77d9575b Formatting fixes 2023-11-25 10:29:02 -05:00
Alok Saboo
2115f31070 Fix comments 2023-11-25 10:27:29 -05:00
Alok Saboo
dee893a7d0 Add helper function and address comments 2023-11-23 09:40:03 -05:00
Alok Saboo
b2fe89d70c formatting fixes 2023-11-22 12:03:33 -05:00
Alok Saboo
33f8ae3e50 Use exception instead of a module in try-except block 2023-11-22 12:02:39 -05:00
Alok Saboo
b4cc654153 Formatting fixes 2023-11-22 11:56:06 -05:00
Alok Saboo
3f68856e58 Lint 2023-11-22 11:54:10 -05:00
Alok Saboo
4cf2c6d3a1 Handle Deezer API errors 2023-11-22 11:52:33 -05:00
Alok Saboo
c1e91f42df Formatting 2023-11-01 18:12:23 -04:00
Alok Saboo
d4a4934f7a Improve error handling 2023-11-01 17:38:50 -04:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Alok Saboo
ef8a780e1c Add error handling for invalid Deezer track_id 2023-07-13 09:53:41 -04:00
Alok Saboo
63122da24d remove unused imports 2023-07-10 15:55:42 -04:00
Alok Saboo
c00cdd3cc7 Error handling 2023-07-10 15:52:36 -04:00
Alok Saboo
acd604f102 Update deezer.py 2023-07-10 15:39:28 -04:00
Alok Saboo
a027612216 error handling 2023-07-10 15:34:06 -04:00
Alok Saboo
014d41f208 Error handling 2023-07-10 15:30:20 -04:00
Alok Saboo
6460e4d829 added deezer_updated to keep track of update time 2023-07-09 19:06:04 -04:00
Alok Saboo
a291ec3f0b convert urs to f-string format 2023-07-09 18:43:35 -04:00
Alok Saboo
783ea2a444 Add function to update Deezer rank 2023-07-09 18:39:15 -04:00
Alok Saboo
cdfebdba8e Update deezer.py 2023-07-09 18:02:11 -04:00
Alok Saboo
5419a78bd2 Added additional fields to be imported from Deezer 2023-07-09 17:59:50 -04:00
J0J0 Todos
5bf4e3d92f Dedicated flex attrs for Deezer, Beatport album ID
- Similar to what the Spotify plugin does, on imports we save to a field
  `..._album_id` (spotify_album_id, deezer_album_id, beatport_album_id)
- It would be good to submit such a change to the 3rd-party plugins beetcamp
  and beatport4 as well (beatport_album_id, bandcamp_album_id).
- We might need to investigate why none of these
  flex attr fields get populated to the beets album level (`beet info -a`,
  album_attributes db table), it is only available at the item level (`beet
  info`, item_attributes db table). This should be tackled in a future
  issue/PR.
2023-03-26 13:20:07 +02:00
Andrew Rogl
e33369d231
Fix typo in beetsplug/deezer.py
Found another typo
2023-03-10 17:28:52 +10:00
Andrew Rogl
5662fef842
Fix type in deezer.py 2023-03-09 17:05:03 +10:00
J0J0 Todos
8ab25694a5 Move Deezer ID regex to id_extractors module
in beets.util package.
2023-03-08 18:12:31 +01:00
Dominik Schrempf
969f045610
fix deezer pagination
See #4180, and #4198.
2021-12-19 00:55:20 +01:00
ybnd
82a2a22365 deezer: Tolerate missing fields when searching for singletons 2021-12-12 15:49:29 +01:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
Rahul Ahuja
32ea225fad Guard against "empty" albums 2019-10-05 23:12:53 -07:00
Rahul Ahuja
ca5806fb6e Restrict country code to alpha characters 2019-09-15 16:34:20 -07:00
Rahul Ahuja
01e8643cec Revert to optional capturing group 2019-09-15 16:24:32 -07:00
Rahul Ahuja
a5fadf0dcc Integrate MetadataSourcePlugin 2019-09-15 15:59:24 -07:00
Rahul Ahuja
876c0f733f Appease flake8 2019-09-10 23:52:35 -07:00
Rahul Ahuja
dfdf8ded33 Add missing import 2019-09-10 22:55:41 -07:00
Rahul Ahuja
732e372ed2 Rename/move to plugins.MetadataSourcePlugin, fix formatting 2019-09-09 17:31:42 -07:00
Rahul Ahuja
0a700c75a2 Optional capturing groups 2019-09-07 01:07:44 -07:00
Rahul Ahuja
bdb7565500 Avoid nested capturing groups 2019-09-07 00:48:19 -07:00
Rahul Ahuja
4a6fa5657b Formatting 2019-09-06 13:11:28 -07:00
Rahul Ahuja
0d6df42d5f Use Abstract Base Class 2019-09-06 12:08:26 -07:00
Rahul Ahuja
a3fb8ebfff Formatting 2019-09-04 22:56:09 -07:00