GSoC Application draft: Picard: Single instance mode

Google Summer of Code:

skelly37’s application

Organization:

MetaBrainz

Project:

MusicBrainz Picard

Topic:

Make Picard work in single instance mode, then improve existing error handling and crash info.

Abstract:

Currently, running picard always spawns a new instance. It would be useful to pass the arguments to an already running instance (if exists). The best way to achieve this is to utilize named pipes, they work on all supported operating systems (i.e. Windows, Linux, MacOS). The remaining time is planned to be spent on better error handling and crash info, but implementation of the single instance mode is of highest priority.

The most important technicals:

  • Instances will communicate through named pipes (os.mkfifo()/win32pipe from pywin32)
  • Each Picard version will have one (main) instance that will receive argv from ones spawned later.
  • Named pipes will be placed in a fixed location and will consist of instance’s version, e.g. /tmp/picard-v-2-7-pipe
  • Newly spawned instance will send message to find out whether picard is already reading the pipe or not. If not, it’ll claim the pipe as its own.
  • --force argument to spawn another instance of the same version is also planned.

Expected timeline and steps/milestones:

  • Expected time of coding is 12 weeks, so I’ll stick to it in this plan (but of course the time can be extended until November 13).
  • Milestones per week (1, 2, 3 mean the end of such week):
    • 1: Picard communication protocol (through named pipes) works flawlessly on Linux and Windows.
    • 3: Picard utilizes this communication protocol: can receive data and find out if it is the only running instance.
    • 4: Improvements of the single instance mode: --force flag and multpile versions of Picard allowed to run freely.
    • 6: Final polish of the single instance code and the tests. Single instance mode is finished.
    • 7: Figured out what crash details would be actually relevant and worth of saving.
    • 8: Picard stores the relevant crash details.
    • 10: Crash details are displayed in the crash window. (2 weeks, GUI programming is tricky and my underbelly)
    • 12: My code is well-documented, its tests and error handling are double-checked, existing error handling is improved where needed.
  • If, by any chance, I manage to finish all the planned work earlier, I can help with Polish translation or small issues (like migrating to isort 3).

Something about me:

  • Github
  • Setup:
    • Main machine: Windows 10 / Artix Linux (i5-4460, 24GB DDR3)
    • Mobile machine: Artix Linux (i5-3320M, 12GB DDR3)
    • 3rd one, older: available for any distro to make tests on a low-end machine (some i3-2310M, 3GB DDR3)
    • Basically, neither Unix nor Windows is problematic to me, I only lack Apple hardware.
  • Programming languages:
    • Python — my main langauge.
    • Nushell — my shell and project I support.
    • POSIX — even though I use Nu, I can use (and had been using before) such shells without much problems.
    • C/C++ — forced by educational system.
    • Java — basics, learned while reading some books (e.g. the legendary Clean Code).
    • TypeScript — learning in my spare time.
  • I’ve been into IT stuff since the beginning of my primary school, though I started learning to code seriously in 2020 right after the lockdown’s start.
  • I’m graduating from high school this year, so a shortage of time is not my concern. Doing full-time won’t be a problem.
  • Since you’re MusicBrainz, a few words about my music taste:
    • Currently playing music genre depends on my mood but I can name some all-time favorites:
    • German legend — Kraftwerk (5700dcd4-c139-4f31-aa3e-6382b9af9032)
    • Polish rock band — Coma (de548477-205e-4802-8908-e71d3ad67be0)
    • Great Polish composer — Frederic Chopin (09ff1fe8-d61c-4b98-bb82-18487c74d7b7)
    • Italian singer — Luciano Pavarotti (705076ef-a0c5-472f-bebd-3e72174fcaf4)

Me and MusicBrainz:

  • I have to admit that I found out about the project because of GSoC, though I already have managed to really like it.
  • My 2 personal favorites about MusicBrainz are:
    • MBID — the very idea of keeping all the artists and their tracks with unique keys satisfies my particularity
    • your music database — not only data is ordered with MBID, but the database is also rich, useful and pretty decent, what is even more important
  • I haven’t used MusicBrainz to tag my files yet but Picard’s capabilities are already overwhelming (in positve way) and I’ll surely give it a try.
9 Likes

Thanks a lot for this. This already looks very good to me. I think what your timeline shows is that there is some uncertainty about the needed time with this projects. Things can both turn out simpler or more complicated than anticipated. But your timeline makes sense to me, and if the core part goes quicker then expected we have more time to improve the crash error handling (which is of secondary priority in the scope of this project).

Don’t worry about macOS support here. I can assist with testing this on macOS, but in general it should not be much difference from Linux in this regard. Also this entire functionality is not of such a high significance for macOS, since “open with” on files already is sanely handled there with a message sent to the running process.

4 Likes

Wow @skelly37, it’s not often I see a application draft not get heaps of notes :stuck_out_tongue:

Well done!!

2 Likes

@skelly37 already came to IRC to discuss to discuss the ideas around this task, and also already got familiar with Picard’s code and did some code cleanups.

I’m actually really happy about this application, thanks @skelly37 :slight_smile:

3 Likes

And I’m really happy about all these kind words :slight_smile:

1 Like