new plugin (cmod-xmplay)

Started by herotyc,

herotyc

Btw, today I made this plug-in

https://github.com/jllodra/cmod-xmplay

I made it for myself, but I though it could be interesting to someone.

Is there any chance it can get added to your plugins page? I'd say it's a general plugin.

Best wishes

herotyc

I have a question, is there any DDE command (or a combination of) that "adds a file to the playlist at th end and plays it". I have only seen "open" (plays a song clearing the playlist) and "list" (adds a song at the end of the playlist but it does not play the song)

Ian @ un4seen

Quote from: herotycBtw, today I made this plug-in

https://github.com/jllodra/cmod-xmplay

I made it for myself, but I though it could be interesting to someone.

Is there any chance it can get added to your plugins page? I'd say it's a general plugin.

That's nice work. Is there a particular reason for the "cmod" name? "xmp-modland" would seem more descriptive. Perhaps you're not using that because you plan to add support for other MOD repositories?

Another little suggestion is that you could use XMPlay's built-in download and unzip support, to simplify things and avoid writing temporary files. For example, like this:

XMPFILE file = xmpffile->Open("https://modland.com/allmods.zip|allmods.txt");
if (file) {
// read and process file here
xmpffile->Close(file);
}

Quote from: herotycI have a question, is there any DDE command (or a combination of) that "adds a file to the playlist at th end and plays it". I have only seen "open" (plays a song clearing the playlist) and "list" (adds a song at the end of the playlist but it does not play the song)

You could use the "key372" command to play the new track. A list of available "key" commands can be found on the support site, here:

    https://support.xmplay.com/article.php?id=113

It's also possible to change the "list" command's default behaviour via the "Play listed tracks" option in the "Integration" options page. The behaviour of the "open" command can also be changed there via the "Default action" option.

herotyc

> That's nice work. Is there a particular reason for the "cmod" name? "xmp-modland" would seem more descriptive. Perhaps you're not using that because you plan to add support for other MOD repositories?

Thanks. The name... I like the name because it honors to a textmode player I wrote when I was a young little man: https://github.com/jllodra/cmod

The idea of extending to other MOD repos is good, don't think I will have the time but the source is there if anyone is willing to put some effort!

> Another little suggestion is that you could use XMPlay's built-in download and unzip support, to simplify things and avoid writing temporary files.

Good one! Didn't know that. I really could rewrite the db rebuilding part and avoid writing files at all, I should do some resource locking too but nobody is perfect

> You could use the "key372" command to play the new track. A list of available "key" commands can be found on the support site, here:

I will try that, my intention is to be able to "add to playlist (at the end) and play", it saves me a click

> It's also possible to change the "list" command's default behaviour via the "Play listed tracks" option in the "Integration" options page. The behaviour of the "open" command can also be changed there via the "Default action" option.

Will investigate that too

---

Btw, someone reported a weird issue, my conclusion is that in its computer the `Plugin_Init` function did not run when the plugin initialized (`void *(WINAPI *New)();`). Do you have any idea why could be happening? I tested on 2 computers (win 10, win 11, and a sandboxed win 10), and worked perfectly! Here you can read the issue: https://github.com/jllodra/cmod-xmplay/issues/1




herotyc

I removed miniz and I'm using xmpffile->Open now. No issues so far, thanks

Ian @ un4seen

Quote from: herotycBtw, someone reported a weird issue, my conclusion is that in its computer the `Plugin_Init` function did not run when the plugin initialized (`void *(WINAPI *New)();`). Do you have any idea why could be happening? I tested on 2 computers (win 10, win 11, and a sandboxed win 10), and worked perfectly! Here you can read the issue: https://github.com/jllodra/cmod-xmplay/issues/1

A plugin's "New" function is only called when it's enabled by the user in the DSP/Plugins options, but a shortcut will work without that. So your OpenSearchShortcut function should first check that the plugin is currently enabled, ie. Plugin_Init has been called (and not Plugin_Exit). Alternatively, you could make it so the plugin doesn't need to be enabled by putting the initialization code in the OpenSearchShortcut function, and having Plugin_Init just display a "use the shortcut" message and fail (return 0).


Ian @ un4seen

This plugin is up on the support site now:

    https://support.xmplay.com/files_view.php?file_id=742

If you post version update notifications here then they can also be included in XMPlay's built-in update notifications.

herotyc

Quote from: Ian @ un4seenThis plugin is up on the support site now:

    https://support.xmplay.com/files_view.php?file_id=742

If you post version update notifications here then they can also be included in XMPlay's built-in update notifications.

Thanks Ian, can you give me a hint on how to implement the update notifications? is there any example in the xmp-sdk? Will try to do that next week probably

herotyc

Ah ok you meant I have to post updates manually here? I'm a bit confused, I have to do nothing then, just post the new .zip here?

Ian @ un4seen

Yeah, you would post a notice here when a new version of the plugin is available, and then that info can be included in XMPlay's update notifications. You wouldn't need to post the files, as they can be fetched from your GitHub repo.

