ShokoAnime / ShokoServer

Repository for Shoko Server.
http://shokoanime.com/shoko-server/
MIT License
391 stars 75 forks source link

Add file relocation and renaming api for v3 #1081

Closed revam closed 3 months ago

revam commented 1 year ago

I've tested the new file endpoints to a degree (on linux using sqlite), moving files around, renaming them, creating hard and soft copies, and squashed a few bugs while I was at it.


So this PR adds renaming to the v3 api, and cleans up the move/rename internals, adapts the v1 api to the new internals, among other things.

sdaqo commented 1 year ago

Will this PR make it possible to have one source import folder and another destination import folder where the files don't get moved but linked or copied instead? If yes awesome. Does it work well enough to test it?

da3dsoul commented 1 year ago

No. Copying isn't really a good idea anyway. If you want copies, then use a copy on complete script in your downloader. We can't implement hard linking because .net doesn't have an API for it. Shoko can move hard links if you make a hard link via a completion script in your downloader.

revam commented 1 year ago

In case you didn't know @da3dsoul, i added and have tested adding hard linking support in this PR. They won't be made automatically by any renaming script, but it's possible to create them through the REST v3 API in this PR as of right now.

revam commented 1 year ago

Also when hard linking (or just creating another location in general) then the two locations will automatically be excempt from auto deletion.

revam commented 1 year ago

There are a few things to change up, so I've converted this PR to a draft for now, since I'm focusing on the other PR for adding TMDB support.

revam commented 1 year ago

Will this PR make it possible to have one source import folder and another destination import folder where the files don't get moved but linked or copied instead? If yes awesome. Does it work well enough to test it?

While it might make that possible it won't make it possible with a traditional renamer, you would have to use the file events directly and also either use the REST api or reference the shoko dlls directly and not using the abstraction.

revam commented 3 months ago

Closed by cfaffe5. And no. No Hard linking were added. Only the file relocation and renamer/renamer scripts.