快速登录:  

Forum: General Discussion

话题: VDJScript, is file already loaded?
I'm still very much newb to all of this so I keep having to ask for VDSCript / Plugin stuff but I swear I am trying to use the verb list and expermienting before I ask... how can I check if a file is already loaded and if it is, change its que position?

I'm now able to add to the list but if my script will just keep adding it...

SendCommand(("karaoke_add \"" + filePath + "\"").c_str());
SendCommand("browser_window karaoke");
SendCommand("browser_scroll bottom");
SendCommand(("browsed_song 'singer' \"" + requestorName + "\"").c_str());
SendCommand(("browsed_song 'comment' \"" + comment + "\"").c_str());


I've also tried karaoke_load but that does not seem to work.
 

发表时间 Mon 02 Oct 23 @ 4:55 pm
locoDogPRO InfinityModeratorMember since 2013
loaded? like loaded to deck? or just in a list?

get_loaded_song "SOME_FIELD"
 

发表时间 Mon 02 Oct 23 @ 4:56 pm
As in, already in the karaoke list (or side list).

I guess it will be some sort of loop starting at the bottom, check the file path, and if it matches then move the file X times until it matches whatever position I specify and if there are no matches then simply add it. IDK, all this C stuff has wiggled my brain for the day. I know there is probably some super elegant way to do this but it's not coming to me. My app allows the host to drag and drop requests to sort them then immediately updates a crawl (and the app) but now I need that position to match in VDJ.
 

发表时间 Mon 02 Oct 23 @ 5:08 pm
Hmm, I guess I have to monitor the remove from list event as well otherwise if the host removes the song from the list in VDJ the app would just keep adding it back in... is there such an event?
 

发表时间 Mon 02 Oct 23 @ 5:10 pm
locoDogPRO InfinityModeratorMember since 2013
check the verb
get_next_karaoke_song

you can use that; for loop the list using file_count 'karaoke' as your test expression and read the list
 

发表时间 Mon 02 Oct 23 @ 5:23 pm
Are there events for removed from list, as in removed from the side list or karaoke?

I also figured out that onStart and onStop are not start and stop of the plugin... is there an en even for toggling the enable/disable of the plugin? The green slider next to the Plugin name in the list of effects.

Thanks again, everyone.
 

发表时间 Tue 03 Oct 23 @ 6:48 am
locoDogPRO InfinityModeratorMember since 2013
onStart and onStop are power on/off of the plugin
 

发表时间 Tue 03 Oct 23 @ 8:20 am
So this has me a little stumped, there is not a get_next_sidelist_song OR get_next_sideview_song and while there is a sidelist_add there is only the option automix_add_next (not just plain add). Karaoke has both and that works great. Also, file_count sidelist ... no good but file_count sideview is but that really does me no good if I can't also get the song data.
 

发表时间 Tue 03 Oct 23 @ 1:03 pm
is there a way to set browsed_song what to select? I have a loop that runs every few seconds put in those few seconds the host may have clicked another song so my script then ends up writing the result of the API to the wrong song.
 

发表时间 Sun 29 Oct 23 @ 8:19 am
locoDogPRO InfinityModeratorMember since 2013
I don't understand the issue, it will write to what it points to when the thread is called, if there's clicks in between the thread calls increase the thread polling

I had a alternate failed idea because you can index against selected, but 2 things;
1 if it wasn't noticed by the thread then you need to up your polling
2 only playlists return something when trying get_browsed_song order so you can't offset selected order position against previous order position, and even if it did work syntactically, you're in between thread calls, so you need to up your polling

Not clearly described in script definitions, you can access read tags without moving browser_scroll position, but it's always indexed off browser_scroll position
`get_browsed_song -1 title`

just tested, seems it only works with get_ , this doesn't work to set
browsed_song -1 comment "I_WROTE_OFF_SELECTED" [doesn't work]

Even so, a click in between thread calls might be down the song list which is manageable but it might click to another folder, which breaks everything

I don't believe there is write to specific file tag,

although your interest is karaoke, which is a playlist, but if it was in between thread calls then you need to up your polling.

I guess you understand, lots of "almosts" but it's polling rate at issue. and to be honest I've used threads on DSP effects polling @20ms, one call of GetStringInfo/SendCommand didn't hurt the sound.
 

发表时间 Sun 29 Oct 23 @ 10:02 am
I considered the polling time but mine is making API calls and I do not want to overwhelm my API by calling it in microseconds. I think I will have to separate out just this portion so that polling looks for a change in the Singer field every 20 ms or so, then it calls the API (just for this), gets an ID, writes the ID to the User 2 and then resumes normally.
 

发表时间 Sun 29 Oct 23 @ 7:36 pm