-
-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PICARD-2519: Allow passing supported URLs on command line #2130
Conversation
['cdtoc/nuVRJcYftbCghFSdwVVK6D4e6Ko-'] D: 12:48:19,689 /usr/lib/python3.10/site-packages/picard/browser/filelookup.mbid_lookup:136: Lookup for cdtoc:nuVRJcYftbCghFSdwVVK6D4e6Ko- QObject::startTimer: Timers cannot be started from another thread QObject::startTimer: Timers cannot be started from another thread
I think that handling the |
Okay, I've found out that Seems like the WebService was designed to be called by the main thread, while the pipe listener runs on another one, so it cannot start the actual task (and even breaks the currently working drag'n'drop feature). I mean, drag'n'drop works until we try to pass some URL via command-line to an existing instance. |
At the risk of intoducing "scope creep", in addition to handling URLs on the command line, how about being able to just enter the MBID insead of the full URL? Of course, entering the full URL should work as well. Basically the command line should probably accept the same inputs as the lookup text box: Album, Artist (?), Track. The only thing with just entering the MBID is that Picard won't know which type of record so it may have to try as many as three calls to the API to get a response. Perhaps the command line entry could (should) include a type identifier along with the MBID, like "Album:1fa3b874-dbef-4c86-9681-3f6d6877ddba"? |
I wonder if you could accomplish this using a signal? According to this article on setting handlers for asynchronous events, "Python signal handlers are always executed in the main Python thread of the main interpreter, even if the signal was received in another thread." There are also a couple of threads on Stack Overflow (Python signals between threads and Emit signal in standard python thread) that might provide some insights. In particular, the the queue class looks like it might be promising. I don't know if these are useful because I'm about the furthest thing from an expert on threaded processing. 😉 |
Indeed that is probably the way, and Picard has a helper for that. You can use the
I would limit it to URLs for now, otherwise it can get confused with normal valid local paths. If we would introduce MBIDs, they should be with identify identifier in the form |
Also thanks for the decent feedback, gonna read the articles and mentioned methods :) |
Okay. Perhaps somthing to consider in the future to better facilitate batch processing of an automated rip -> tag workflow.
Agreed. |
Actually it easily could be part of an automated rip -> tag batch process workflow. |
What about allowing URLs in the form of:
Examples:
|
Hm, it could be easily parsed by |
Okay, I've added the "mbid://" option, you might want to review the code now :) |
Co-authored-by: Laurent Monin <github@norz.org>
Co-authored-by: Laurent Monin <github@norz.org>
Tagger._parse_items_to_load() -> ParseItemsToLoad class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Laurent Monin <github@norz.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ParseItemsToLoad: add __bool__() and use it to bring tagger to front
Works great, thanks a lot |
Summary
Currently Picard supports passing file paths on command line to open the respective files. Picard also supports handling some URL patterns by drag and drop, e.g. MusicBrainz recordings, releases, release group and cdtoc URLs.
Extend Picard to also handle these supported URLs when passed via command line.
Problem
Solution
call urllib.parse.urlparse on each argument marked as FILE to determine whether it's a file or URL, then pass it to the actual Tagger.
Action