Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-230

Programmatically add files to a running instance of Picard

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Normal Normal
    • None
    • 1.0
    • Other
    • None

      from http://bugs.musicbrainz.org/ticket/4807

      I think Picard should have some kind of command prompt switches at least for adding files/directories to picard. It would be very usefull for calling Picard from batch files/shell scripts.

      from http://bugs.musicbrainz.org/ticket/5810

      While an end-user can manually add files to Picard easily through drag-and-drop, the file browser, or the File menu, it's very hard to do so programatically, e.g., from a script.

      #5786 provides a way to do this on the Mac through AppleScript, the console "open" command, etc. I use this all the time--I have an iTunes script to open my iTunes selection in Picard, a command-line ripper script that opens the files in Picard as soon as they're encoded, etc. But there's no way to do anything like this on Windows, Linux, etc.

      The usual way to do this (Firefox, various daemons, etc.) is by having a command-line flag that means "instead of starting a new instance, give these parameters to your already-running instance". If you run "picard --add-files foo bar", it finds your main instance and passes foo and bar to it as files to open. If you run picard without the -a flag, it becomes that main instance if there isn't one already. (The main instance should be separate for different users, or even different sessions by the same user.)

      I put together an implementation around QLocalServer/QLocalSocket, which works great. Unfortunately, QLocalServer requires 4.4 (and practically, it requires 4.5 on Unix/Mac).

      I could implement something like QLocalServer in pure Python, but it requires separate Windows and Unix implementations, and I don't have a Windows machine.

      Another alternative is to just use QTcpServer, and share the port with a pidfile-like file inside the Qt temp directory (which is distinct for each user session). Or maybe it could use the browser integration server (which would allow other programs to send files to Picard without having to run it from the shell) instead of a new QTcpServer. I'll look into this.

      The latter ticket has a number of comments and a couple of patches, although it seems from the comments that it's not quite complete.

            Unassigned Unassigned
            nikki nikki
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package