CLI/python/applescript for adding videos
  • fred_dev
    junior Member
    Posts: 6
    Joined: Thu Mar 02, 2017 3:17 pm

    CLI/python/applescript for adding videos

    by fred_dev » Wed Feb 17, 2021 9:25 am

    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.
  • mad-matt
    garageCube team
    Posts: 1475
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: CLI/python/applescript for adding videos

    by mad-matt » Fri Feb 19, 2021 4:00 pm

    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
  • zephir
    junior Member
    Posts: 2
    Joined: Mon Jun 28, 2021 12:19 pm

    Re: CLI/python/applescript for adding videos

    by zephir » Tue Jun 29, 2021 11:24 am

    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)
    Attachments
    Screenshot 2021-06-29 at 11.21.50.png
    OSC Control List in MadMapper
    Screenshot 2021-06-29 at 11.21.50.png (74.51 KiB) Viewed 2095 times
    Screenshot 2021-06-29 at 11.22.06.png
    Python Script
    Screenshot 2021-06-29 at 11.22.06.png (171.37 KiB) Viewed 2095 times
  • mad-matt
    garageCube team
    Posts: 1475
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: CLI/python/applescript for adding videos

    by mad-matt » Thu Jul 01, 2021 5:56 pm

    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.

Who is online

Users browsing this forum: No registered users and 15 guests