Page 1 of 1

CLI/python/applescript for adding videos

Posted: Wed Feb 17, 2021 9:25 am
by fred_dev
I have a project where I have a set of fixed mappings and artnet outputs, but the content needs to come from a large database. I will write software to go through the database dynamically and choose the videos that will be played on each output, but the database is huge and the system has multiple outputs.

Is there a way to dynamically load videos into a cue via a scripting interface? This would be ideal, but I was thinking of another solution:

Can I try to leverage the video loading process to do this - I would have 2 folders of videos cue1 and cue2, while cue1's videos are playing can I copy and replace the files in the folder that contains the videos referenced by cue2, and then when I go to cue2 will it load and play the replaced video files? (I would then repeat this process for videos in cue1 while cue2 is playing.

The second solution is less than ideal, but after some investigation I don't see a way to automate the video content in a cue or the media list.

I see a post about directory scanning - this seems not to be implemented in the software but any workarounds would be great. Or better yet if this is something that is on the cards it would be great to know as I do have some lead time on this project.

Re: CLI/python/applescript for adding videos

Posted: Fri Feb 19, 2021 4:00 pm
by mad-matt
Hi,
You can send an OSC message to address "/application/medias/add" with a type "s" (string) and the file url (ie "/Users/you/Documents/myMovie.mov"), it will import the file.
Sending "/application/medias/remove" with type string too & this time the "media name" (ie "myMovie.mov" - not the file url since there can be multiple instances of the same file in the project), will remove the media.
Cheers

Re: CLI/python/applescript for adding videos

Posted: Tue Jun 29, 2021 11:24 am
by zephir
Hi,
I've tried doing this but it doesn't work. I've attached screenshots of my code / MadMapper (v4.1) controls, can you tell me if I am doing things correctly?
(note that communicating floats though OSC like fixture luminosity works fine)

Re: CLI/python/applescript for adding videos

Posted: Thu Jul 01, 2021 5:56 pm
by mad-matt
client.send_message("/application/medias/add","/Users/.../toto.mov") will not work because SimpleUDPClient will not generate a valid OSC message. An osc message contains an address, a value type ("s" for string) and a value. It's not a simple UDP packet.
But the idea to send a message to locahost on MadMapper OSC port, at address "/application/medias/add" with your absolute media file path as value is correct.

You can do it with python by using an osc library: "pip install python-osc":
from pythonosc import udp_client
client = udp_client.SimpleUDPClient("127.0.0.1", 8010)
client.send_message("/application/medias/add", "/Users/me/Documents/crappy.mov")

With applescript ou can by installing sendOSC command line tool ("brew install yoggy/tap/sendosc", cf https://github.com/yoggy/sendosc). But you need XCode to be installed and up to date.