Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: World-Map-SMP (Read 19274 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

World-Map-SMP

A foobar2000 UI Spider Monkey Panel which displays current artist's country on the world map and lets you generate autoplaylists based on selection and locale tag saving when integrated along WilB's Biography Script.


Features


  • Follow now playing track or selection.
  • Works with multiple selected tracks (draws all points on the map), allowing to show statistics of an entire playlist or library.
  • On playback the panel fetches tags from (by order of preference):
    • Track's tags.
    • Json database.
    • WilB's Biography panel.
  • Biography integration:
    • Done via script. There is a menu option to install the mod (it looks for the original file, edits the relevant lines and creates a backup). Is done step by step and can be reverted back.
      • Selection mode changes automatically when changing it on Biography panel, therefore syncing the changes.
      • Biography lets you write tags on demand, this lets you write tags as soon as the panel gets refreshed with new data.
      • Tool-tip shows multiple info about the points and tracks selected.
    • AutoPlaylist creation:
      • On click over a point, an autoplaylist is created with any artist on your library from the selected country.
      • key modifiers: forces an autoplaylist with artist from selected country AND same tags (3 configurable). Currently set to style/genre or both.


Also integrates
 1. Menu-Framework-SMP: Helper which allows to easily create customizable and dynamic menus.

Installation
Copy all files from the zip into YOUR_FOOBAR_PROFILE_PATH\scripts\SMP\xxx-scripts
Any other path WILL NOT work without editing the scripts. (see images_Installation_*jpg)
For ex: mine is c:\Users\xxx\AppData\Roaming\foobar2000\scripts\SMP\xxx-scripts...
For portable installations >= 1.6: .\foobar2000\profile\scripts\SMP\xxx-scripts...
For portable installations <= 1.5: .\foobar2000\scripts\SMP\xxx-scripts...
Then load 'world_map.js' into a SMP panel within foobar.

Download latest release (or nightly releases) at github:
https://github.com/regorxxx/World-Map-SMP[/list]

Re: World-Map-SMP

Reply #1
deleted - accidentally posted in the wrong place.


Re: World-Map-SMP

Reply #2
This is pretty cool, but one recommendation.

The map it uses is a bit odd, given that probably 70%+ of recorded music is from about 8% of the map area (US/EU) and I'm not aware of any recordings from Antarctica which is generously represented on the projection.

You put a lot of good work into this, it would be nice to see it better. :)

Re: World-Map-SMP

Reply #3
Hi there.
interesting projects!
@regor ,Is it possible to set the background color of the window to match the color of the main theme? (see picture).
Many thanks.

But the pointer does not appear on the map. WilB's script is integrated.
Can't figure out what's wrong?

Re: World-Map-SMP

Reply #4
This is pretty cool, but one recommendation.

The map it uses is a bit odd, given that probably 70%+ of recorded music is from about 8% of the map area (US/EU) and I'm not aware of any recordings from Antarctica which is generously represented on the projection.

You put a lot of good work into this, it would be nice to see it better. :)
I already offer a possibility to change the image to whatever you like, so... feel free to change it if you don't like it (?).
Cutting the map to not show Antarctica would break Mercator coordinates and make it incompatible with other standard maps, which also breaks the design decision to let users to change the image.

Not going that route unless I can support both, standard maps and maps without Antarctica, without needing to use different coordinates. Will take a look at it.

Re: World-Map-SMP

Reply #5
Hi there.
interesting projects!
@regor ,Is it possible to set the background color of the window to match the color of the main theme? (see picture).
Many thanks.

But the pointer does not appear on the map. WilB's script is integrated.
Can't figure out what's wrong?
As far as I know that's as easy as setting your panel right at appearance (transparency). Let me know if that works.

The other problem... I don't understand it without more data. Integration must be installed AND enabled. And obviously, the artists must have that data on last fm (or on the track's tag)... otherwise it does nothing.

Re: World-Map-SMP

Reply #6
I found a relatively easy way to adjust the coordinates according to a factor and it works.
So I cut the original map to not show Antarctica and put both options in a menu, along entries to edit the image path and factors.

X

