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: COM Automation Server for 0.9 (Read 593109 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

COM Automation Server for 0.9

Reply #50
I would say it is still struggling for development time with all my other components.

COM Automation Server for 0.9

Reply #51
Ok thanks  Good luck

COM Automation Server for 0.9

Reply #52
can anyone tell me how to get this working with the G15?

COM Automation Server for 0.9

Reply #53
Well if you using windows API you can use GetAsyncKeyState one
You just have to put a number as an argument wich correspond to a key on your keyboard, when the return value is different from 0, that's mean the key had been pressed since you check GetAsyncKeyState before  This is really a simple API to use
In wich language do you need to use foo_comserver?

COM Automation Server for 0.9

Reply #54
I'm having a problem when I try to format a track with "%disc%" and the track doesn't have any disc tag.

In this case, I'm getting a OutOfMemoryException (if using with .NET) or an OutOfMemory Error (if using with vbs)

here's a vbs to show this (based on test-medialibrary.vbs from foosion's examples). See comments inside.

Code: [Select]
option explicit

dim fb2k, ml
dim t1, t2

SetupTest

'Get all tracks in media library
set t1 = ml.GetTracks()

'CHANGE
'Get a track with no disc tag. Change the index appropriately
set t2 = t1(93)

'OK, return the title
WScript.Echo t2.FormatTitle("%title%")

'OK, the track doesn't have a tag named %blabla%, so it returns '?'
WScript.Echo t2.FormatTitle("%blabla%")

'ERROR, the track doesn't have a %disc% tag, and an OutOfMemory error
'(OutOfMemoryException in .NET) is raised
WScript.Echo t2.FormatTitle("%disc%")

CleanupTest

WScript.Echo "Done"
WScript.Quit

rem *********************************************************
rem * helpers functions
rem *********************************************************

sub SetupTest()
dim ProgID
ProgID = "Foobar2000.Application.0.7"
rem WScript.Echo "Looking for existing instance..."
set fb2k = WScript.GetObject("", ProgID)
if isnull(fb2k) then
rem WScript.Echo "Creating new instance..."
set fb2k = WScript.CreateObject(ProgID)
if isnull(fb2k) then
WScript.Echo "Failed to get foobar2000 application object."
WScript.Quit
end if
end if
set ml = fb2k.MediaLibrary
if isnull(ml) then
WScript.Echo "Failed to get foobar2000 media library object."
WScript.Quit
end if

rem save settings
end sub

sub CleanupTest()
rem restore settings
end sub

Anyone else having this problem?

COM Automation Server for 0.9

Reply #55
Same here.

COM Automation Server for 0.9

Reply #56
First, thanks for this foobar2000 components, it's really helpful

Second, I'm developping a foobar2000 remote control for Yahoo! Widget Engine (YWE) using the COM server. YWE use javascript language, I also used JScript to test the component. So I can provide a JScript test script if you want.

Third, it seems that there are issues with the getters of the component. Here are two examples.

Code: [Select]
foobarObj.Playback.SeekRelative(10.0);

This code doesn't seem to work well in YWE, maybe it's just a YWE bug. I have a microsoft error report window. I had also an issue with JScript but I'm unable to reproduce the bug.

Also, consider this code:
Code: [Select]
// ...

// CONNECT/DISCONNECT
// connect to Foobar2000
function connect() {
    try {
        foobarObj = WScript.createObject(foobarID); // connect to Foobar2000
        fooPlayback = foobarObj.Playback;
        fooSettings = fooPlayback.Settings;
        foobarObj.Minimized = true; // start minimized
        WScript.connectObject( fooPlayback, "Playback_"); // playback event sink
        WScript.connectObject( fooSettings, "Playback_"); // playback event sink
    }
    catch(ex) {
    WScript.echo("COM createObject failed: '"+ex+"', "+ex.name + ": " + ex.message);
    }
};

// disconnect Foobar2000 event sink
function disconnect() {
    WScript.disconnectObject(fooSettings);
    WScript.disconnectObject(fooPlayback);
};

// EVENT HANDLERS
function Playback_Started( bPaused ) {
  // this line is ok
  //WScript.echo("foobar started with volume " + fooSettings.Volume + " dB");

  // this line does not work
  WScript.echo("foobar started with volume " + fooPlayback.Settings.Volume + " dB");
};


In the event handler, the first line is ok, the second one lead to an exception. And, in fact, I had a number of problems whenever I used the XXX.YYY.ZZZ syntax. I was excepting all objects were singletons but it does not seem to be true at all. Is this normal?

