logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#1 Posted : Friday, April 13, 2018 4:56:49 AM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
Please consider this , we needed so badly
Vmix DATA SOURCE can take data from sql database

regards

doggy  
#2 Posted : Friday, April 13, 2018 5:41:13 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
we have beeing doing just that lately with great succes for sports data and results

have a appropriate php file including the wanted queries echo the results to a xml or json format on a server or even a local server (XAMMP) and let datasources link to that php file
DWAM  
#3 Posted : Friday, April 13, 2018 6:23:07 AM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
Just like Doggy, I wrote my own PHP script (could be done with ASP too) that converts MySQL data (could be any database format) into XML so that vMix can use it.

Guillaume
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#4 Posted : Friday, April 13, 2018 1:56:38 PM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
thanks doggy and DWAN, well good you did that
so help me out please guys , any links , any one have example ,what about wordpress cms??
help please even here or in pm

thanks a lot

Regards
DWAM  
#5 Posted : Friday, April 13, 2018 2:11:11 PM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#6 Posted : Friday, April 13, 2018 3:04:44 PM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
thanks DWAN

but i`m not a developer my self , thanks for the link , but how to make this happen live ,
just to ask you if you have a demo script that i can use and try to get it developed

thanks a lot
DWAM  
#7 Posted : Friday, April 13, 2018 3:12:00 PM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
If you are not a developer, there is no way you can do it by yourself

Find a developer that can help

Oh, it's DWAM btw
doggy  
#8 Posted : Friday, April 13, 2018 8:40:15 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
use at own risk ( tricky item to ask database acces of third party )
xxxx to be replaced by appropriate data
Created after using lots of DWAM his link ;-)

Code:

<?php

// Initialize variable for database credentials
$dbhost = 'xxxx';
$dbuser = 'xxxx';
$dbpass = 'xxxx';
$dbname = 'xxxx';

$table = 'xxxx';

//Create database connection
  $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

//Check connection was successful
  if ($dblink->connect_errno) {
     printf("Failed to connect to database");
     exit();
  }

//Fetch rows from table
  $result = $dblink->query("SELECT xxxx FROM $table ");

//Initialize array variable
  $dbdata = array();
  
//Fetch into associative array
  while ( $row = $result->fetch_assoc())  {
       # Converting each column to UTF8
        $row = array_map('utf8_encode', $row);
        array_push($dbdata,$row);
  }
  
//var_dump($dbdata); 

//Print array in JSON format (for direct access from vMix datasource link to this php file)
echo json_encode($dbdata);

?>
thanks 1 user thanked doggy for this useful post.
vijay6672 on 4/14/2018(UTC)
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#9 Posted : Saturday, April 14, 2018 9:27:51 AM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
Hello doggy
thanks for you help
I have used you script as you mentioned

here is the result

[{"post_title":"\u00d8\u00a3\u00d9\u0087\u00d9\u0084\u00d8\u00a7\u00d9\u008b \u00d8\u00a8\u00d8\u00a7\u00d9\u0084\u00d8\u00b9\u00d8\u00a7\u00d9\u0084\u00d9\u0085 !"},{"post_title":"\u00d9\u0085\u00d8\u00ab\u00d8\u00a7\u00d9\u0084 \u00d8\u00b9\u00d9\u0084\u00d9\u0089 \u00d8\u00b5\u00d9\u0081\u00d8\u00ad\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"intt-w"},{"post_title":"Vnewsroom"},{"post_title":"Auto Draft"},{"post_title":"Auto Draft"},{"post_title":"Auto Draft"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"news"},{"post_title":"Auto Draft"},{"post_title":"Auto Draft"},{"post_title":"Auto Draft"},{"post_title":"Auto Draft"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"front"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"News Woman on Green Screen"},{"post_title":"erqwerwer"},{"post_title":"\u00d8\u00a3\u00d9\u0087\u00d9\u0084\u00d8\u00a7\u00d9\u008b \u00d8\u00a8\u00d8\u00a7\u00d9\u0084\u00d8\u00b9\u00d8\u00a7\u00d9\u0084\u00d9\u0085 !"},{"post_title":"\u00d8\u00a3\u00d9\u0087\u00d9\u0084\u00d8\u00a7\u00d9\u008b \u00d8\u00a8\u00d8\u00a7\u00d9\u0084\u00d8\u00b9\u00d8\u00a7\u00d9\u0084\u00d9\u0085 !"},{"post_title":"GTITLE"},{"post_title":"\u00d9\u0085\u00d8\u00b1\u00d8\u00ad\u00d8\u00a8\u00d8\u00a7 \u00d8\u00a8\u00d9\u0083\u00d9\u0085"},{"post_title":""},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"\u00d9\u0085\u00d8\u00b3\u00d9\u0088\u00d8\u00af\u00d8\u00a9 \u00d8\u00aa\u00d9\u0084\u00d9\u0082\u00d8\u00a7\u00d8\u00a6\u00d9\u008a\u00d8\u00a9"},{"post_title":"1"},{"post_title":"\u00d9\u0085\u00d8\u00b1\u00d8\u00ad\u00d8\u00a8\u00d8\u00a7 \u00d8\u00a8\u00d9\u0083\u00d9\u0085"}]Back to to

it it seams i cant read anything in it


and here is vmix recall

marcyaghi1 attached the following image(s):
Capture11.PNG (27kb) downloaded 17 time(s).

You cannot view/download attachments. Try to login or register.
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#10 Posted : Saturday, April 14, 2018 9:29:04 AM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
DWAM wrote:
If you are not a developer, there is no way you can do it by yourself

Find a developer that can help

Oh, it's DWAM btw



sorry for that mistake DWAM

and thanks for the help
doggy  
#11 Posted : Saturday, April 14, 2018 11:06:07 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Quote:
I have used you script as you mentioned

here is the result

[{"post_title":"\u00d8\u00a3\u00d9\u0087\u00d9\u0084\u00d8\u00a7\u00d9\u008b \u00d8\u00a8\u00d8\u00a7\u00d9\u0084\u00d8\u00b9\u00d8\u00a7\u00d9\u0084\u00d9\u0085 !"},


Doesn't say much does it?

what type of database you want to pull your data from (sql, mysql, other), whats it structure, what does it contain , is its structure even correct ( i had to pull data from a mysql which collumns headers where totally wrong even and had to write a corrector for it", where is it, what are your queries (filtered, sorted , selections etc) and soooooo much more.

Like DWAM already said "If you are not a developer, ....." and you want one to do it for you , you will need to give a lot more information than just "I like database data into datasources in vMix"
I did it the way DWAM sugested , lots of times as i am not a developer but suggestions in the forum tend to push one in the right direction

There is also a reason i had lots of XXXX in the code, having acces to such a database with the needed credentials is more thn just readable !

DWAM  
#12 Posted : Saturday, April 14, 2018 11:56:20 AM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
Again, find a dev in your country who speaks your native language.
Even a student can do this for you, especially if you find a little money for his work. This cannot be done for free if you want something that works quickly and reliably. Or just learn how to do it if you have months ahead.
This is pro stuff, there is no magic keyword for this type of things: it's a lot of very valuable work!

Good luck!
Guillaume
DWAM  
#13 Posted : Saturday, April 14, 2018 12:10:52 PM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
@Doggy

Your script works perfectly btw... Guess you know it already ;o)

@Marc

Your database must be formatted for Lebanon I guess

Guillaume
doggy  
#14 Posted : Saturday, April 14, 2018 12:53:29 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
DWAM wrote:
@Doggy

Your script works perfectly btw... Guess you know it already ;o)



Merci, it did perform well used intensivly over a 4 day show pulling 4 rows constantly that changed data (ahtletes name) each seperate around once per 45 seconds. Did the filtering in the query itself but guess you know why :-) . data pulled to 4 different streaming unit (arenas) for each specific athletes data in title. Further scripts did use same data for other processing (naming each individual recording etc )

Did omit in the posted code the function to clean the collumn headers illigal characters and such ( yeah technically bad practise form the data provider) but glad we had accesS in the first place (a very important trust issue !).

Had an to xml version also and or ability to save pulled data as xml or json file on the server.

advantage of xml version is the possibility to further filter data in the datasource table through the xpath details though if needed.

we did have in the beginnig an issues, basically i did put the files on my own shared server which colled the remote data server and because we had left all the variations in the datasource setup (it basically crashed the server ( processor and memory overload).
Lesson learned , check the update frequencies in vMix and delete the ones you are not using ;-). i later moved the scripts to a local server on the laptop (to keep my webhost happy also).

having not to manually pick data for the titlefrom a list, combined with pulling each stopwatch display data (serial) for the title that also triggered the individual recordings made it easyer to focus on the footage (times 4)



DWAM  
#15 Posted : Saturday, April 14, 2018 1:22:57 PM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
Good job!

yes using a local server is always better. I have a RPI with LAMP in my toolbox, ready to go for small projects.

My script for XML does extensive use of query strings and parsing in order to use dynamic SQL queries so that a single script can be used for several tables and use cases but I got stuck (my fault I think) at using some of the SQL syntax possibilities for queries (things like CONCAT(), or TRUNCATE()) I wanted to use on the server side to make sure my formatting would be better and easier when creating the XAML part... Works against the database directly, but not in my script ??? Argh! Need to work more I guess ! ;o)
doggy  
#16 Posted : Saturday, April 14, 2018 1:38:43 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
@ DWAM

FYI, the reason i had to add a correction function was due to how vMix handles "illigal characters" in the data specificaly while it otherwise in use ( creating xml files for example) had no problems !
DWAM  
#17 Posted : Saturday, April 14, 2018 1:42:52 PM(UTC)
DWAM

Rank: Advanced Member

Groups: Registered
Joined: 3/20/2014(UTC)
Posts: 2,721
Man
France
Location: Bordeaux, France

Thanks: 243 times
Was thanked: 794 time(s) in 589 post(s)
This is not the problem I'm facing. The error occurs in the script and there are no illegal characters in my tables!
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#18 Posted : Saturday, April 14, 2018 2:57:17 PM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
Error in the script
I figure it out

here the fix

while ( $row = $result->fetch_assoc()) {
# Converting each column to UTF8
$row = array_map('utf8_decode', $row);
array_push($dbdata,$row);


you should put utf8_decode instead of utf8_encode

then it will work in vmix you will see results

i still see some ??????? symbols due to Arabic characters , need to find out an add for the script for Unicode characters


Regards

doggy  
#19 Posted : Saturday, April 14, 2018 3:25:33 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,221
Belgium
Location: Belgium

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
glad you solved part of it

but.... for me it's not an error in the script as is !

More likely the database you are accessing has a different DEFAULT CHARACTER SET (which would make sence as you mention 'i still see some ??????? symbols due to Arabic characters' )
Michał  
#20 Posted : Saturday, April 4, 2020 5:12:12 AM(UTC)
Michał

Rank: Newbie

Groups: Registered
Joined: 11/21/2019(UTC)
Posts: 8
Man
Poland
Location: Włodawa

I have a solution for json. All language

Your database must have (DEFAULT CHARACTER SET utf8 COLLATE utf8_xxxx_ci) and all tables
  • you can make these changes in the mysql workbench or phpmyadmin


*utf8_xxxx_ci - xxxx your language

Code:
<?php

// Initialize variable for database credentials
$dbhost = 'xxxx';
$dbuser = 'xxxx';
$dbpass = 'xxxx';
$dbname = 'xxxx';

$table = 'xxxx';

//Create database connection
  $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  $dblink->set_charset("utf8");
//Check connection was successful
  if ($dblink->connect_errno) {
     printf("Failed to connect to database");
     exit();
  }


//Fetch rows from table
  $result = $dblink->query("SELECT xxxx FROM $table ");

//Initialize array variable
  $dbdata = array();
  
//Fetch into associative array
  while ( $row = $result->fetch_assoc())  {
       # Converting each column to UTF8
        
        array_push($dbdata,$row);
  }
header('Content-Type: application/json');
print(json_encode($dbdata, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));

?>




i will add:
Code:

  $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  $dblink->set_charset("utf8");

remove:
Code:

  $row = array_map('utf8_encode', $row)

and add:
Code:

header('Content-Type: application/json');
print(json_encode($dbdata, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
Users browsing this topic
Guest (5)
Similar Topics
VMIX data sources not updating (XML/JSON) (General Discussion)
by themoog 8/20/2023 6:33:30 PM(UTC)
Session or Cookie based JSON for vMix Data Source (General Discussion)
by NSCPro 9/1/2022 11:49:18 PM(UTC)
vmix data source triggering layers on xaml/gt (General Discussion)
by discodanz 6/18/2021 9:58:57 AM(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.