Commit Graph

57 Commits

Author SHA1 Message Date
Tim Rae
d9312d89dd Handle case where album contains incorrect metadata 2024-06-08 17:56:06 +02:00
Tim Rae
1a7ff4f083 Performance optimisation: Don't query tracks for uninteresting albums
The call to tidal_album.tracks() can take a very long time to execute
which can significantly slow down the search in certain cases
2024-06-08 16:41:15 +02:00
Tim Rae
0c859cc9aa Bump version to 0.1.3 0.1.3 2024-06-08 12:55:09 +02:00
Tim Rae
bb0f3cffd0 Fix rate limit accuracy
Batching multiple updates to the leaky bucket at a fixed interval
improves the accuracy of the rate limiter. Previously the rate would
drop substantially over the course of the sync operation.
2024-06-08 12:54:27 +02:00
Adria Jimenez
ecc642ba7d fix: sync first playlists page
This commit: 1e8366a0e8 broke the loading of playlists. The first results coming back from the Spotify API were not being added to the playlists array.
2024-06-06 13:33:40 +02:00
Tim Rae
3e9b2ef0ec Update readme.md 2024-06-05 09:22:24 +02:00
Tim Rae
a16f764bee Bump version to 0.1.2 0.1.2 2024-06-03 23:38:21 +02:00
Tim Rae
c1956d19cc Fix bug where occasionally wrong track is inserted 2024-06-03 23:38:21 +02:00
Tim Rae
faaf103d23 Bump version to 0.1.1 0.1.1 2024-06-03 22:32:28 +02:00
Tim Rae
a2e62ea20d Fix error due to missing type 2024-06-03 22:32:28 +02:00
Tim Rae
87ae9acbd3 Bump version to 0.1.0 0.1.0 2024-06-03 09:14:10 +02:00
Tim Rae
1e8366a0e8 Performance optimization / refactoring (#43)
This replaces #36 and adds some other fixes!

Execution speed should be much faster now, especially when there are not
many changes to synchronize.

* Maintain track cache between different playlists (thanks to @joshrmcdaniel for amazing work on that!)
* Fix incorrect tidal_playlist_is_dirty() implementation
* Remove more redundant API calls
* Avoid unnecessarily spinning up tasks for tracks that were in match failure cache
* Introduce new rate_limit configuration parameter implemented with leaky bucket rate-limiting algorithm
* Where possible, add new tracks to existing playlist instead of erasing the old ones
* Use asyncio multithreading instead of multiprocessing
* When user has large number of spotify playlists, fetch them in parallel instead of one by one
* More typing hints / typing fixes
2024-06-03 09:11:56 +02:00
Tim Rae
689637510d Fix AttributeError: 'UserPlaylist' object has no attribute 'requests' (#49)
Fixes #48
2024-05-27 16:36:19 +02:00
lokopeto
009db68283 import math (#46)
missing include from #40
2024-05-26 09:26:06 +02:00
Robin Hirst
8a1d0df6dc Add contributors section to readme.md (#44) 2024-05-25 23:03:37 +02:00
Tim Rae
9ad8f9e498 Remove requirements.txt and update readme 2024-05-25 12:13:02 +02:00
Tim Rae
fc20f7b577 Parallelize querying Spotify playlist tracks
This can take quite a long time on large playlists, so makes sense to do
in parallel
2024-05-25 12:13:02 +02:00
Tim Rae
bc75fbf779 Reduce default num subprocesses
The recent caching changes seem to have worsened the situation for me
2024-05-25 12:13:02 +02:00
Tim Rae
42ddaff7b9 Show more progress updates when starting up script 2024-05-25 12:13:02 +02:00
Tim Rae
1a2aedf7a5 Set 2s timeout when connecting to Spotify
I've been having an issue where the script hangs for a long time
when starting up. It seems to be caused by the connection request
to Spotify failing on the first request (which uses IPv6) and
having to wait for the retry attempt using IPv4

2s should be plenty for just getting the refresh token and is
much more tolerable in case of IPv6 failure
2024-05-25 12:13:02 +02:00
Tim Rae
8884ec8c8f Merge pull request #41 from spotify2tidal/feature/miss_cache
Add cache of match failures
2024-05-25 09:41:12 +02:00
Josh Mcdaniel
6294638613 Merge pull request #42 from spotify2tidal/bug/missing_file
Add missing config file
2024-05-24 17:10:37 -05:00
joshrmcdaniel
b25e1c3b36 rm playlist import 2024-05-24 16:59:26 -05:00
joshrmcdaniel
df3e406570 playlist 2024-05-24 16:59:01 -05:00
Tim Rae
311822ecdc Add cache of match failures
This change introduces an sqlite database that contains the track_id,
db insertion time, and ttl in the cache. The ttl starts with one week,
and increases exponentially by a factor of 2 each time the same track_id
is added to the database.

This significantly reduces the execution of the time script when there
are a lot of match failures accumulating, which do not need to check
every time.
2024-05-22 14:54:17 +02:00
Josh Mcdaniel
e2236e429e Merge pull request #34 from spotify2tidal/dev/package
Move code into package
2024-05-12 11:10:44 -05:00
joshrmcdaniel
9e3285686e toml 2024-05-12 10:46:57 -05:00
joshrmcdaniel
76f502f2bc types 2024-05-12 10:46:39 -05:00
joshrmcdaniel
6aaf72bdd1 type hint, move 2024-05-12 10:27:23 -05:00
joshrmcdaniel
4e0c81071b move to src 2024-05-12 10:20:52 -05:00
Tim Rae
61b9078af5 Merge pull request #25 from big-mak/master
Update requirements.txt
0.0.1
2023-07-21 15:22:33 +02:00
big-mak
30f4542ebc Update requirements.txt
Bump to 0.7.2 to fix gender key error when signing in to tidal.
2023-07-21 14:09:05 +01:00
Tim Rae
4b4d72c23f Merge pull request #22 from TheEdgeOfRage/master
Bump tidalapi to 0.7.1 and add gitignore file
2023-05-24 09:25:57 +12:00
Pavle Portic
2827356c94 Bump tidalapi to 0.7.1 and add gitignore file 2023-05-23 16:45:55 +02:00
Tim Rae
083ad135a5 Merge pull request #16 from vaosilva/master
Added a ISRC matcher
2022-12-21 11:33:22 +13:00
Vitor Silva
55f61de435 Minor change to improve boolean logic readability 2022-12-20 22:13:31 +00:00
Vitor Silva
69344db452 Added a isrc matcher 2022-12-20 19:36:51 +00:00
Timothy Rae
e8f5cd174f Catch request error instead of http error 2022-12-13 23:27:16 +13:00
Timothy Rae
ab8c7af1b8 Fix broken print statement 2022-12-13 17:05:26 +13:00
Timothy Rae
0909730a33 Fix issue with intermittent HTTPError 429
* Use tidal objects directly when available to avoid some unnecessary http requests
* Only try to repeat a failed sync attempt if HTTPError
* Print the details of the HTTPError to help with debugging
* Use staggered delay times to increase chance of success
2022-12-10 16:51:32 +13:00
Timothy Rae
4c35637656 Update other library versions 2022-12-10 14:24:06 +13:00
Timothy Rae
383e2078fd Update to tidalapi v0.7 + other minor improvements
* Speed improvements erasing playlists
* Fix progress bar when erasing playlists
* Potentially more useful error logs from repeat_on_exception
2022-12-10 14:20:24 +13:00
Timothy Rae
7efecad56b Fix bug in last commit due to missing variable 2022-02-17 20:31:54 +13:00
Timothy Rae
2967820650 Fix bug where a new Tidal playlist was created everytime sync.py run with --uri argument
I was passing (playlist, None) in the case where the --uri argument was used,
and None means create a new playlist.

I've fixed it to look for the Tidal playlist if it exists like the other
code paths do, and only pass None when it doesn't exist.

Unfortunately this will mean that your Tidal collection might have been polluted with
duplicate playlists. I've added a delete playlist function to tidalapi_patch to help
with deleting these programmatically, which some people might find useful.

Fixes #8
2022-02-12 14:45:46 +13:00
Tim Rae
83b692b0fd Change license from GPL to Affero GPL 2022-02-10 16:08:11 +13:00
Timothy Rae
7045d34e70 Update to latest url for spotify developer docs
Fixes #7
2022-02-10 13:18:54 +13:00
Timothy Rae
f2e5e202c7 Various refactoring, improvements, fixes 2022-02-10 13:16:47 +13:00
Tim Rae
e2ead013ad Merge pull request #2 from vkolotov/fix/retying-if-spotify-returns-none
Fix an issue when Spotify returns None as track, which leads to retri…
2022-02-07 11:17:57 +13:00
Timothy Rae
15c72b3431 Bump tidalapi version to 0.6.9
Fixes #4
2022-02-01 22:20:16 +13:00
Vlad Kolotoff
ba1b651601 Fix an issue when Spotify returns None as track, which leads to retries and a failure eventually. 2021-11-03 22:01:41 +00:00