Edit: another remark, titleformat support is incomplete in the FormatTitle method, will it be improved?

COM Automation Server for 0.9

Reply #57
Code: [Select]
foobarObj.Playback.SeekRelative(10.0);

This code doesn't seem to work well in YWE, maybe it's just a YWE bug. I have a microsoft error report window. I had also an issue with JScript but I'm unable to reproduce the bug.
This works fine for me when run in csript.exe.

Also, consider this code:
Code: [Select]
<snip>


In the event handler, the first line is ok, the second one lead to an exception. And, in fact, I had a number of problems whenever I used the XXX.YYY.ZZZ syntax. I was excepting all objects were singletons but it does not seem to be true at all. Is this normal?
I can reproduce this problem with cscript.exe, though I'm currently not sure what's causing it. I'll post more information once I've had time to investigate this further.

Edit: another remark, titleformat support is incomplete in the FormatTitle method, will it be improved?
I'm not sure what you are referring to. If this is about track objects not supporting playlist specific or dynamic information, well, that is intended. If you want dynamic information, you should use the titleformatting method on the Playback object and specify the desired display level.

COM Automation Server for 0.9

Reply #58
Quote
Also, consider this code:
Code: [Select]
<snip>


In the event handler, the first line is ok, the second one lead to an exception. And, in fact, I had a number of problems whenever I used the XXX.YYY.ZZZ syntax. I was excepting all objects were singletons but it does not seem to be true at all. Is this normal?
I can reproduce this problem with cscript.exe, though I'm currently not sure what's causing it. I'll post more information once I've had time to investigate this further.


In fact, I use wscript that way: wscript //E:Jscript FooTest.js . The problems appear in wscript, I never tried cscript.

Quote
Edit: another remark, titleformat support is incomplete in the FormatTitle method, will it be improved?
I'm not sure what you are referring to. If this is about track objects not supporting playlist specific or dynamic information, well, that is intended. If you want dynamic information, you should use the titleformatting method on the Playback object and specify the desired display level.


Can you tell me a bit more about display levels? I may have missed something since I can't figure what it is for? In fact, I tried to use %playback_time% in Playback.FormatTitle() and a question mark appeared.

COM Automation Server for 0.9

Reply #59
Can you tell me a bit more about display levels? I may have missed something since I can't figure what it is for? In fact, I tried to use %playback_time% in Playback.FormatTitle() and a question mark appeared.

From foobar2000.idl:
Code: [Select]
/**
* Display level codes. Controls level of playback related information that is visible.
*/
[
    helpstring("fbDisplayLevel Enumeration")
]
enum fbDisplayLevel
{
    /** No playback-related info */
    fbDisplayLevelNone   = 0,
    /** Static info and is_playing/is_paused stats */
    fbDisplayLevelBasic  = 1,
    /** Like fbDisplayLevelBasic plus dynamic track titles on e.g. live streams */
    fbDisplayLevelTitles = 2,
    /** Like fbDisplayLevelTitles plus timing and VBR bitrate display etc */
    fbDisplayLevelAll    = 3,
};

You use this with the FormatTitleEx() method on the Playback object.

COM Automation Server for 0.9

Reply #60
Oops, sorry, I got my IDL file from Microsoft OLE/COM object browser instead of looking at the one distributed with the component, so there was no comment. Me dumb

COM Automation Server for 0.9

Reply #61
I found the problem with the getter for the Settings property. The key points are as follows:
  • Some of the COM objects are not singletons and are only created when needed. This is to avoid having (foobar2000) event handlers registered when no (COM) listeners are registered for those.
  • Creating a Settings object causes it to register an event handler for volume changes. However, registering event handlers inside event handlers is not allowed (foobar2000 0.9.3 actively checks for this).
I'm working on a fix now that does not break the current COM API, since that would require too much time right now. For the next version, I plan to make event sources separate (non-singleton) objects. The main ideas are that you can access the API without fear of accidentally registering an event handler on the foobar2000 side, and that you will be able to specify which events you are interested in. Right now, the server makes a (blocking) IPC even for events that you do not handle.

COM Automation Server for 0.9

Reply #62
I found the problem with the getter for the Settings property. The key points are as follows:
  • Some of the COM objects are not singletons and are only created when needed. This is to avoid having (foobar2000) event handlers registered when no (COM) listeners are registered for those.
  • Creating a Settings object causes it to register an event handler for volume changes. However, registering event handlers inside event handlers is not allowed (foobar2000 0.9.3 actively checks for this).
