Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Support setproctitle on Mac OS X [was: Question: Any way for a shell script to check if youtube-dl is running?] #8717
Comments
|
Just don't run it in background and you won't have this problem at all. |
|
Sorry, I'm not sure I understand. I'm not doing anything special to make youtube-dl run in the background. Is there something specific I need to do to make sure it runs in the foreground? |
|
Post your code. |
|
First, I check if youtube-dl is already running (by checking if python is running—if I check for youtube-dl directly, it will never be reported as running):
Then, I start the download:
theFolder has been set to my working directory and YoutubeDL has been set to the path to the youtube-dl executable. The actual terminal command that gets executed is:
I run multiple of these in parallel, which is where the first piece of code (Is youtube-dl running already?) comes into play. Here is the full program, I'm not 100% sure what you need to see. |
|
Sounds to me like your script should create, check, and manage its own pidfile/lockfile. That is, instead of checking whether another instance of youtube-dl was running, it would instead check to see if another instance of itself was running and block until that was no longer true. |
|
As you're writing Applescript, I guess you're using Mac OS X. On Llinux
Currently this feature supports "normal" Linuxes only. py-setproctitle can be a good reference if we're going to implement it on more systems. |
Hello, I've created an Applescript for personal use that works as a sort of wrapper around youtube-dl so I can download multiple videos quickly. I'm trying to modify it so that it won't download multiple videos at the same time.
In order to accomplish this, I need to check to see if the youtube-dl process is already running (and if so, wait until it finishes. I'm currently accomplishing this with the following shell script:
ps -ax -o etime,command -c | grep pythonWhich will return the empty string if python is not running. Since youtube-dl uses python, this can be used to approximate whether youtube-dl itself is running.
Of course, however, this causes problems if I run a program other than youtube-dl which depends on Python. Is there any way to check if youtube-dl itself is currently running? Thank you so much!