Quick Sign In:  

Forum: Addons

Topic: LocalJSON
djcelPRO InfinityModeratorMember since 2004
 

Posted Thu 26 Dec 24 @ 1:44 pm
Er...."Use you own JSON file" for what? How?
 

Posted Thu 26 Dec 24 @ 1:47 pm
djcelPRO InfinityModeratorMember since 2004
Some users knows how to generate a JSON file (webmasters, Python, ...) but doesn't know c++ and how to compile a dll file. So I thought it would help to make a OnlineSource plugin that reads a JSON file on the drive. It uses the same structure as in the VDJ SDK but in JSON format.
{PluginName}.json is in the same folder as the dll

https://www.virtualdj.com/wiki/Plugins_SDKv8_OnlineSource.html

https://www.virtualdj.com/wiki/Plugins_SDKv8_Example7.html

You need to edit "streamUrl" with the url of your mp3 file for example
 

Posted Thu 26 Dec 24 @ 11:04 pm
djcelPRO InfinityModeratorMember since 2004
For the ones who are not expert in JSON and you have many lines, an easy way is Python.
Please find some ideas:

import json
import pandas as pd

def test1_sort_json():
strFilepath_In = "C:\\Users\\xxxx\\AppData\\Local\\VirtualDJ\\Plugins64\\OnlineSources\\yyyy.json"
strFilepath_Out = "C:\\Users\\xxxx\\AppData\\Local\\VirtualDJ\\Plugins64\\OnlineSources\\yyyy_fixed.json"

df = pd.read_json(strFilepath_In)

df_sorted = df.sort_values(by='uniqueId', ascending=False)

#df_sorted.drop_duplicates(subset=['uniqueId'],keep='first',inplace=True)

df_sorted['uniqueId'] = df_sorted['uniqueId'].astype(str)

json_str = df_sorted.to_json(strFilepath_Out, orient='records')


def test2_read_json():
strFilepath = "C:\\Users\\xxxx\\AppData\\Local\\VirtualDJ\\Plugins64\\OnlineSources\\yyyy.json"

fp = open(strFilepath, "r", encoding="utf8")

data = json.load(fp)

for i in data[0]:
print(i)

fp.close()
 

Posted Wed 15 Jan 25 @ 9:55 pm