Path Substituiton

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
killemov
Posts: 556
Joined: Sat Jul 31, 2010 5:04 pm

Re: Path Substituiton

Post by killemov »

Ah, I would not have thought to use Transmission as a tool to manage my content library.

The "Edit Paths" button is for editing the entire list of paths.
metaclam wrote: Mon May 06, 2024 4:39 am Volumes/Gendut/Books/ …
should be changed to:
/Volumes/newdrive/Books/ ...
Changing this many paths manually or even by this many groups is a pain. AFAIK, there is nothing that can do this ... yet. Please open an issue for Shift and then give me a week or so to implement this. It should work the same way as batch renaming files in Shift.

In the mean time, if stuff moved from one drive to another, you could use symbolic links to mimic the old structure.
metaclam
Posts: 110
Joined: Sat Jan 31, 2009 6:31 pm

Re: Path Substituiton

Post by metaclam »

killemov wrote: Mon May 06, 2024 8:54 am Ah, I would not have thought to use Transmission as a tool to manage my content library.
...
Changing this many paths manually or even by this many groups is a pain. AFAIK, there is nothing that can do this ... yet. Please open an issue for Shift and then give me a week or so to implement this. It should work the same way as batch renaming files in Shift.

In the mean time, if stuff moved from one drive to another, you could use symbolic links to mimic the old structure.
Thank you in advance and again afterwards if you manage to implement this, especially within a week! Here's the issue as requested.

I'll look into using symlinks as a stopgap, but if you can provide a tool like this soon, I'm happy to wait until you do as it would be much cleaner.
killemov
Posts: 556
Joined: Sat Jul 31, 2010 5:04 pm

Re: Path Substituiton

Post by killemov »

I'll get to it this week, hopefully. The main issue is that I have to set aside the massive pending changes and integrate the changes for this issue later on.

If you like it, put a on it.
metaclam
Posts: 110
Joined: Sat Jan 31, 2009 6:31 pm

Re: Path Substituiton

Post by metaclam »

killemov wrote: Mon May 06, 2024 9:19 pm I'll get to it this week, hopefully. … If you like it, put a on it.
Thank you thank you thank you and done!
killemov
Posts: 556
Joined: Sat Jul 31, 2010 5:04 pm

Re: Path Substituiton

Post by killemov »

With keeping the UI-part almost the same as batch renaming files I got it implemented sooner than expected. With some testing I found the feature very powerful ... and dangerous! Especially when using regular expressions. So I kept the example outputs to give you some idea of the pending changes.
metaclam
Posts: 110
Joined: Sat Jan 31, 2009 6:31 pm

Re: Path Substituiton

Post by metaclam »

That was quick and most excellent work, a million thanks!!! Saved me hours and hours for sure. Hopefully will be useful to others.

I think I managed to relocate everything, maybe needing to make 15 or so top-level substitutions.

For the benefit of others and for development feedback, some random observations:

