Commit Graph

11 Commits

Author SHA1 Message Date
Tim Rae
c1956d19cc Fix bug where occasionally wrong track is inserted 2024-06-03 23:38:21 +02:00
Tim Rae
a2e62ea20d Fix error due to missing type 2024-06-03 22:32:28 +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
lokopeto
009db68283 import math (#46)
missing include from #40
2024-05-26 09:26:06 +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
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
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