Btw, as the plugin doesn't need to be enabled in the DSP/Plugins options, I think it would be a good idea to prevent it being enabled by having your Plugin_Init function just return NULL. You could also add an About function that tells to set a shortcut key, for users that don't bother with "readme" files :)

herotyc

Quote from: Ian @ un4seenYeah, you would post a notice here when a new version of the plugin is available, and then that info can be included in XMPlay's update notifications. You wouldn't need to post the files, as they can be fetched from your GitHub repo.

Btw, as the plugin doesn't need to be enabled in the DSP/Plugins options, I think it would be a good idea to prevent it being enabled by having your Plugin_Init function just return NULL. You could also add an About function that tells to set a shortcut key, for users that don't bother with "readme" files :)

Sure, will do in the next version

herotyc

Hi Ian, hope this message finds you well.



I have been working today in the plugin. I have implemented your suggestions, I will release a version as soon as I have tested everything.

I would like to ask you something: is there any way that I can customize the "Track column" to display something like a Regular expression. I would love to isolate the tracker name, the artist and the song name. That would be a phenomenal feature! I don't see more options in "Display columns".

Also, I have another question, is it possible to resize the xmplay window? I would like to make it larger, horizontally to be precise.

Thanks, best!

Ian @ un4seen

Quote from: herotycI would like to ask you something: is there any way that I can customize the "Track column" to display something like a Regular expression. I would love to isolate the tracker name, the artist and the song name. That would be a phenomenal feature! I don't see more options in "Display columns".

From the screenshot, it looks like you currently have the track column set to "Full path". If you set it to "Title" then you can set the column's format in the "Titles" options page, but that needs the file's tags to have been read to fully work (it can fallback to filenames without tags). Tags are pre-read from local files, but internet file tags are only read when the file is played.

Another option could be to generate a playlist and pass that (instead of individual files) to XMPlay, which will allow you to include a preformatted title with each entry. But note those titles will be replaced (according to the mentioned "Titles" options page setting) once the tags have been read.

Quote from: herotycAlso, I have another question, is it possible to resize the xmplay window? I would like to make it larger, horizontally to be precise.

The main window can't be resized (without modifying the skin), but a resizable playlist is available in the info window (press F5 to open that).

herotyc

Quote from: Ian @ un4seenTags are pre-read from local files, but internet file tags are only read when the file is played.

Quote from: Ian @ un4seenBut note those titles will be replaced (according to the mentioned "Titles" options page setting) once the tags have been read.

Yes, I am aware of this. And this is the reason I preferred to go "Full path". I have more information in the "Full path" and I enjoy it most.

Quote from: Ian @ un4seenThe main window can't be resized (without modifying the skin), but a resizable playlist is available in the info window (press F5 to open that).

Nice, this is way better than nothing!

I would still some some regexp for the "Full path", but I understand this feature can be quite offtopic.

-----------

By the way, I just released the 1.3.0.0 version:

Do you mind grabbing the new files here? https://github.com/jllodra/cmod-xmplay/releases/tag/v1.3.0.0

I have been testing, and no issues so far.

I did a bit of refactoring too, and I think this plug-in is "feature complete", and code is "good enough" so I will only maintain it from now. Unless someone comes with any great feature I could add and I did not think of.

The changelog is:

refactor: improve SQLite extension integration and error handling

feat: store database build date and display database build date in title

feat: implement check for updates and fix search (database search works better)


----

Thank you


Ian @ un4seen

Quote from: herotyc
Quote from: Ian @ un4seenBut note those titles will be replaced (according to the mentioned "Titles" options page setting) once the tags have been read.

Yes, I am aware of this. And this is the reason I preferred to go "Full path". I have more information in the "Full path" and I enjoy it most.

Extending the earlier playlist idea, you could also try setting XMPlay's title format to an empty string. I think that'd mean the playlist's titles don't get replaced when the file tags are read.

Quote from: herotycBy the way, I just released the 1.3.0.0 version:

Do you mind grabbing the new files here? https://github.com/jllodra/cmod-xmplay/releases/tag/v1.3.0.0

Yep, it's been up on the support site since yesterday :)

herotyc

Quote from: Ian @ un4seenExtending the earlier playlist idea, you could also try setting XMPlay's title format to an empty string. I think that'd mean the playlist's titles don't get replaced when the file tags are read.

Really? This looks like exactly what I want to do, right?

How is that done, issuing DDE commands? Can you give me comprehensive example of them? Or do I need to write a playlist file in disk and then load the file using DDE (that would make it a bit cumbersome but, if the result has to be perfect, I am definitely not against).

Would this have any side-effect in my library? I mean, when I head a song I like, I tend to add it to a library. What would be the outcome then?

Thanks

Ian @ un4seen

Yeah, you would write a temporary playlist (eg. in the GetTempPath folder) containing all of the files (and titles) that you want, and then pass that to XMPlay in the same way as you would a single file. The playlist could be in either M3U or PLS format. For example, an M3U playlist could look like this:

