Skip to content
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

Patched code for deluge v2 + ability to handle files #9

Open
Olie440 opened this issue Jan 30, 2024 · 1 comment
Open

Patched code for deluge v2 + ability to handle files #9

Olie440 opened this issue Jan 30, 2024 · 1 comment

Comments

@Olie440
Copy link

Olie440 commented Jan 30, 2024

Hi,

I'm aware that this is only for v1 of deluge but for anyone who has got v2 installed with these instructions https://help.rapidseedbox.com/en/articles/6177931-install-deluge-v2-on-macos I've managed to update the script to work with it. I've also added a open handler that you can use to open torrent files in v2:

on openDeluge(torrentPath)
	set sanitizedPath to quoted form of torrentPath
	do shell script "/usr/local/bin/deluge-gtk " & sanitizedPath & " > /dev/null 2>&1 &"
	
	
	tell application "System Events"
		repeat until (exists process "Python")
			delay 0.05
		end repeat
		
		tell process "Python"
			set frontmost to true
			windows where title contains "Deluge"
			if result is not {} then perform action "AXRaise" of item 1 of result
		end tell
	end tell
end openDeluge

on convertFileListToPaths(fileList)
	set filePaths to ""
	
	repeat with i from 1 to count of fileList
		set currentFile to item i of fileList
		set filePaths to filePaths & POSIX path of currentFile
		
		if i is not equal to (count of fileList) then
			set filePaths to filePaths & " "
		end if
	end repeat
	
	return filePaths
end convertFileListToPaths


on open location magnetUrl
	openDeluge(magnetUrl)
end open location

on open fileList
	openDeluge(convertFileListToPaths(fileList))
end open

Hopefully someone finds this helpful and maybe can even find a way to detect v2 and run this as well

@Lord-Kamina
Copy link
Owner

Nice. I won't be working anymore on this but if a good pull request is sent, I have no issues merging it.

FWIW, there I upload an app bundle of an old Deluge 2.0.4 build that I modded and that can open magnets, among a few other changes.

I haven't updated it in ages though, mostly due to some differences of opinion with the devs, back when I made the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants