hasse69 / rar2fs

FUSE file system for reading RAR archives
https://hasse69.github.io/rar2fs/
GNU General Public License v3.0
275 stars 27 forks source link

Override filenames #145

Closed karibertils closed 3 years ago

karibertils commented 3 years ago

Compatability issue with file names inside archives and various software which relies on the file name to recognize the content. Nice workaround for this would be having an option that would replace filenames by using the folder name that contains the archive + the original file extension as the new name. In my case there's always just single file inside so that would be perfect. But might be good to revert to original behaviour if there are multiple files inside.

hasse69 commented 3 years ago

First of all, this topic seems to cover two completely different requests/issues. If we look at the first one

Sometimes rar archives contain some folder structure causing trouble. Usually you can drill down through the folders and get to the content but not always.

That to me sounds like a bug and should be handled as such.

Similar issue is shortening of file names inside the archives causing software which relies on the file name to not recognize the content.

Can you please elaborate or give an example, I am not really sure I follow you here.

In general, the purpose of rar2fs is to mount RAR archives/folders and replicate the effect of having extracted the archive in place. I am not very keen on implementing modifications of the resulting file system structure which does not only make the whole process a lot more complex but also somewhat defeats the purpose of rar2fs. I believe that this kind of functionality should be provided by some other FUSE file system that can be stacked on top of rar2fs. There is an alias function that can be used to shadow/camouflage specific files (but not directories) which is probably how far rar2fs will ever allow this.

hasse69 commented 3 years ago

Can you please file the path resolution problem as a separate issue? You have just found a a rather severe issue with rar2fs.

karibertils commented 3 years ago

I opened seperate issues. About the issue with filenames i will elaborate here.

For example using Sonarr. Let's say you have Example/Example.S01E01/101.rar and inside the archive is file 101.avi or a/b/c/d/e/anything.avi for that matter.

Sonarr and other media software, will not recognize what 101.avi or anything.avi is, and will mark Example S01E01 as missing. If I extract and rename 101.avi or anything.avi to Example.S01E01.avi Sonarr marks S01E01 found.

I don't know what's the most practical solution to this issue. Maybe another fuse file system could be used to handle this.

hasse69 commented 3 years ago

I suggest you try out the alias feature, see rarconfig.example. If all you wish to do is to rename a file to something else that is what the alias feature can aid you with.

karibertils commented 3 years ago

OK I had not seen that feature yet. It works perfectly but I would have to put new entries in there continuously.

Would it be possible to support more dynamic syntax in rarconfig, something like this ?

[*.rar]
alias = "/*.mkv","/[archive_folder].mkv"

[*.rar]
alias = "/*.mp4","/[archive_folder].mp4"

[*.rar]
alias = "/*.avi","/[archive_folder].avi"
hasse69 commented 3 years ago

Something like that could perhaps be done but there are currently no plans to extend this feature further. Note that after you update your .rarconfig you need to send a SIGHUP signal to the rar2fs process in order to reload it. There is no need to unmount.

karibertils commented 3 years ago

OK, good to know about the SIGHUP. I'll play around with this and should do the trick