#EXTINF:,title1
http://server/path/file1
#EXTINF:,title2
http://server/path/file2

If you know the lengths, you can also include that (in seconds) before the comma in the "#EXTINF" lines.

The library doesn't use the formatted title, so disabling updates (with the empty string) won't make any difference there.

herotyc

I implemented this using a PLS, but the results are not the expected.

[playlist]
File1=https://modland.com/pub/modules/Impulsetracker/Herotyc/biowaves.it
Title1=Herotyc - biowaves
Length1=-1
...

Technically, this works. But if I had played (not saved in the library, just played) any song before this, I still get the "module name" in the playlist.

I made some tests, and if I remove xmplay.library, it works.

But I lost my library with all my saved mods! So, this is not a solution

herotyc

I kind of workaround this by exporting my lib to pls, and then reimported.

I think this is "okeyish", so, personally, I am happy. I will try to explain this in the README.

Btw, I don't know if there is any kind of editor/browser for the .library file. It does not seem to be an sqlite file, looks more like a marshalled structure.

I would love to be able to fill the "artist" field. Does m3u support an artist field that xmplay can read?

herotyc

I have one last question before releasing a new version.

Why when I issue a DDE open/list with a pls, it autoselects the whole songs in the playlist? Is there a setting to turn this behaviour off?

Or should I issue a new DDE command to unselect all? I cannot find the exact DDE message for that

herotyc

I used this combination and works:

    xmpfmisc->DDE("key341");
    xmpfmisc->DDE("key342");

herotyc

I released 1.4.0.0 and updated the readme.md file, thanks

Ian @ un4seen

Quote from: herotycI implemented this using a PLS, but the results are not the expected.

[playlist]
File1=https://modland.com/pub/modules/Impulsetracker/Herotyc/biowaves.it
Title1=Herotyc - biowaves
Length1=-1
...

Technically, this works. But if I had played (not saved in the library, just played) any song before this, I still get the "module name" in the playlist.

I made some tests, and if I remove xmplay.library, it works.

But I lost my library with all my saved mods! So, this is not a solution

In addition to the library entries, the XMPLAY.LIBRARY file also contains info (including the formatted title) for the current playlist entries. When XMPlay already has a formatted title for a file, that will be used instead of the title in a PLS file. So any files in the library/playlist that you played before clearing the "Title format" setting would still show the old formatted title. To prevent that, you would need to remove any already played library/playlist entries and then restart XMPlay.

If the played entries are only in the playlist then you can get rid of them from XMPLAY.LIBRARY by emptying the playlist and restarting XMPlay. If the entries are in the library then you will need to remove those library entries and restart XMPlay. Or export the library to a playlist file, close XMPlay, delete XMPLAY.LIBRARY, restart XMPlay and re-import the library. As you did.

Btw, if a file's length is unknown then you can omit the "Length" entries from your PLS file (they're optional). As with the formatted titles, XMPlay will use known length info from the library/playlist.

Quote from: herotycBtw, I don't know if there is any kind of editor/browser for the .library file. It does not seem to be an sqlite file, looks more like a marshalled structure.

I'm not aware of any XMPLAY.LIBRARY file editor, but if you would like to do something to it yourself, its format is described here:

    https://support.xmplay.com/article.php?id=101

Quote from: herotycI would love to be able to fill the "artist" field. Does m3u support an artist field that xmplay can read?

Unfortunately, it isn't currently possible to set any tags in a playlist file (M3U or PLS). But you can edit the tags stored in the library via the "Track info" window (tick the "Override" box), if that'll help.

Quote from: herotycI released 1.4.0.0 and updated the readme.md file, thanks

Great! I was just about to put it up on the support site, but noticed that the xmp-cmod.dll versioninfo still says "1.3.0.0". Perhaps you accidentally uploaded an old version?

Regarding the new "use_pls" configuration option, you could store that in XMPLAY.INI instead of a separate INI file by using the XMPFUNC_REGISTRY functions. That'll make it compatible with the "Store per-user config/etc" option. It may not really matter in this case, but perhaps it will in future if you add more config options.

herotyc

Quote from: Ian @ un4seenGreat! I was just about to put it up on the support site, but noticed that the xmp-cmod.dll versioninfo still says "1.3.0.0". Perhaps you accidentally uploaded an old version?

Regarding the new "use_pls" configuration option, you could store that in XMPLAY.INI instead of a separate INI file by using the XMPFUNC_REGISTRY functions. That'll make it compatible with the "Store per-user config/etc" option. It may not really matter in this case, but perhaps it will in future if you add more config options.

I might have picked the wrong dll or forgot to rebuild. I will reupload that tomorrow.

If I use configurations in the future, I will investigate the XMPFUNC_REGISTRY funcs. Atm, I consider this plugin as feature complete (I made the use_pls to have a fallback in case PLS was not perfect), I cannot think of any other useful and doable feature I'd like to have.