• I could select any torrent located anywhere within a path I wanted to change, and search and replace the highest folder level common to many torrents (as I wanted to be able to do).
• but that really does seem "powerful" :) [as in big chance for OOPS.] make a backup first. :)
• given that, I wondered if it made any difference at all which torrent I selected? Could I not just select a random one and do whatever search and replace I wanted on any arbitrary paths?
• Shift allowed me to select "relocate" from context menu even when there were multiple selections in the torrent list. (and it's easy to unintentionally make selections.) To be safe, I always made sure i only had one selected.
• there were a couple interface glitches relating to editing the paths and then the "substitute" dialog just disappeared en medias res.
• after finishing, it was helpful to go to Session > Shift > Scrape Paths to eyeball all the paths were changed correctly.

• what the green "move" radio button did was unclear as there is also both a "relocate" button next to the "substitue" button. (Perhaps this is an artifact from the previous version.) I was able to use the Substitute button even with "move" still selected (as it is by default)
• I presume that "relocate" would actually move files and so I didn't touch that (having already mirrored my files to new locations on a new NAS)

Questions:

• how do I reset the environment to use the default WebUI again (not that I'm likely to -- Shift is great -- but still couldn't figure that out.

• returning to possibility to run transmission on a the (Synology) NAS (in a container), presumably, I could run Shift there just as well, right?

• and a bit off topic but in case you know: earlier you mentioned i could copy the torrent & resume files to specific locations (on the NAS). Any idea where those might be? And how to set the environment there? Or any references?
killemov
Posts: 556
Joined: Sat Jul 31, 2010 5:04 pm

Re: Path Substituiton

Post by killemov »

Thank you for the feedback. The "Move" input is used to have Transmission actually move the files. The "Selection only" input limits the substituting to the selected torrent(s). The "Relocate" button takes you back to the previous dialog. So "Substitute" is the advanced/expert variant of "Relocate".
metaclam wrote: Thu May 09, 2024 9:28 pm Questions:

• how do I reset the environment to use the default WebUI again (not that I'm likely to -- Shift is great -- but still couldn't figure that out.

• returning to possibility to run transmission on a the (Synology) NAS (in a container), presumably, I could run Shift there just as well, right?

• and a bit off topic but in case you know: earlier you mentioned i could copy the torrent & resume files to specific locations (on the NAS). Any idea where those might be? And how to set the environment there? Or any references?
It's macOS, I think you could do the reverse of what you magically conjured up in the first place. I might have even forgotten how to do this on Windows.

Yes, Shift will work on any platform that exposes the web UI.

My experience with NAS machines is mainly with QNAP, but I believe Synology is comparable so the options on the terminal are usually limited. (Limited busybox version etc.) I got annoyed quickly and put plain Debian on it. On Debian the stuff is located in "/var/lib/transmission-daemon/.config/transmission-daemon/" but vendors can change where everything would reside. You should look for "resume" and "torrents" folder names. I foresee a lot of Googling in your future. How to set the environment variable in Linux is explained in the Shift topic on this forum.

Also, if you really want to have some advanced features (and get some more in the future) you might want to set up a reverse proxy with lighty, nginx or comparable asap.
metaclam
Posts: 110
Joined: Sat Jan 31, 2009 6:31 pm

Re: Path Substituiton

Post by metaclam »

killemov wrote: Mon Apr 29, 2024 11:54 am https://superuser.com/questions/476752/ ... plications

Oh, and maybe post how/what/where you changed here and I will update the instructions.
FYI – I attempted to replicate setting the environment variable on the Mac but have failed to do so. But for anyone who wants to try, the attempts are worth documenting.

Putting this in the Transmission application's info.plist file (context menu>Show Package Contents) worked the first time:

Code: Select all

<key>LSEnvironment</key>
	<dict>
		<key>TRANSMISSION_WEB_HOME</key>
		<string>/path/to/shift</string>
	</dict>
You can do this in BBEdit, or use an XML editor like XCode or PlistEdit Pro. Or I suppose in pico or vi etc.

As reported before, the first time I did this Transmission choked on launch but somehow ended up setting the variable anyway, so when I removed that (restoring info.plist to default) and launched again, the WebUI was now set to Shift.

Attempting to change the info.plist again never again threw up launch errors, but also never again succeeded in changing the environment variable. (I was trying to switch between "shift" and "flood". At first I thought this was because I had disabled gatekeeper for Transmission to get it to launch without error (xattr -dr com.apple.quarantine /path/to/Transmission.app.). But re-downloading Transmission restored the quarantine flag (xattr /path/to/Transmission.app). And repeating the process also failed to change the variable.

BTW, replacing the app with a fresh copy restored the default WebUI (which was good to know how to do).

Surprisingly, nowhere is it clear where TRANSMISSION_WEB_HOME is actually set in the system, or anywhere I could find in the app's package. Searching the phrase in Spotlight (HoudahSpot) had no results. It's also not in the settings file. (That alone was a challenge to find. It's not called settings.json, and not kept with the other data files in ~/Library/Application Support/Transmission, but rather in a user preference file: ~/Library/Preferences org.m0k.transmission.plist.) Adding the key to that file also did nothing.

Others have tried different approaches. But I've yet to see one that anyone reports actually works. Some involve using launchctl (maybe potential, also see this), and others putting the export command in .zshrc files (pretty clearly won't work for the GUI apps). using open with an --args argument may have worked in the past but is now apparently obsolete.

Fortunately in my case I got it to work as a fluke when I needed it to work. Now I have decided to migrate Transmission to Synology NAS. Which presents a whole host of other issues. But: Shift worked there too for path substitution in the same way, and setting the TRANSMISSION_WEB_HOME variable there within Container Manager was, relatively, a breeze.
metaclam
Posts: 110
Joined: Sat Jan 31, 2009 6:31 pm

Re: Path Substituiton

Post by metaclam »

killemov wrote: Mon May 06, 2024 8:54 am Ah, I would not have thought to use Transmission as a tool to manage my content library.
I would not have thought not to. So do most people just double up? Keep one copy of a file to seed, in a single folder, and another organized? I've got storage challenges as it is.

Mac transmission made it easy to select torrents and move them anywhere in the GUI. Now that I'm trying to adopt a linux-based build, that would be a PIA, as you have to pretty much type out paths. I wonder if it's possible for a WebUI to use a host-OS based file picker? It's definitely done in many browsers for other purposes.
killemov
Posts: 556
Joined: Sat Jul 31, 2010 5:04 pm

Re: Path Substituiton

Post by killemov »

My entire TV experience is automated with SickChill => Transmission => SickChill and uses hardlinks for files on the same partition and softlinks (manually) for offloaded files.
Post Reply