URL/API Source: Live Data, Media and AI on OBS Made Simple

URL/API Source: Live Data, Media and AI on OBS Made Simple v0.3.5

royshilkrot

Member
I have an issue with the image grabbing feature.
I am using this url to grab images https://bxbin.com/BxFlipTV/xml/PicturePerfect.php
My type is set to HTML and I am looking for .image

My issue is, it pulls the urls for both of the images, but I can only make {{output0}} show by pressing output is image url.
Is there a solution for me?
Sure, we can help. You can join us in the support discord server https://discord.gg/SKy59fEs
it would be easier than to do it here
 

lifecoach

New Member
Is there a way to input a Local File and read the document where I place the weburl and then do a HTTP parsing? Seccond questions: If I do more {{outputN}} as the parser get everyhing stand in {{output1}} 2 and so on. I've done a workarround imorted 9 additiona source-urls. Is there a workaround to get the output1-x only from filled fields and hide {{outputt250}} if output is empty?
 

royshilkrot

Member
Is there a way to input a Local File and read the document where I place the weburl and then do a HTTP parsing? Seccond questions: If I do more {{outputN}} as the parser get everyhing stand in {{output1}} 2 and so on. I've done a workarround imorted 9 additiona source-urls. Is there a workaround to get the output1-x only from filled fields and hide {{outputt250}} if output is empty?
yes you can use local file path - select that option on the top and use the same text box for the path

you can do all sorts of logics using the output template, using inja it's very powerful: https://github.com/pantor/inja
so you can {% if output2 == "" %} hello {% else %} world {% endif %}
check out their documentation
 

lifecoach

New Member
1708281971141.png

The logic sounds great. But I'm stuck at my first question.

1. I selected the textfile on my PC.
2. The textfile include the web URL.
3. If I do the request I only get the written URL in my textfile as parse body. No outputs are generated.
 

royshilkrot

Member
royshilkrot updated URL/API Source: Live Data, Media and AI on OBS Made Simple with a new update entry:

v0.2.7 - Easy Presets! more robustness

Don't puzzle with settings - use a preset! It will automatically set all the request fields for you. Common use cases like OpenAI and translation. If you're missing your use case - let me know and I'll add it!
Enjoy!

What's Changed​

  • Robustness fixes. Adding polyglot assist button by @royshil in #85
  • Presets for common use cases by...

Read the rest of this update entry...
 

halioris

New Member
Is there a guide somewhere showing how to parse JSON and use it? I'm not trying to do anything complex, just looking for the syntax to get the values from a few different objects in the JSON as well as some sub-array's. Lets say the JSON was a tennis match that looked something like:

Code:
{
   "scores": {
      "players": [
         [
            {
               "name": "Fred Flintstone",
               "team": "Team Fred"
            }
         ] ,
         [
            {
               "name": "Barney Rubble",
               "team": "Team Barney"
            }
         ]
      ],
      "gamescore": {
         "player1": "30",
         "player2": "15"
      },
      "setscore": [
         {
            "player1": "6",
            "player2": "1"
         },
         {
            "player1": "1",
            "player2": "3"
         }
      ]
   }
}

Now I just want to parse up the players and scores to be able to place them in an html table but don't know how to grab player 1 name, player 2 name, player 1 game score, player 2 game score, and then scores from each set (up to 5) and have them all as variables to be put into an html table. Hoping there's a guide to show me this or an example or video or something.
 

royshilkrot

Member
Is there a guide somewhere showing how to parse JSON and use it? I'm not trying to do anything complex, just looking for the syntax to get the values from a few different objects in the JSON as well as some sub-array's. Lets say the JSON was a tennis match that looked something like:

Code:
{
   "scores": {
      "players": [
         [
            {
               "name": "Fred Flintstone",
               "team": "Team Fred"
            }
         ] ,
         [
            {
               "name": "Barney Rubble",
               "team": "Team Barney"
            }
         ]
      ],
      "gamescore": {
         "player1": "30",
         "player2": "15"
      },
      "setscore": [
         {
            "player1": "6",
            "player2": "1"
         },
         {
            "player1": "1",
            "player2": "3"
         }
      ]
   }
}

Now I just want to parse up the players and scores to be able to place them in an html table but don't know how to grab player 1 name, player 2 name, player 1 game score, player 2 game score, and then scores from each set (up to 5) and have them all as variables to be put into an html table. Hoping there's a guide to show me this or an example or video or something.
i took your question verbatim to ChatGPT and got something you can use with URL/API source https://chat.openai.com/share/da052a73-b503-4af5-964d-ce01a70057b1 check it out
 

halioris

New Member
i took your question verbatim to ChatGPT and got something you can use with URL/API source https://chat.openai.com/share/da052a73-b503-4af5-964d-ce01a70057b1 check it out
Thx... the parsing and really even figuring out the templating wasn't the real issue. I was trying to find the simple guide to what goes in what fields in your plugin. From what you've posted and some more playing around I'm gathering I can post any valid inja template in the output. I ended up resorting to just using the entire body and referring to it. Still struggling to figure out what to parse up in the source that is supposed to pre-populate variable for you to use. I just resorted to ignoring that and putting template code in that just used the entire body. Not sure if taht's the best way to go about it or not.
 

royshilkrot

Member
Thx... the parsing and really even figuring out the templating wasn't the real issue. I was trying to find the simple guide to what goes in what fields in your plugin. From what you've posted and some more playing around I'm gathering I can post any valid inja template in the output. I ended up resorting to just using the entire body and referring to it. Still struggling to figure out what to parse up in the source that is supposed to pre-populate variable for you to use. I just resorted to ignoring that and putting template code in that just used the entire body. Not sure if taht's the best way to go about it or not.
however you solve the problem is good! it's about the solution. parsing can be difficult, if using the entire body and then inja to extract the info - is perfectly fine
 

halioris

New Member
What is allowed in the CSS properties? If I use individual CSS elements like
Code:
color: #fffff;
it works fine. however if i am putting an HTML table in my output template and try to style table elements in the CSS it does not work. For example:

CSS Properties
Code:
td {
  color: #ffffff;
}
Output Template
Code:
<table>
  <tr>
    <td>{{body.test}}</td>
  </tr>
</table>
The CSS to attempt to style the td tag has no effect. I've also tried putting individual style's inline on every element in the table and some seem to work and others don't but it's very very ugly to try and do that. Is there a better way to do this?
 

royshilkrot

Member
What is allowed in the CSS properties? If I use individual CSS elements like
Code:
color: #fffff;
it works fine. however if i am putting an HTML table in my output template and try to style table elements in the CSS it does not work. For example:

CSS Properties
Code:
td {
  color: #ffffff;
}
Output Template
Code:
<table>
  <tr>
    <td>{{body.test}}</td>
  </tr>
</table>
The CSS to attempt to style the td tag has no effect. I've also tried putting individual style's inline on every element in the table and some seem to work and others don't but it's very very ugly to try and do that. Is there a better way to do this?
unfortunately im at the mercy of the Qt HTML renderer and that's not a full blown Browser with all the fixings.
Lets start with what you're trying to do? perhaps another way that uses Text sources would be better
 

royshilkrot

Member
royshilkrot updated URL/API Source: Live Data, Media and AI on OBS Made Simple with a new update entry:

v0.3.0 Output Mapping! one request - multiple outputs...

This release introduces the Output Mapping feature allowing to control which part of the output (for example, a json document) should go to which OBS source. You can now build complex queries and route different parts of the response to multiple sources instead of running multiple queries.

Download

Read the rest of this update entry...
 
Top