HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: regor on 2021-05-13 11:52:34

Title: World-Map-SMP
Post by: regor on 2021-05-13 11:52:34
World-Map-SMP (https://github.com/regorxxx/World-Map-SMP)
(https://img.shields.io/github/release/regorxxx/World-Map-SMP.svg?include_prereleases) (https://github.com/regorxxx/World-Map-SMP/blob/main/CHANGELOG.md)(https://www.codefactor.io/repository/github/regorxxx/World-Map-SMP/badge/main) (https://www.codefactor.io/repository/github/regorxxx/World-Map-SMP/overview/main)(https://api.codacy.com/project/badge/Grade/d68ef528f77646bca546fd206d28e8a1) (https://www.codacy.com/gh/regorxxx/World-Map-SMP/dashboard?utm_source=github.com&utm_medium=referral&utm_content=regorxxx/World-Map-SMP&utm_campaign=Badge_Grade)(https://img.shields.io/github/license/regorxxx/World-Map-SMP) (https://github.com/regorxxx/World-Map-SMP/blob/main/LICENSE)
A foobar2000 UI Spider Monkey Panel (https://theqwertiest.github.io/foo_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 (https://hydrogenaud.io/index.php?topic=112914.0).

(https://user-images.githubusercontent.com/83307074/116752367-002d9100-a9f5-11eb-8a03-0ee323634742.gif)

Features

(https://user-images.githubusercontent.com/83307074/116752374-01f75480-a9f5-11eb-9d30-a9958079b1ee.gif)

(https://user-images.githubusercontent.com/83307074/116752378-03c11800-a9f5-11eb-9971-b3eff6e8d0fa.gif)

Also integrates
 1. Menu-Framework-SMP (https://github.com/regorxxx/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]
Title: Re: World-Map-SMP
Post by: rolf1955 on 2021-05-13 20:57:22
deleted - accidentally posted in the wrong place.

Title: Re: World-Map-SMP
Post by: mjm716 on 2021-05-15 01:44:59
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. :)
Title: Re: World-Map-SMP
Post by: Sergey77 on 2021-05-15 14:07:58
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?
Title: Re: World-Map-SMP
Post by: regor on 2021-05-17 23:45:10
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-05-17 23:48:20
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-05-18 17:19:34
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-05-26 20:55:01
## [1.1.0] - 2021-05-26 (https://github.com/regorxxx/World-Map-SMP)
### 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
Title: Re: World-Map-SMP
Post by: regor on 2021-05-28 21:51:51
## [1.1.1] - 2021-05-28 (https://github.com/regorxxx/World-Map-SMP)
### Added
### Changed
- Menu framework: updated.
### Removed
### Fixed
- Changing image map did not ask automatically for X and Y coordinates factors.
Title: Re: World-Map-SMP
Post by: regor on 2021-06-07 19:34:18
v1.2.0 - File restructuring and cleanup (https://github.com/regorxxx/World-Map-SMP)
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
Title: Re: World-Map-SMP
Post by: Sergey77 on 2021-06-13 14:26: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.
Title: Re: World-Map-SMP
Post by: regor on 2021-06-13 15:38:04
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
Title: Re: World-Map-SMP
Post by: snotlicker on 2021-06-13 15:58:19
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();
}
Title: Re: World-Map-SMP
Post by: regor on 2021-06-13 16:00:40
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
Title: Re: World-Map-SMP
Post by: snotlicker on 2021-06-13 16:08:15
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.

(https://i.imgur.com/RD5FMgB.png)
Title: Re: World-Map-SMP
Post by: regor on 2021-06-13 16:13:46
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-06-15 17:31:27
v1.2.1 - Biograpy 1.2.X integration (https://github.com/regorxxx/World-Map-SMP)
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.
Title: Re: World-Map-SMP
Post by: Sergey77 on 2021-06-16 15:28:12
 :)
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'
Title: Re: World-Map-SMP
Post by: regor on 2021-06-21 00:01:56
:)
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-06-21 00:11:13
v1.2.2 - Bio Integration hotfix (https://github.com/regorxxx/World-Map-SMP)
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-07-12 20:18:18
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.
Title: Re: World-Map-SMP
Post by: Sergey77 on 2021-07-13 16:19:28
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.
Title: Re: World-Map-SMP
Post by: regor on 2021-07-13 20:16:01
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 \  ....
Title: Re: World-Map-SMP
Post by: regor on 2021-07-15 21:53:10
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.
Title: Re: World-Map-SMP
Post by: dreampillet on 2021-07-17 00:35:37
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?
Title: Re: World-Map-SMP
Post by: regor on 2021-07-17 10:02:22
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?
Download the latest files as noted on the previous reply. Have not created a release yet, but the latest version already allows that (see images blu-orange!).

About tags, right now it uses locale tag. Just put "country" on the properties panel, its configurable. I think it's the first entry (read the descriptions).
Title: Re: World-Map-SMP
Post by: regor on 2021-07-17 11:54:50
Updated again the repository.

Now locale tag may be rewritten by pressing Shift + L. Click on the map (when it already has a tag) -on JSON or Tags- (*). Previously it was only allowed when tag was missing. Therefore the map now has full tagging capabilities, allowing to rectify whatever Bio script provides (sometimes artist names have multiple matches and wrong tags are provided, this fixes it).

X

(*) Saves the country names, not ISO codes. I may add a config to switch between both.

EDIT: @dreampillet note that you may have to use "$meta(country,$sub($meta_num(country),1))" instead of just "country" if you have multiple values on the same tag. Right now the locale tag does not only store the country name, but city, province, etc. and It simply takes the last value as country.
Title: Re: World-Map-SMP
Post by: regor on 2021-07-19 18:37:11
Updated again the repository:
- Tools to report all artist without a locale tag on JSON database/tags for easy tagging, manually or automatically. Meant to be used along macros -autohotkey, etc.- and BIO script, to get the bio for every artist automatically.
Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#Persistent
SetTimer, foobar2000Preview, 15000
return

foobar2000Preview:
WinActivate foobar2000
Send {Down}
return
- Possibility to merge an external json file with current database.
- A database example is now shared on the repository. The idea is it may be merged with other user's databases and at some point it may be enough to get locale tags for most popular artists without bio script or online collection.
- Possibility to write all locale tags from current library tracks to the current database.
- Possibility to write all locale tags from database back to library tracks.
- Header text size configurable.
- Minor bugfixes.
Title: Re: World-Map-SMP
Post by: regor on 2021-07-24 20:56:04
Have updated the repository with minor bugfixes. Added an AutoHotekey script to get locale country tags.

If anyone want to test it, download the files directly from the repository not the releases. Please have in mind the relative path bug on SMP has not been solved yet, so I have no idea if it will work for you!
(it's recommended to also download the latest files from the rest of my scripts in that case, since I have changed all with major changes)
Title: Re: World-Map-SMP
Post by: Koshingg on 2021-07-25 12:13:44
regor, can we have this little flag (like in the Georgia Reborn theme) ?
I assume it's a SMP script? We can put that little flag anywhere in our foobar config  We already have the tags with the countries, we already have the flags (png images)
Title: Re: World-Map-SMP
Post by: regor on 2021-07-25 16:13:45
Where do you suggest to add it on the panel?
X

Not fan of flags but wIll look at the theme, if the png are there associated to ISO codes it would be trivial to add them.
Title: Re: World-Map-SMP
Post by: Koshingg on 2021-07-25 21:30:53
"Where do you suggest to add it on the panel?"

I don't know...maybe somewhere up, to the right? And maybe a setting, to activate this option or not ( for those that don't like the flags)
Or, if it doesn't look good in this script with the map, maybe a separate little script? This way we can put that little SMP panel with the flag wherever we want in our theme (near the little red heart for Lastfm, or in a toolbar, or in other places)
Title: Re: World-Map-SMP
Post by: regor on 2021-07-26 15:12:55
A separate script would be a no since it would also require some way to retrieve tracks from BIO or the map panel database, so it would be a plugin of a plugin... and I find it unnecessarily complex.

Btw just finished implementing a new mode for the panel: library mode, which displays all the countries from the entire library artists database  instead of following selection/playback. Clicking on a point creates playlists from that country (+genre, styles, etc.  according to keys pressed). Tooltip shows all artist on library from that country.

This is an easy way to see the current statistics for every country, instead of selecting the entire library and setting display mode to selection. Which also doesn't work as expected since I imposed a selection limit due to performance reasons (it checks tags by tracks one by one). The library database is cached and not updated on real time, so it works without performance penalties. (may be updated on demand)

X
Title: Re: World-Map-SMP
Post by: regor on 2021-07-27 10:37:37
Got it.

X
SimplePortal 1.0.0 RC1 © 2008-2021