The factors should work as long as the image is a mercator map (no matter if it's cut at any axis). For other projections, the entire coordinates table should be replaced.

Re: World-Map-SMP

Reply #7
## [1.1.0] - 2021-05-26
### Added
- Menu: Map image can be set via menus.
- Menu: 2 different map images are not offered by default, full and No Antarctica. Coordinates are re-scaled according to the crop when choosing the later.
- Map framework: Coordinates transformation has been added, allowing to use custom map images while using the default coordinates (plus a factor).
### Changed
- Map framework: updated with last changes.
- Menu framework: updated with last changes.
- Readme: updated some tips.
### Removed
### Fixed

Re: World-Map-SMP

Reply #8
## [1.1.1] - 2021-05-28
### Added
### Changed
- Menu framework: updated.
### Removed
### Fixed
- Changing image map did not ask automatically for X and Y coordinates factors.

Re: World-Map-SMP

Reply #9
v1.2.0 - File restructuring and cleanup
File restructuring update for compatibility with the other repositories.

## [1.2.0] - 2021-06-07
### Added
### Changed
- Helpers: Split 'helpers_xxx.js' file into multiple ones for easier future maintenance.
### Removed
### Fixed

Re: World-Map-SMP

Reply #10
As far as I know that's as easy as setting your panel right at appearance (transparency). Let me know if that works.
regor,
The background of the world map panel is still white.
And I hope you and WilB will be able to develop a version of the World-Map script that works without modifying the Bio script.
Thanks.

Re: World-Map-SMP

Reply #11
As far as I know that's as easy as setting your panel right at appearance (transparency). Let me know if that works.
regor,
The background of the world map panel is still white.
And I hope you and WilB will be able to develop a version of the World-Map script that works without modifying the Bio script.
Thanks.
The last bio version works fine BUT without a mod the selection can not be synchronized between the panels (therefore I add my own mod to solve that "limitation"). Without sel sync, if you change the selection mode in one panel, the other requires to be set manually too or things break.

It's on his side to change that, sorry (I mean.. I posted him the required changes, but people should ask for it, not me). Anyway I don't see it as a "problem"... my script installs the mod automatically and gives 0 problems. Manual installation is a matter of adding 1 line.
Next release will add latest bio integration and some readme tips about it.

About the background, If I set transparency, then it matches the background. I could obviously add a setting to change the color, but that still doesn't answer why it doesn't work for you. So check your config (columns UI or default UI?), since it has nothing to do with the script itself. I have zero idea about how the transparency setting works and it relates to UI, better to ask about it in SMP thread. I only know I use Columns UI and it works with the background color I have set.

X
X

Re: World-Map-SMP

Reply #12
If you want UI colours, you have to retrieve them using window.GetColourDUI / window.GetColourCUI. You'd want this as the first lines inside on_paint

Code: [Select]
var bg = window.InstanceType ? window.GetColourDUI(1): window.GetColourCUI(3);
gr.FillSolidRect(0, 0, window.Width, window.Height, bg);

Typically you'd want them to update whenever the user changes the settings too so you'd need this callback as well...

Code: [Select]
function on_colours_changed() {
window.Repaint();
}

Re: World-Map-SMP

Reply #13
If you want UI colours, you have to retrieve them using window.GetColourDUI / window.GetColourCUI. You'd want this as the first lines inside on_paint

Code: [Select]
var bg = window.InstanceType ? window.GetColourDUI(1): window.GetColourCUI(3);
gr.FillSolidRect(0, 0, window.Width, window.Height, bg);

Typically you'd want them to update whenever the user changes the settings too so you'd need this callback as well...

Code: [Select]
function on_colours_changed() {
window.Repaint();
}
My doubt is more why the transparency doesn't work for him? Since it works fine on my side (which makes all that unnecessary). Otherwise, yep, I would do that and also add a custom color option

Re: World-Map-SMP

Reply #14
Transparency has no effect in default UI. It will always be white unless you use FillSolidRect to draw your own colour.

The same goes inside a normal CUI splitter. It would be white too. Pretty sure only reason yours is grey is because its inside a tab stack.

The real purpose of pseudo transparent mode is for laying panels on top of Panel Stack Splitters which may have some image/text/colours you want to show through your own panels on top. Also, it's needed if you add SMP as a CUI toolbar.

JSP actually disables items that aren't available in DUI so there is no confusion.


Re: World-Map-SMP

Reply #15
Thanks! I had no idea at all how it worked, and yes.. as you have noted I use my script within a tab stack.

Then I will add the colors option and use UI/DUI as default and done.

EDIT: done for the next release.

Re: World-Map-SMP

Reply #16
v1.2.1 - Biograpy 1.2.X integration
Biograpy 1.2.X integration. Customizable background color. Minor improvements.
(*) Recommended to update all other scripts (Playlist Tools, Search by Distance, Playlist Manager) too. There have been major changes on those.


## [1.2.1] - 2021-06-15
### Added
- Biography Integration: Now works with Biograpy 1.2.X version too. 'Notify tags' must be enabled on Bio's config panel, the script will do it automatically when installing the mod. Appart from that, installation and selection mode sync works the same than 1.1.X series.
- Image: Added 2 map versions with black border (now the default ones).
- Colors: Option to change background color.
### Changed
- Portable: When properties are set for the first time, now use relative paths on profile folder for portable installations (>= 1.6).
- Data: json file for tags is now formatted to be readable.
- Biography Integration: Manually reloading Biography panel after installing the mod is no longer required, since it's done auttomatically after installing the mod.
- Image: 'No Antarctica map' (black border) is now the default one.
### Removed
### Fixed
- Menu: After setting a custom map image, panel was not being redrawn (requiring a manual update).
- Avoid possible crashes when tags json file get corrupted. Warns about it whit a popup.

Re: World-Map-SMP

Reply #17
 :)
Thanks regor and snotlicker!
The new version of the script looks great!
See picture MC_WorldMap1.jpg

A few points that would be great to consider for the next releases:
1. The country is marked on the map only if English is selected in the Bio. Is it possible for other languages?
2. I think the marker should be smaller. It is better if the type and color of the marker could be changed (for example, the option as in the picture map1.png)
3. Add the ability to display the name of the country (as an option in the picture).
4. Is the country marker not displayed for internet radio tracks?

Other than that, what does this message in the console mean?
World Map - Portable installation: replacing path 'wm_09.JSON filename (for tags)' with '.\profile\js_data\worldMap.json'

Re: World-Map-SMP

Reply #18
:)
Thanks regor and snotlicker!
The new version of the script looks great!
See picture MC_WorldMap1.jpg

A few points that would be great to consider for the next releases:
1. The country is marked on the map only if English is selected in the Bio. Is it possible for other languages?
2. I think the marker should be smaller. It is better if the type and color of the marker could be changed (for example, the option as in the picture map1.png)
3. Add the ability to display the name of the country (as an option in the picture).
4. Is the country marker not displayed for internet radio tracks?

Other than that, what does this message in the console mean?
World Map - Portable installation: replacing path 'wm_09.JSON filename (for tags)' with '.\profile\js_data\worldMap.json'
1. Bio gives you translated tags when using other languages, so instead of getting United Kingdom you get the translated name for the language set... and I have 0 plans to offer a table of all possible translations of every country name back to a coordinates table. If you want both, English tags and another displayed language, then... first retrieve tags in English mode, write those tags to the files and then change the language to yours. Both bio and this script offers tools to write the tags to the tracks or json. Or have 2 bio panels... one -hidden- in English for tags and another in your language for display. (or ask at the bio thread to add an option to configure separately tag language and displayed language)

2. It could be somewhat configurable on next release. But have in mind the point is clickable, a point too small would not be usable at all for that purpose.

3. The country name is on the tooltip. Also the map shows multiple points at the same time if you select multiple tracks, therefore showing the country name for all tracks selected at the same time would be horrible, cluttering all the map with text. If added, it has to be limited in some way, since it only makes sense when you select one track / follow now playing.

4. The map is using your file tags or data provided by Bio script. If your radio track does not provide a local tag, nope. The script is not retrieving tags from any other thing, so any problem with tracks not showing points... it's not the script fault. Obviously I would not expect a radio track to have a locale tag at all. Even bio integration is just an "addon". I created it to display tags already saved on tracks, it's the user's work to add those tags to their tracks or use bio as a workaround.

About your last question... thats a change added some releases ago, check the change-logs. You are using a portable installation, multiple warnings are given with popups about it when installing the script. If you have absolute paths set at properties, things will break when changing drive letters. So the script warns you about it to use relative paths. Change it to the proposed value or forget about it if you don't care or are using a portable installation on a fixed drive.

Re: World-Map-SMP

Reply #19
v1.2.2 - Bio Integration hotfix
Solved crash when bio 1.2.X package was not present. No more changes.


## [1.2.2] - 2021-06-21
### Added
### Changed
### Removed
### Fixed
- Biography Integration: crash when trying to install mod and 1.2.X  package was not present.

Re: World-Map-SMP

Reply #20
Quote
2. I think the marker should be smaller. It is better if the type and color of the marker could be changed (for example, the option as in the picture map1.png)
3. Add the ability to display the name of the country (as an option in the picture).
Next release will have these (3. only when selecting one track).

And also the possibility to set the locale tag by clicking on the map when the files have no tags. Much faster than typing country names on a tag editor, for sure... Tag may be saved directly to files or to the json database, as always. (*)

X

The map framework has been updated accordingly, so at some point you can expect something similar for cloud tags.

(*) The locale database could be shared in the future between users as a collaborative effort to fill the holes on last.fm database. Instead of requiring the bio panel, the offline database could be used once it contains all artists on your library. Merging databases from a few users would easily cover most popular artists in some time.

Re: World-Map-SMP

Reply #21
1. Bio gives you translated tags when using other languages, so instead of getting United Kingdom you get the translated name for the language set... and I have 0 plans to offer a table of all possible translations of every country name back to a coordinates table. If you want both, English tags and another displayed language, then... first retrieve tags in English mode, write those tags to the files and then change the language to yours. Both bio and this script offers tools to write the tags to the tracks or json. Or have 2 bio panels... one -hidden- in English for tags and another in your language for display. (or ask at the bio thread to add an option to configure separately tag language and displayed language)
I just noticed it.
Quote
2. It could be somewhat configurable on next release. But have in mind the point is clickable, a point too small would not be usable at all for that purpose.
Probably the transparent area of sensitivity to mouse click can be made larger than the point size.
Quote
3. The country name is on the tooltip. Also the map shows multiple points at the same time if you select multiple tracks, therefore showing the country name for all tracks selected at the same time would be horrible, cluttering all the map with text. If added, it has to be limited in some way, since it only makes sense when you select one track / follow now playing.
yes, probably limited to only one selected track.
Quote
4. The map is using your file tags or data provided by Bio script. If your radio track does not provide a local tag, nope. The script is not retrieving tags from any other thing, so any problem with tracks not showing points... it's not the script fault. Obviously I would not expect a radio track to have a locale tag at all. Even bio integration is just an "addon". I created it to display tags already saved on tracks, it's the user's work to add those tags to their tracks or use bio as a workaround.
I have the Bio script installed. But the World-Map-SMP script does not map the artist country for songs from radio streams. Additional verification may be needed.
Quote
About your last question... thats a change added some releases ago, check the change-logs. You are using a portable installation, multiple warnings are given with popups about it when installing the script. If you have absolute paths set at properties, things will break when changing drive letters. So the script warns you about it to use relative paths. Change it to the proposed value or forget about it if you don't care or are using a portable installation on a fixed drive.
Another way is a feature in the script for disabling the output of messages to the console.

regor,
Thank You for your work. And I wish you inspiration.

Re: World-Map-SMP

Reply #22
Quote
Probably the transparent area of sensitivity to mouse click can be made larger than the point size.
That would break things when points overlap and is non-intuitive ("why clicking outside the point does something?").

Quote
I have the Bio script installed. But the World-Map-SMP script does not map the artist country for songs from radio streams. Additional verification may be needed.
As noted that's a "problem" of Bio script. Report it there. I simply use the tags it provides, if it does not provide tags for some tracks (or radio streams) there is nothing to do on my side.

Quote
Another way is a feature in the script for disabling the output of messages to the console.
I'm not gonna disable it since it's relevant information for most users. The "proper fix" is setting relative paths as the warning notes, if it's a portable install, relative paths should be used. You can comment that line if it annoys you.

Comment this line at helpers_xxx_properties.js
Code: [Select]
console.log(window.Name + ' - Portable installation: property \  ....

Re: World-Map-SMP

Reply #23
Have updated the repository with all the latest changes to the UI customization (points, colors, etc.). If anyone want to test it, download the files directly from the repository not the releases.

X

X

(it's recommended to also download the latest files from the rest of my scripts, since I have changed all with major changes in Playlist Tools)

Changelog is up to date on github. Check unreleased.

Re: World-Map-SMP

Reply #24
I'm really liking this script!
I've already been keeping country tags for my library so I have no need to fetch them from the Biography script. How could I make the script read those? I store them in %country% using ISO 3166-1 alpha-2 codes.

Additionally, is there a way to choose the color of the spot indicating the location?