I'm working on a fix now that does not break the current COM API, since that would require too much time right now. For the next version, I plan to make event sources separate (non-singleton) objects. The main ideas are that you can access the API without fear of accidentally registering an event handler on the foobar2000 side, and that you will be able to specify which events you are interested in. Right now, the server makes a (blocking) IPC even for events that you do not handle.


Ok, thanks for your tech support

COM Automation Server for 0.9

Reply #63
Version 0.7 alpha 6 of foo_comserver2 is available on my components page now.

It should fix problems with using playback related interfaces from callbacks. It also checks whether it is properly registered on startup. (This is meant for the situation where you have multiple foobar2000 with foo_comserver2 for some reason.) There is now a preferences page where you can view the registration and running state of the server and helper objects (Tools/COM Automation server).

Note that this version requires foobar2000 0.9.3.

COM Automation Server for 0.9

Reply #64
That's a great news!!!!  Can we hope see more news like that in future?  Thanks

COM Automation Server for 0.9

Reply #65
I still have the same SeekRelative problem with the new version but the bug may come from Yahoo! Widget Engine, so I'll tell you more about this issue when the next version of YWE is out!

COM Automation Server for 0.9

Reply #66
Nice to see more updates to this. Good work, foosion

COM Automation Server for 0.9

Reply #67
I've been attempting to get this to work using PHP 5, using the following code...
Code: [Select]
<?php

$foobar2000 = new COM("Foobar2000.Application.0.7");
$foobar2000->Playback->FormatTitle("%artist% - %title%");    
    
?>


Obviously very simple. But the script just hangs for a minute or two and then responds with:

Quote
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Foobar2000.Application.0.7': Server execution failed ' in D:\Server\www\nightiguana\com.php:5 Stack trace: #0 D:\Server\www\nightiguana\com.php(5): com->com('Foobar2000.Appl...') #1 {main} thrown in D:\Server\www\nightiguana\com.php on line 5


My guess is that PHP 5's com support is messed up, since I can't really access any COM objects, or that I have something setup wrong.

EDIT: I've tested PHP 5's COM support and it created a word document for me, so COM seems to be working.

COM Automation Server for 0.9

Reply #68
I just installed a fresh copy of PHP 5.1.5. The above script works flawlessly, when I invoke the PHP interpreter from the command line ("php.exe -f test.php"). Do any of the included examples work for you?

COM Automation Server for 0.9

Reply #69
As I've re-wrote my code, I no longer use the PHP COM to do my bidding, I have written a VB app which works as a proxy between the web server and foobar by using XMLHTTPRequest to send song updates to the server, which the server then generates the now playing image.

Foosion, attempt to install the latest Apache server, and try running the script as a php file from the web browser. I may just have Apache/PHP set up wrong, but it doesn't apply anymore as I'm using a different approach.

COM Automation Server for 0.9

Reply #70
Hi,

I'm currently writing a c# client to control foobar from a remote pc. Are you planning to implement these features:

- Play track at playlist index
- Select track at playlist index
- Add / enqueue tracks to playlist

Would be great!

Sebastian

COM Automation Server for 0.9

Reply #71
Good plugin, saves trying to work with the foobar SDK. Thank you.

Hi,

I'm currently writing a c# client to control foobar from a remote pc. Are you planning to implement these features:

- Play track at playlist index
- Select track at playlist index
- Add / enqueue tracks to playlist

Would be great!

Sebastian


Like Sebastian, I am also looking for the object model to be updated to include add and remove a track from the active playlist. If you could consider this update for your next release it would be appreciated.

Regards,
Dean

 

COM Automation Server for 0.9

Reply #72
As I've re-wrote my code, I no longer use the PHP COM to do my bidding, I have written a VB app which works as a proxy between the web server and foobar by using XMLHTTPRequest to send song updates to the server, which the server then generates the now playing image.

Foosion, attempt to install the latest Apache server, and try running the script as a php file from the web browser. I may just have Apache/PHP set up wrong, but it doesn't apply anymore as I'm using a different approach.

Is your Apache running as a service, and if so, is it configured to run as the same user account as foobar2000? I think the default Apache service is configured to run as a network service, and it's possible that this COM server does not work across user accounts.

COM Automation Server for 0.9

Reply #73
Nice work.

I have a question: Is it possible or planned to modify the contents of a playlist, or retrieve the currently playing index (if any), and so on?

Unless I'm wrong IVBTracks/IVBTrack allow to enumerate/query various info, but not what I need here.

COM Automation Server for 0.9

Reply #74
I believe foosion is working on that part, I'm not exactly sure though.