Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist Naming Issue - Playlist Parameters Questions #4

Open
technomorph opened this issue Jan 20, 2022 · 1 comment
Open

Playlist Naming Issue - Playlist Parameters Questions #4

technomorph opened this issue Jan 20, 2022 · 1 comment

Comments

@technomorph
Copy link

I was having this before when I had it working.
Was getting this error: See Output. (Trimmed from Naming Playlists)

Naming playlists...

Traceback (most recent call last):
  File "/Volumes/Panko/zz Programming Transfers/Machine Learning/Neo 4J/neo4j-playlist-builder/neo4j_spotify_playlist_builder.py", line 338, in <module>
    load_graph_using_spotify_api()
  File "/Volumes/Panko/zz Programming Transfers/Machine Learning/Neo 4J/neo4j-playlist-builder/neo4j_spotify_playlist_builder.py", line 69, in load_graph_using_spotify_api
    name_playlists_based_on_keywords(neo4j)
  File "/Volumes/Panko/zz Programming Transfers/Machine Learning/Neo 4J/neo4j-playlist-builder/neo4j_spotify_playlist_builder.py", line 93, in name_playlists_based_on_keywords
    neo4j.run("""    
  File "/Users/djk-tel/Library/Python/3.9/lib/python/site-packages/neo4j/work/simple.py", line 217, in run
    self._autoResult._run(query, parameters, self._config.database, self._config.default_access_mode, self._bookmarks, **kwparameters)
  File "/Users/djk-tel/Library/Python/3.9/lib/python/site-packages/neo4j/work/result.py", line 101, in _run
    self._attach()
  File "/Users/djk-tel/Library/Python/3.9/lib/python/site-packages/neo4j/work/result.py", line 202, in _attach
    self._connection.fetch_message()
  File "/Users/djk-tel/Library/Python/3.9/lib/python/site-packages/neo4j/io/_bolt4x0.py", line 330, in fetch_message
    response.on_failure(summary_metadata or {})
  File "/Users/djk-tel/Library/Python/3.9/lib/python/site-packages/neo4j/io/_bolt4x0.py", line 529, in on_failure
    raise Neo4jError.hydrate(**metadata)
neo4j.exceptions.ConstraintError: Node(516) already exists with label `Playlist` and property `name` = '[NPB G-Funk] Southern Hyphy Hardcore - active, lively'


I had originally solved this by adding the names that would pop up in the already exists error:
IE for this one I would add "hyphy", "hardcore" to the list and try again.
Currently my list is pretty long like this:
filtered_keywords = '"and", "rap", "hip", "hop", "new", "coast", "gangster", "west", "funk", "g", "pop"'

I still noticed that after got over the exists error that many playlists were being named very similar just swapped names:

[NPB G-Funk] Hardcore Hyphy Southern - active, cheerful
[NPB G-Funk] Southern Hyphy Hardcore - active, lively
[NPB G-Funk] Hardcore Trap Hyphy - energetic, lively

Here Hardcore is used 3 times, Hyphy x 3, Southern x 2.
Is there anyway that could store a array that has names already used (even its index uses in playlist name)
and not use them for the naming?


PLAYLIST LIMITS QUESTIONS

could you explain a bit more the

Cut off for playlists to be grouped as 'misc'

min_playlist_size

min size for playlists to be chopped up in smaller ones.

playlist_split_limit

Number of keywords to use in dynamic playlist names.

playlist_keywords_count = 3


Does this only affect the name of the playlist or does it also affect the criteria for the playlists?
playlist_keywords_count = 3

@nielsdejong
Copy link
Owner

hi @technomorph,
that's an interesting finding. Most likely you are generating several distinct playlists with the same name as generated by the keyword. As a temporary fix you could do something like:

SET p.name = \"""" + playlist_prefix + """ \" + apoc.text.capitalizeAll(name) + " - " + energy +", " + mood + rand()

on line 109.

Here's what the other configuration variables do:

  • min_playlist_size - this is the 'cutoff' for where the detected communities no longer count as a playlist. Anything smaller than 40 songs will be put on a misc pile and grouped together. For example, the algorithm may decide to create four playlists of the following sizes: [67, 24, 12, 8]. In that case, the playlists with size [24,12,8] will all be blended together in a playlist of size 24+12+8 = 44. This playlist will be the "Misc" playlist.
  • playlist_split_limit - kind of the opposite. If the algorithm finds playlists with more than 160 songs, we split it up into smaller parts.
  • playlist_keyword_count - the number of keywords to put in playlist names. In your case, Hardcore Hyphy Southern uses three dynamically found keywords. increasing this number will generate longer names. It only affects the naming, no criteria are changed.

Hope this helps,
Niels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants