Code Monkey home page Code Monkey logo

regorxxx / search-by-distance-smp Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 6.0 35.53 MB

An implementation of Music-Graph for foobar2000, using Spider Monkey, which creates intelligent "spotify-like" playlist using high-level data from tracks and computing their similarity using genres/styles.

Home Page: https://regorxxx.github.io/foobar2000-SMP.github.io/scripts/search-by-distance-smp/

License: GNU Affero General Public License v3.0

JavaScript 97.14% HTML 2.81% Batchfile 0.01% CSS 0.03%
foobar2000 foobar2000-component foobar2000-smp-script playlist-generator music

search-by-distance-smp's Introduction

Hi there :)

I'm Regorxxx. I work as a photographer. In my spare time I do open-sourcing (normally it is about 1-2 hours every day). I'm interested and contributing to free software, and particularly to audio related software. Advocate of open-source and sharing, trying to offer similar features than network players and servers like Spotify, Itunes Genius, YouTube, etc. right in your system: offline and using open data.

foobar2000 audio player ListenBrainz Harmonic mixing Xelection Xelection

Getting in touch

By Mail   At hydrogenaudio   At ko-fi   Donate using Liberapay (requires account on web)

search-by-distance-smp's People

Contributors

imgbotapp avatar regorxxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

search-by-distance-smp's Issues

[BUG]

Describe the bug
Reference track's score not being 100 when using genre/style tags not present on the Graph.

To Reproduce
Enable or disable "Set search method\Filter values not present in the graph" for tracks with genres not being on the graph.

Expected behavior
Score of 100.

Additional context
See this

Remap tags menu errors

I have an error in the Remap tags menu of the customizable button.

Ctrl + Shift + click > Remap tags > Set genre tag
Put GENRE,STYLE or GENRE,A for example, it doesn't matter. And OK.
See error.

'Set style tag' is concerned too.

Error: Spider Monkey Panel v1.6.1 (Search by Distance Customizable Button: Search by Distance Customizable Button by xxx)
scriptName is not defined

File: buttons_sbd_menu_config.js
Line: 377, Column: 21
Stack trace:
  func@buttons_sbd_menu_config.js:377:21
  _menu/this.btn_up/<@menu_xxx.js:305:15
  _menu/this.btn_up@menu_xxx.js:295:24
  ["Search by Distance Customizable"]<@buttons_search_bydistance_customizable.js:42:27
  themedButton/this.onClick@buttons_xxx.js:297:21
  @buttons_xxx.js:480:21
  fireEvents/</<@callbacks_xxx.js:148:37
  fireEvents/<@callbacks_xxx.js:145:30

foobar2000

This is a new button used alone, there was no other settings before. I tried with a new portable installation foobar2000 v2.0 beta 12 x86 + Spider Monkey Panel v1.6.1 + the current Search-by-Distance-SMP code downloaded today.

I see other errors in this menu, but maybe it's better to see them one by one in this report, if they are still present?

tagsCache.cacheLibraryTags is not a function

Hello,

I have an error with the customizable button, used alone. It happens when I click on the button, after creating and naming it. I haven't made any settings.

I tried with a new portable installation foobar2000 v2.0 beta 12 x86 + Spider Monkey Panel v1.6.1 + the current Search-by-Distance-SMP code downloaded today (not the release).

Error: Spider Monkey Panel v1.6.1 (Search by Distance Customizable Button: Search by Distance Customizable Button by xxx)
tagsCache.cacheLibraryTags is not a function

File: search_bydistance.js
Line: 923, Column: 21
Stack trace:
  do_searchby_distance@search_bydistance.js:923:21
  ["Search by Distance Customizable"]<@buttons_search_bydistance_customizable.js:59:5
  themedButton/this.onClick@buttons_xxx.js:297:21
  @buttons_xxx.js:480:21
  fireEvents/</<@callbacks_xxx.js:148:37
  fireEvents/<@callbacks_xxx.js:145:30

Capture d'écran 117 foobar2000

Different results with custom tag slot

Hi,

Maybe it's not a bug, it's something I don't understand.

Describe the bug

If I "move" the GENRE tag to a custom tag slot, the results are different. By move I mean: duplicate the tag and set the first one to 0. I sort results by score (not random). Shouldn't playlists be the same? Is the calculation of custom tag slots different?

To Reproduce

  1. Load buttons_toolbar.js, then insert a search-by-distance customizable button with the menu.
  2. Wait for cache calculation in console, and rename button.
  3. Uncheck option Set pool picking > Random picking (not sorted by score)
  4. Uncheck option Set final sorting > Smart Shuffle by Artist
  5. Choose a reference track, click on the button to launch a search with this first configuration (first screenshot)
  6. Set Tags and weighting > Genre > Set Weight to 0
  7. Set Tags and weighting > Genre > Remap... to []. Reset link cache now? No
  8. Set Tags and weighting > New tag.... Enter a name for the tag: Genre 2. Is multi-valued? Yes. Is a genre/style-like tag? Yes
  9. Set Tags and weighting > Genre 2 > Remap... to ["GENRE"]. Reset link cache now? No
  10. Set Tags and weighting > Genre 2 > Set Weight to 15
  11. With the same reference track, click on the button to launch a search with this second configuration (second screenshot). This playlist is different from the first.

Expected behavior
I don't understand why the playlists are different.

Screenshots

Playlist with 1st configuration (default)

1

Playlist with 2nd configuration

2

Desktop

  • OS: Windows 10
  • foobar2000 v2.1.1 x86, new portable installation
  • Spider Monkey Panel v1.6.1-mod, new panel without settings
  • Search-by-Distance-SMP downloaded yesterday, commit 68bf6bf

Additional context

1st configuration (default) : tags used for scoring (from panel properties)

{
   "genre": {
      "weight": 15,
      "tf": ["GENRE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "style": {
      "weight": 15,
      "tf": ["STYLE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "dynGenre": {
      "weight": 15,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["number", "single", "virtual", "absRange"],
      "range": 1
   },
   "mood": {
      "weight": 10,
      "tf": ["MOOD"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "combinations"],
      "combs": 6
   },
   "key": {
      "weight": 5,
      "tf": ["KEY"],
      "baseScore": 0,
      "scoringDistribution": "LOGARITHMIC",
      "type": ["string", "single", "keyMix", "keyRange"],
      "range": 3
   },
   "bpm": {
      "weight": 5,
      "tf": ["BPM"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "percentRange"],
      "range": 50
   },
   "date": {
      "weight": 10,
      "tf": ["$year(%DATE%)"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "absRange"],
      "range": 30
   },
   "composer": {
      "weight": 0,
      "tf": ["COMPOSER"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple"]
   },
   "artistRegion": {
      "weight": 5,
      "tf": ["LOCALE LAST.FM"],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange", "tfRemap"],
      "range": 5
   },
   "genreStyleRegion": {
      "weight": 7,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange"],
      "range": 5
   },
   "related": {
      "weight": 25,
      "tf": ["RELATED"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"]
   },
   "unrelated": {
      "weight": -25,
      "tf": ["UNRELATED"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"]
   }
}

2nd configuration

{
   "genre": {
      "weight": 0,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "style": {
      "weight": 15,
      "tf": ["STYLE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "dynGenre": {
      "weight": 15,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["number", "single", "virtual", "absRange"],
      "range": 1
   },
   "mood": {
      "weight": 10,
      "tf": ["MOOD"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "combinations"],
      "combs": 6
   },
   "key": {
      "weight": 5,
      "tf": ["KEY"],
      "baseScore": 0,
      "scoringDistribution": "LOGARITHMIC",
      "type": ["string", "single", "keyMix", "keyRange"],
      "range": 3
   },
   "bpm": {
      "weight": 5,
      "tf": ["BPM"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "percentRange"],
      "range": 50
   },
   "date": {
      "weight": 10,
      "tf": ["$year(%DATE%)"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "absRange"],
      "range": 30
   },
   "composer": {
      "weight": 0,
      "tf": ["COMPOSER"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple"]
   },
   "artistRegion": {
      "weight": 5,
      "tf": ["LOCALE LAST.FM"],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange", "tfRemap"],
      "range": 5
   },
   "genreStyleRegion": {
      "weight": 7,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange"],
      "range": 5
   },
   "related": {
      "weight": 25,
      "tf": ["RELATED"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"]
   },
   "unrelated": {
      "weight": -25,
      "tf": ["UNRELATED"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "virtual", "tfRemap", "bNegative"]
   },
   "Genre 2": {
      "weight": 15,
      "tf": ["GENRE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["multiple", "string", "graph"]
   }
}

I've tried doing Reset link cache and restarting foobar with both configurations, it doesn't change the playlists.
I saw this several weeks ago, before the cache structure change. It's not a recent change.

[BUG] Custom tag names displayed incorrectly in the menu

Describe the bug

Some words in custom tag names are displayed unexpectedly in the menu. I think this is due to a capitalization regular expression.

The words Genre, Style and Region display a slash or a space before them (screenshot 4).

To Reproduce

  1. Load buttons_toolbar.js, then insert a search-by-distance customizable button with the menu.
  2. Set Tags and weighting > New tag.... Enter a name for the tag: Genre 2.
  3. Set Tags and weighting > New tag.... Enter a name for the tag: Style 2.
  4. Set Tags and weighting > New tag.... Enter a name for the tag: Region 2 (screenshots 1, 2, 3).
  5. In the menu, new slots have an extra slash or space at the beginning of the name (screenshot 4).

Expected behavior

Slot names should be displayed correctly in the menu, without an extra slash or space.

Additional context

Tags used for scoring (from panel properties)

{
   "genre": {
      "weight": 15,
      "tf": ["GENRE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "style": {
      "weight": 15,
      "tf": ["STYLE"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "graph"]
   },
   "dynGenre": {
      "weight": 15,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["number", "single", "virtual", "absRange"],
      "range": 1
   },
   "mood": {
      "weight": 10,
      "tf": ["MOOD"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple", "combinations"],
      "combs": 6
   },
   "key": {
      "weight": 5,
      "tf": ["KEY"],
      "baseScore": 0,
      "scoringDistribution": "LOGARITHMIC",
      "type": ["string", "single", "keyMix", "keyRange"],
      "range": 3
   },
   "bpm": {
      "weight": 5,
      "tf": ["BPM"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "percentRange"],
      "range": 50
   },
   "date": {
      "weight": 10,
      "tf": ["$year(%DATE%)"],
      "baseScore": 0,
      "scoringDistribution": "NORMAL",
      "type": ["number", "single", "absRange"],
      "range": 30
   },
   "composer": {
      "weight": 0,
      "tf": ["COMPOSER"],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["string", "multiple"]
   },
   "artistRegion": {
      "weight": 5,
      "tf": ["LOCALE LAST.FM"],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange", "tfRemap"],
      "range": 5
   },
   "genreStyleRegion": {
      "weight": 7,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LOGISTIC",
      "type": ["string", "single", "virtual", "absRange"],
      "range": 5
   },
   "Genre 2": {
      "weight": 0,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["multiple", "string", "graph"]
   },
   "Style 2": {
      "weight": 0,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["multiple", "string", "graph"]
   },
   "Region 2": {
      "weight": 0,
      "tf": [],
      "baseScore": 0,
      "scoringDistribution": "LINEAR",
      "type": ["multiple", "string", "graph"]
   }
}

I found line 173 in the buttons_sbd_menu_config.js file.

If I remove the slash and the space before the $1, the new names are displayed correctly in the menu. But the two previous slots Artist Region and Genre/Style Region are displayed incorrectly (screenshot 5).

Screenshots

Screenshots

Screenshots 1, 2, 3:

1

2

3

Screenshot 4:

4

Screenshot 5:

5

Desktop

  • OS: Windows 10
  • foobar2000 v2.1, new portable installation
  • Spider Monkey Panel v1.6.1 mod, new panel without settings
  • Search-by-Distance-SMP downloaded a few days ago, commit 115ae3a

[TODO] Cultural distance

Describe the feature
Add cultural weighting by associating genre/styles to cultural regions.

Simplify to subregion/region, with no connection to real geographic distance. Meant to be used along other weightings not as a single cultural similarity score.

Additional context
Reuse region framework.

[FEATURE] Custom graph for custom tag

I'd like to use custom graphs with Search-by-Distance custom tags. To use genres from online music databases. For example a Discogs graph with Discogs tags.

I've made graphs here. It's a start, they can be improved.

I could make substitutions in the descriptor files for graphs that aren't complex. You've done it for AllMusic. But it seems difficult to merge a large graph with the original one.

Primary Origin keys order

Hi. Сould you please explain the order of writing in the style_primary_origin section in the file music_graph_descriptors_xxx.js? The description says:

// Primary influence. For example one style being the origin of other.
// For ex. 'Rockabilly' and 'Rockabilly revival'.

That means the origin to the left and the influenced sub-genres to the right, right?
Or the primary genres that influenced the genre at the left are the right?
I don't understand some of the entries like this one:

	['Nu-Disco'							,	['Electro','Disco XL','Post-Disco XL']],

This confuses me, because Nu-Disco is a sub-genre from the 21st century.

[BUG] Readme not found

I'm using the customizable search by distance button.

When I press Shift + click on the button to open the menu, the console says that the shuffle_by_tags readme file is missing.

Readme not found: D:\foobar-portable\profile\scripts\SMP\xxx-scripts\helpers\readme\shuffle_by_tags.txt
Screenshot

1

It's requested in the buttons_sbd_menu_config.js file on this line.

[BUG] missing property (baseScore)

I'm using the customizable search by distance button. I add a new custom tag. This message appears:

Error on tags settings.
To fix it, restore defaults on affected tags (customizable button) or globally (non-customizable buttons). These options are usually found by Shift + L. Clicking on the button. Then reload the panel.
If the error continues, report it as a bug.
------------------------------------------------------------------------
Tag missing property (baseScore): My tag name
Screenshots

Screenshot

Screenshot 2

I add a base score value and the messages disappear.
As this appears for each new custom tag, it seems that the default property is missing. Unless this is intentional.

[BUG] Tag cache with empty values

Describe the bug
Tags not found on files may return a '?' or '' when having brackets.

Expected behavior
'' values are probably fine, since there must be a way to show the file has no tag, although array could be empty too.
? values should probably be filtered though. They are filtered now on the genre/style retrieval, but should be done globally.

Additional context
Add any other context about the problem here.

[TODO] Cultural filter

Describe the feature
Filter tracks at pre-filter stage with artists from same country, subregion or region.

Additional context
Reuse region framework.

[BUG] Recipe non valid: Similar genres (D)

Errors with recipes have been corrected in version 5.1.2, but one error remains:

Recipe non valid: Similar genres (D)

	- Recipe contains non valid key: dyngenreWeight
	- Recipe contains non valid key: dyngenreRange
Screenshots

1

2

I checked with a new portable installation. I've also tried 'Restore defaults...' for the dynGenre tag.

In the Similar genres (DYNGENRE) file, there's this:

{
	"name": "Similar genres (D)",
	"tags": {

(...)

		"dynGenre": {
			"weight": 40,
			"range": 2
		},

(...)

	},
	"scoreFilter": 70,
	"method": "DYNGENRE",
	"dyngenreWeight": 10,
	"dyngenreRange": 1
}

[FEATURE] Essentia

Hi,

This is not a request, it's just to let you know.

I've been able to use Essentia for a few days now, and I can find the same kind of results as with AcousticBrainz. I can calculate several genre and mood tags. It seems to me that the Tensorflow models are replacing the old Gaia models (I haven't made a comparison though).

I can use Essentia in 3 different ways:

  • on Windows with Python and Tensorflow
    I followed this step by step (with a few changes). It takes time. (I don't know if this procedure will always remain valid.)
    I can give my .whl file for windows x64 (the Python wheel). I don't know if it works, it would allow to go directly to step E. It would be much easier.

    Screenshot

    I've copied the messages here.
    Here the results are percentages, but it's just a formatting, initially the results are a number between 0 and 1 with many decimals, like this.

    cmd

    Example of a python script to calculate a mood

    In the working directory of your choice:
    In a tracks subfolder, I've placed my .flac audio file (adapt the path according to the name of your audio file).
    In a models subfolder, I've placed the .pb and .json files of the tensorflow models.
    (otherwise, you need to adapt the paths)
    Link to the 'happy' model for this example: .pb file, .json file.

    Copy this into a .py file, e.g. my_script.py:

    import json
    
    from essentia.standard import MonoLoader, TensorflowPredictMusiCNN
    
    audio_file = 'tracks/07. Dancing barefoot.flac'
    audio = MonoLoader(sampleRate=16000, filename=audio_file)()
    
    with open('models/mood_happy-musicnn-msd-2.json', 'r') as json_file:
        metadata = json.load(json_file)
    
    activations = TensorflowPredictMusiCNN(graphFilename='models/mood_happy-musicnn-msd-2.pb')(audio)
    
    for label, probability in zip(metadata['classes'], activations.mean(axis=0)):
        print(f'{label}: {100 * probability:.1f}%')

    (I don't claim it's a good script. Chances are it's a bad one.)

    In a command prompt, navigate to this working directory with the cd command, and launch the script with my_script.py in Windows, or python3 my_script.py in Ubuntu.

    A result:

    happy: 78.5%
    non_happy: 44.8%
    

    The other model files can be found here, or here with descriptions, or here.
    In the essentia repository, you'll find examples of python scripts and tutorials with Jupyter notebooks (so you can run code directly in the tutorial). Or simply start here: documentation. Or there are examples at the end of the article.

  • installation in WSL (Windows Subsystem for Linux) with Python and Tensorflow (I'm on Windows 10)

    Details

    (maybe there's a Windows feature to enable first elsewhere)
    Install WSL in PowerShell as administrator:

    wsl --install
    

    Possibly in PowerShell, if you get an error message:

    wsl --update
    

    If Ubuntu is not installed automatically (you know it's installed when it asks you to choose a username and password):

    wsl --install -d Ubuntu
    

    I had some difficulties with Debian to install Essentia, so I recommend Ubuntu (it's the default distribution).

    In an Ubuntu terminal, install Python:

    sudo apt install python3-pip
    

    Install essentia with this command:

    pip install essentia-tensorflow
    

    Screenshot

    The same script in an Ubuntu terminal:

    ubuntu

  • with essentia.js and converted Tensorflow models

    Details

    I've modified this demo page a little to use other genre and mood models. My version is here (repository). You need to open the console and look at the *. What I've done is a rough draft, then I found the other methods, so I didn't go much further.

    I'm not sure it works well in Firefox, apparently there are differences in how Firefox and Chrome work, so it's best to try it in a Chrome-based browser (Vivaldi in my case).

    I manage to run this page locally with some kind of server (the Live Preview extension in VS Codium), otherwise there are errors because of the scripts that are downloaded. I haven't looked any further.

    You need converted models for essentia.js (.bin + .json). Most of them are already on the models repository. Otherwise I've managed to do some conversions following this tutorial, but it doesn't work with all models.

[BUG] missing range property

Describe the bug
I use a customizable button. I add a new custom tag. As in #19, this message appears:

Error on tags settings.
To fix it, restore defaults on affected tags (customizable button) or globally (non-customizable buttons). These options are usually found by Shift + L. Clicking on the button. Then reload the panel.
If the error continues, report it as a bug.
------------------------------------------------------------------------
Tag missing range property: My custom tag

To reproduce

  1. With a customizable button, create a new tag
  2. Enter a name for the tag: My custom tag
  3. Is multi-valued? No
  4. Are tag values strings? No
  5. Uses absolute range? No
  6. Uses percent range? Yes
  7. See error

Screenshot

Screenshot

1

Additional context

Tag properties in the "Edit tag..." menu

{
  "weight": 0,
  "tf": [],
  "baseScore": 0,
  "scoringDistribution": "LINEAR",
  "type": ["single", "number", "percentRange"]
}

New portable installation with default settings.

System info

  • OS: Windows 10 x64 22H2
  • Related software: foobar2000 v2.2 preview 2024-03-14 x86, Spider Monkey Panel v1.6.1-mod
  • Github release: Search-by-Distance-SMP v7.2.0

[BUG] tagNameTF.some is not a function

Describe the bug

I use the Search-by-Distance customizable button, with custom tags. With a certain configuration, I get this crash:

Error: Spider Monkey Panel v1.6.1-mod ({17ED3B57-8282-4682-8D93-A1390E2008B1}: Search by Distance Customizable Button v6.1.2 by regorxxx)
tagNameTF.some is not a function

File: search_by_distance.js
Line: 1049, Column: 31
Stack trace:
  searchByDistance@search_by_distance.js:1049:31
  ["Search by Distance Customizable"]<@buttons_search_by_distance_customizable.js:66:5
  themedButton/this.onClick@buttons_xxx.js:510:21
  @buttons_xxx.js:838:21
  fireEvents/</<@callbacks_xxx.js:149:37
  fireEvents/<@callbacks_xxx.js:145:30

To Reproduce

  1. Load buttons_toolbar.js, then insert a search-by-distance customizable button with the menu.
  2. Set Style weight to 0.
  3. Set Mood weight to 0.
  4. Add a MusicBrainz genre tag. Is multi-valued? Yes. Is a genre/style-like tag? No. Remap to MUSICBRAINZ_GENRE. Set weight to 2.
    {"weight":2,"tf":["MUSICBRAINZ_GENRE"],"baseScore":0,"scoringDistribution":"LINEAR","type":["multiple","string"]}
  5. Add a AB genre Gtzan tag. Is multi-valued? No. Are tag values strings? Yes. Is a genre/style-like tag? No. Remap to AB:GENRE_GTZAN. Set weight to 4.
    {"weight":4,"tf":["AB:GENRE_GTZAN"],"baseScore":0,"scoringDistribution":"LINEAR","type":["single","string"]}
  6. Click on the button to launch a search, see error.

Additional context

The complete configuration is as follows:

Tags used for scoring (from panel properties)

{
  "genre": {
    "weight": 15,
    "tf": ["GENRE"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["string", "multiple", "graph"]
  },
  "style": {
    "weight": 0,
    "tf": ["STYLE"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["string", "multiple", "graph"]
  },
  "dynGenre": {
    "weight": 15,
    "tf": [],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["number", "single", "virtual", "absRange"],
    "range": 1
  },
  "mood": {
    "weight": 0,
    "tf": ["MOOD"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["string", "multiple", "combinations"],
    "combs": 6
  },
  "key": {
    "weight": 5,
    "tf": ["KEY"],
    "baseScore": 0,
    "scoringDistribution": "LOGARITHMIC",
    "type": ["string", "single", "keyMix", "keyRange"],
    "range": 3
  },
  "bpm": {
    "weight": 5,
    "tf": ["BPM"],
    "baseScore": 0,
    "scoringDistribution": "NORMAL",
    "type": ["number", "single", "percentRange"],
    "range": 50
  },
  "date": {
    "weight": 10,
    "tf": ["$year(%DATE%)"],
    "baseScore": 0,
    "scoringDistribution": "NORMAL",
    "type": ["number", "single", "absRange"],
    "range": 30
  },
  "composer": {
    "weight": 0,
    "tf": ["COMPOSER"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["string", "multiple"]
  },
  "artistRegion": {
    "weight": 5,
    "tf": ["LOCALE LAST.FM"],
    "baseScore": 0,
    "scoringDistribution": "LOGISTIC",
    "type": ["string", "single", "virtual", "absRange", "tfRemap"],
    "range": 5
  },
  "genreStyleRegion": {
    "weight": 7,
    "tf": [],
    "baseScore": 0,
    "scoringDistribution": "LOGISTIC",
    "type": ["string", "single", "virtual", "absRange"],
    "range": 5
  },
  "MusicBrainz genre": {
    "weight": 2,
    "tf": ["MUSICBRAINZ_GENRE"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["multiple", "string"]
  },
  "AB genre Gtzan": {
    "weight": 4,
    "tf": ["AB:GENRE_GTZAN"],
    "baseScore": 0,
    "scoringDistribution": "LINEAR",
    "type": ["single", "string"]
  }
}

Same on one line

{"genre":{"weight":15,"tf":["GENRE"],"baseScore":0,"scoringDistribution":"LINEAR","type":["string","multiple","graph"]},"style":{"weight":0,"tf":["STYLE"],"baseScore":0,"scoringDistribution":"LINEAR","type":["string","multiple","graph"]},"dynGenre":{"weight":15,"tf":[],"baseScore":0,"scoringDistribution":"LINEAR","type":["number","single","virtual","absRange"],"range":1},"mood":{"weight":0,"tf":["MOOD"],"baseScore":0,"scoringDistribution":"LINEAR","type":["string","multiple","combinations"],"combs":6},"key":{"weight":5,"tf":["KEY"],"baseScore":0,"scoringDistribution":"LOGARITHMIC","type":["string","single","keyMix","keyRange"],"range":3},"bpm":{"weight":5,"tf":["BPM"],"baseScore":0,"scoringDistribution":"NORMAL","type":["number","single","percentRange"],"range":50},"date":{"weight":10,"tf":["$year(%DATE%)"],"baseScore":0,"scoringDistribution":"NORMAL","type":["number","single","absRange"],"range":30},"composer":{"weight":0,"tf":["COMPOSER"],"baseScore":0,"scoringDistribution":"LINEAR","type":["string","multiple"]},"artistRegion":{"weight":5,"tf":["LOCALE LAST.FM"],"baseScore":0,"scoringDistribution":"LOGISTIC","type":["string","single","virtual","absRange","tfRemap"],"range":5},"genreStyleRegion":{"weight":7,"tf":[],"baseScore":0,"scoringDistribution":"LOGISTIC","type":["string","single","virtual","absRange"],"range":5},"MusicBrainz genre":{"weight":2,"tf":["MUSICBRAINZ_GENRE"],"baseScore":0,"scoringDistribution":"LINEAR","type":["multiple","string"]},"AB genre Gtzan":{"weight":4,"tf":["AB:GENRE_GTZAN"],"baseScore":0,"scoringDistribution":"LINEAR","type":["single","string"]}}

AB genre Gtzan type set to multiple instead of single: no crash

Mood weight set to 7: crash
Mood weight set to 8: no crash

MusicBrainz genre can have several Genres values.
AB genre Gtzan has one of these values: Blues, Classical, Country, Disco, Hiphop, Jazz, Metal, Pop, Rock

Screenshots

Screenshot

1

Desktop

  • OS: Windows 10
  • foobar2000 v2.1 preview 2023-12-11 x86
  • Spider Monkey Panel v1.6.1 mod
  • Search-by-Distance-SMP downloaded today, commit 4fb8de9

[BUG] 0 Graph score with empty tags

Hi,

Describe the bug
Is it an expected result to have a 0 Graph score with values like this? :

  • Reference track:
    Custom tag A: Psychedelic Rock
    Custom tag B: Funk; Lounge; Psychedelic Soul

  • Some tracks in the results with a 0 Graph score:
    Custom tag A : (empty, no values)
    Custom tag B : (empty, no values)

These custom tags A and B are the only ones with the "graph" type.

Additional context
I've lowered the setting Set Search method > Minimum in case there are not enough tracks... to 50.

I've checked that these genres are present in the descriptors file.

I can provide a detailed description if required.

I've also seen 0 Graph scores with empty tags on both sides. But maybe that's what's expected.

Idea: show in the console next to the score, if the "graph" tags are empty for these tracks.

Desktop

  • OS: Windows 10
  • foobar2000 v2.1.1 x86, new portable installation
  • Spider Monkey Panel v1.6.1-mod, new panel without settings
  • Search-by-Distance-SMP downloaded today, commit 954791f

No results with remapped tag

Hello Regor,

I can't get the customizable button to work since the changes due to foobar v2. As soon as I add a remapped tag, the results are often empty or almost empty playlists.

For example I do this :

  • Load the script buttons_search_bydistance_customizable.js
  • Wait for the calculation of the cache with the console
  • Name the button
  • Select the Graph method with the Ctrl + Shift menu
  • Test : it gives results, more or less
  • Add a custom tag : Ctrl + Shift menu > Remap tags > Set genre tag: GENRE,DISCOGS_GENRE
  • Reset link cache now ? Yes. Wait for the cache calculation with the console.
  • The results are empty playlists.

I tried several tags, several songs. I tried the options. I compared the results with the v3.1.0 release.
I tried with a new portable installation foobar v2.0 beta 12 x86 + Spider Monkey Panel v1.6.1 + the Search-by-Distance code downloaded two days ago. The button is used alone and there were no other settings before.

I saw in the js_data\tagsCache folder, after closing foobar, two files:
%GENRE%, %DISCOGS_GENRE%.json, with all tag values.
%GENRE, DISCOGS_GENRE%.json, with only question marks instead of values.

Another detail I saw: there is a setting Remove duplicates by : ["$ascii($lower($trim(%TITLE%)))","ARTIST","$year(%DATE%)"]
I feel like ARTIST is missing the percentage symbols : %ARTIST%.

Another remark (sorry it's not the bug but I take the opportunity): The Discogs genre Folk, World, & Country appears as "Folk", "World", "& Country". I saw that in the console too. It's a pretty important / common tag for them. This is not a request, it's just to point it out.

[BUG] Recipe error

Describe the bug
I use a customizable button. I create a recipe. When I run a search with this recipe, I get this error:

Error: Spider Monkey Panel v1.6.1-mod ({43278289-DA92-4882-9B7A-72C55888539A}: Playlist Tools: Buttons Bar v1.1.0 by regorxxx)
JSON.parse: unexpected character at line 1 column 1 of the JSON data

File: search_by_distance.js
Line: 895, Column: 31
Stack trace:
  searchByDistance@search_by_distance.js:895:31
  ["Search by Distance Customizable"]<@buttons_search_by_distance_customizable.js:81:5
  ThemedButton/this.onClick@buttons_xxx.js:604:21
  @buttons_xxx.js:964:21
  fireEvents/</<@callbacks_xxx.js:149:37
  fireEvents/<@callbacks_xxx.js:145:30

To reproduce
With a customizable button:

  1. Ctrl + click: Create recipe file with current config
  2. Enter Recipe name: my recipe
  3. Include tag remapping? Yes
  4. Also add additional variables? Yes
  5. The folder opens, the file is created.
  6. Ctrl + click: select "my recipe"
  7. Click on the button to do a search
  8. See error

Screenshot

Screenshot

1

Additional context
New portable installation with default settings.

my recipe.json

Another error when the recipe is selected, with Shift + click on the button

Error: Spider Monkey Panel v1.6.1-mod ({43278289-DA92-4882-9B7A-72C55888539A}: Playlist Tools: Buttons Bar v1.1.0 by regorxxx)
JSON.parse: unexpected character at line 1 column 1 of the JSON data

File: buttons_sbd_menu_config.js
Line: 42, Column: 23
Stack trace:
  createTagMenu/<@buttons_sbd_menu_config.js:42:23
  createTagMenu@buttons_sbd_menu_config.js:39:11
  createConfigMenu@buttons_sbd_menu_config.js:372:4
  ["Search by Distance Customizable"]<@buttons_search_by_distance_customizable.js:60:4
  ThemedButton/this.onClick@buttons_xxx.js:604:21
  @buttons_xxx.js:964:21
  fireEvents/</<@callbacks_xxx.js:149:37
  fireEvents/<@callbacks_xxx.js:145:30
Screenshot

2

System info

  • OS: Windows 10 x64 22H2
  • Related software: foobar2000 v2.2 preview 2024-03-14 x86, Spider Monkey Panel v1.6.1-mod
  • Github release: Search-by-Distance-SMP v7.2.0

bTagsCache is not defined

I have an error with the customizable button.

  • Load the script buttons_search_bydistance_customizable.js
  • Wait for the console to display : Calculating tags 100%. Calculating graph links 100%.
  • Name the button
  • Select a track and click on the button.
  • Wait 10 seconds.
  • Error
Error: Spider Monkey Panel v1.6.1 (Search by Distance Customizable Button: Search by Distance Customizable Button by xxx)
bTagsCache is not defined

File: remove_duplicates.js
Line: 256, Column: 6
Stack trace:
  removeDuplicatesV3@remove_duplicates.js:256:6
  do_searchby_distance@search_bydistance.js:955:23
  async*["Search by Distance Customizable"]<@buttons_search_bydistance_customizable.js:58:5
  themedButton/this.onClick@buttons_xxx.js:297:21
  @buttons_xxx.js:480:21
  fireEvents/</<@callbacks_xxx.js:148:37
  fireEvents/<@callbacks_xxx.js:145:30

Capture d'écran 129 foobar2000

This is a new button used alone, there was no other settings before. I tried with a new portable installation foobar2000 v2.0 beta 12 x86 + Spider Monkey Panel v1.6.1 + the current Search-by-Distance-SMP code downloaded today.

Didn't you restore an old version?
56efb59
e8cbbd5

I keep downloading the latest version because there is something I can't get to work with the previous version (add a custom tag in Genre with Graph method, I can make another report after this one if needed).

[FEATURE] Unlimited custom tag slots

Add support for unlimited custom tag slots. For strings/numbers.

Current approach mixes values from different tags, by design, which limits the usage of ML tags like those from AcousticBrainz:
#8 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.