blastbeng / spotisub

Spotify to subsonic Playlist Generator and Importer
MIT License
105 stars 6 forks source link

ITEMS_PER_PLAYLIST=100 but latest playlist created has 322 songs #14

Closed janaxhell closed 2 months ago

janaxhell commented 2 months ago

As the title says, today Subtify has created 3 artist recommendations playlists: one has 7 songs, one has 95, but one has 322. while in compose it's

            - ITEMS_PER_PLAYLIST=100
            - NUM_USER_PLAYLISTS=5
            - ARTIST_GEN_SCHED=2
            - RECCOMEND_GEN_SCHED=8
            - PLAYLIST_GEN_SCHED=6
            - SAVED_GEN_SCHED=24
            - SCHEDULER_ENABLED=1
blastbeng commented 2 months ago

Can you give me more info?

The full Playlist entries and name of artist will be helpful to understand what's happened

If you have duplicated in your library, it will add Every song matched from Spotify reccommendations. I made it like this to avoid skipping songs.

For example if you have ITEMS_FOR_PLAYLISTS=2 in your library two songs named "Song1" from artist "Artist1" and one song from "Artistw" named "Song2", if the reccommendation step matches all these songs, at the actual state, the resulting Playlist will be:

Artist1 - Song1 Artist1 - Song1 Artist1 - Song2

To clarify, the ITEM_FOR_PLAYLISTS variable doesn't count duplicates.

janaxhell commented 2 months ago

Ahh, yes, that's possible for at least 2 reasons:

One question: will you add a way to group the generated playlists? As of now they are alphabetically scattered among the others, it would be cleaner to have them all start with "Subtify" or some other user-chosen string.

blastbeng commented 2 months ago

If you want to skip these duplicates I have added an EXCLUDED_WORDS var, the default is "acoustic,instrumental,demo" but you can add the word "live" or others... But take care to use this because for example in my library I have the song "Volbeat - die to live" if I add "live" as excluded word, it will be skipped

About ordering... I don't know if navidrome supports Playlist ordering. But naming and sorting the playlists in a better way is planned.

Anyways today I will release a fix about Playlist naming because there is a grammar error in "Reccomendation". After this fix you may need to delete all the generated Reccommendations playlists.

blastbeng commented 2 months ago

If you want to skip these duplicates I have added an EXCLUDED_WORDS var, the default is "acoustic,instrumental,demo" but you can add the word "live" or others... But take care to use this because for example in my library I have the song "Volbeat - die to live" if I add "live" as excluded word, it will be skipped

About ordering... I don't know if navidrome supports Playlist ordering. But naming and sorting the playlists in a better way is planned.

Anyways today I will release a fix about Playlist naming because there is a grammar error in "Reccomendation". After this fix you may need to delete all the generated Reccommendations playlists.

To clarify this, is just because I haven't found yet a better way to match songs. Look at the README section "TODO"

janaxhell commented 2 months ago

Yes, I have already enabled excluded words, but that's not a viable way, many compilations, EP's, singles, etc have no specific word to be filtered. For example in Navidrome to create the smart playlists I exclude albums that have "1" in the tag "Compilation"

{
  "all": [
    { "any": [
      {"is": {"loved": true}},
      {"gt": {"rating": 4}}
    ]},
    {"inTheRange": {"year": [2011, 2020]}},
    {"is": {"compilation": false}},
    {"notContains": {"album": "Live"}}
  ],
  "sort": "random",
  "order": "desc",
  "limit": 500

I have also added the word Live, but it has the drawbacks you mention. Nevertheless, this way is much better than nothing.

Navidrome does not support playlist ordering, so they are all alphabetically sorted. I "group" them using the same pre-tag for those I want to be close to each other, like "Top 1990's", "Top 2000's", ect. The playlists generated by subtify assign an artist name or a number or else then get lost among the alphabetical order. If they started all by i.e ZZZ I would immediately know where my manually created playlists end and those by Subtify begin.

This looks rather messy

image

blastbeng commented 2 months ago

Yes, I have already enabled excluded words, but that's not a viable way, many compilations, EP's, singles, etc have no specific word to be filtered. For example in Navidrome to create the smart playlists I exclude albums that have "1" in the tag "Compilation"

{
  "all": [
    { "any": [
      {"is": {"loved": true}},
      {"gt": {"rating": 4}}
    ]},
    {"inTheRange": {"year": [2011, 2020]}},
    {"is": {"compilation": false}},
    {"notContains": {"album": "Live"}}
  ],
  "sort": "random",
  "order": "desc",
  "limit": 500

I have also added the word Live, but it has the drawbacks you mention. Nevertheless, this way is much better than nothing.

Navidrome does not support playlist ordering, so they are all alphabetically sorted. I "group" them using the same pre-tag for those I want to be close to each other, like "Top 1990's", "Top 2000's", ect. The playlists generated by subtify assign an artist name or a number or else then get lost among the alphabetical order. If they started all by i.e ZZZ I would immediately know where my manually created playlists end and those by Subtify begin.

This looks rather messy

image

I have the same problem. But haven't found a correct way to order playlists in a better way. Maybe I could just create Playlists with names like

"Subtify - Ac/dc - Reccomendations" "Subtify - My reccomendations 001" "Subtify - Playlist Hip Hop"

I have an idea. I will add a new env variable PLAYLIST_PREFIX with default "Subtify" and this will be the prefix for every subtify created Playlist.

Does that look good to you?

EDIT: about skipping words and track matching, I have to experiment fpcalc and Acoustid. Just open a different issue for this.

janaxhell commented 2 months ago

Yes, yes, I was talking exactly about something like that.

blastbeng commented 2 months ago

Yes, yes, I was talking exactly about something like that.

OK I will release this in v0.1.5. The bad news is that we will need to manually delete all the old playlists manually, I will write this in the release notes.

For me it is not a problem, because except the ones created by subtify, I have no playlists... I just delete everything

janaxhell commented 2 months ago

Not a big deal, I deleted them in a click from Navidrome, but before that I looked around and couldn't find them in any folder (Navidrome config, subtify config, playlist folder): where are they stored when they are created?

blastbeng commented 2 months ago

Not a big deal, I deleted them in a click from Navidrome, but before that I looked around and couldn't find them in any folder (Navidrome config, subtify config, playlist folder): where are they stored when they are created?

The Playlists are not stored in any folder. They are stored just inside the navidrome.db file.

If you want to view them, you need to use sqlite3 cmdline tool and manually execute the selects

I have investigated a lot inside the navidrome.db

The tables are:

playlist playlist_tracks

janaxhell commented 2 months ago

Ah, ok. I store mine inside /music/playlists. It probably means that when Navidrome finds something inside that folder, it imports it to navidrome.db.

blastbeng commented 2 months ago

Ah, ok. I store mine inside /music/playlists. It probably means that when Navidrome finds something inside that folder, it imports it to navidrome.db.

Exactly, initially I was doing something like that

1) generating m3us 2) saving m3us inside navidrome music folder 3) letting navidrome importing

But there was a big problem. And it was about Playlist updating and deleting.

Using Subsonic API to create Playlists and save only inside the navidrome.db is the correct way.

Anyway, I will leave this issue open until I release the version 0.1.5, there will be some big code refactoring so it will take a bit.

I want to reorganise the code.

blastbeng commented 2 months ago

Issue has been solved in RELEASE v0.1.5