Commit graph

83 commits

Author SHA1 Message Date
Šarūnas Nejus
17bc11034f
Limit search query results using request parameters 2025-09-01 04:36:54 +01:00
Šarūnas Nejus
20497d3d9b
Dedupe search_limit config option init 2025-09-01 04:10:53 +01:00
Šarūnas Nejus
d00d51e0bf
Add configurable search_limit to Spotify and Deezer plugins 2025-08-31 18:48:46 +01:00
Šarūnas Nejus
b3d434f58f
Delegate attribute access to logging 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
d6b6ac3387
Replace logging f-strings with arguments 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
1c16b2b308
Replace string concatenation (' + ')
- Join hardcoded strings
- Replace concatenated variables with f-strings
2025-08-30 23:10:15 +01:00
Sebastian Mohr
1c0484c4ba renamed keywords to query_string, shortened query construct expression,
removed legacy isinstance check
2025-08-26 13:41:11 +02:00
Sebastian Mohr
f81684e188 Moved construct search into SearchApiMetadataSource to dedupe some
deezer and spotify functionalities.
2025-08-26 13:41:11 +02:00
Sebastian Mohr
1d33580b68 Renamed class method to _extract_id. 2025-07-15 15:03:14 +02:00
Sebastian Mohr
6f623ee7b0 Opt in deezer plugin. 2025-07-15 15:03:14 +02:00
Šarūnas Nejus
7cada1c9f8
Remove no-op decargs 2025-07-08 11:37:33 +01:00
Sebastian Mohr
50604b0510 Fixed linting issue after rebase. 2025-07-07 11:40:51 +02:00
Sebastian Mohr
04a3dd2169 Adjusted typehint for search api. Removed optional none from filter. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
1f15598294 Moved constants back to top. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
6ab0f8d3a7 Removed old docstring. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
085b89b70b Minor improvements to deezer plugin typing. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
59ecfd9a49 Moved fetch_data and _get_track function. 2025-07-07 11:36:38 +02:00
Šarūnas Nejus
1a045c9166
Copy paste query, types from library to dbcore 2025-07-06 16:03:46 +01:00
Šarūnas Nejus
b520981c9c
plugins: restructure id extraction 2025-05-17 14:57:34 +01:00
Š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