2004-11-17, 22:34
hi,
after reading the thread on rarred vobsubs, i thought why not implement unrarring more generally into the filesystem. so i've uploaded a patch as a proposal. from the readme:
----------------------------------
ok, say there exists some file "smb://ip/archive.rar" that contains a compressed file "folder\file.ext". you want to access "folder\file.ext" for reading operations.
1.)first step: create a rar url path using the function
cutil::createrarpath(cstdstring& strurlpath, const cstdstring& strrarpath, const cstdstring& strfilepathinrar, const cstdstring& strpwd, const cstdstring& strcachepath = "z:\\"), where
strrarpath is the path of the rar file("smb://ip/archive.rar"),
strfilepathinrar is the relative path of the compressed file ("folder\file.ext"),
strpwd is the archive password (strpwd = "" if the rar is not encrypted)
strcachepath is a folder where temporary files will be copied (default is z:\![Wink Wink](https://forum.kodi.tv/images/smilies/wink.png)
strurlpath is a place holder that will be filled with the rar url, which is of the form
strurlpath = "rar://strcachepath,strrarpath,strfilepathinrar,strpwd"
2.) open a file supplying the above rar url:
cfile file;
file.open(strurlpath);
the filesystem first finds the .rar. if it is on the network, it will be cached to strcachepath. then, it opens the .rar and extracts the file strfilepathinrar to the cache. all further file operations are redirected to this cached file so you can read it etc.. note however that compressing back into the original .rar is not supported so when you write to file, you are only modifying the cached version.
3.) when you are done, call
file.close()
this will close the file and automatically delete the cached files.
-----------------------------------
i also got the following idea : when you open any file and the filesystem does not find it, look for a .rar of the same name which would contain that file and open it if it exists. that way, you could rar any file you want and the system would still open it. i did not implement this cause i wasn't sure if it's really a usefull/wanted feature
please post any suggestions/feedback.
after reading the thread on rarred vobsubs, i thought why not implement unrarring more generally into the filesystem. so i've uploaded a patch as a proposal. from the readme:
----------------------------------
ok, say there exists some file "smb://ip/archive.rar" that contains a compressed file "folder\file.ext". you want to access "folder\file.ext" for reading operations.
1.)first step: create a rar url path using the function
cutil::createrarpath(cstdstring& strurlpath, const cstdstring& strrarpath, const cstdstring& strfilepathinrar, const cstdstring& strpwd, const cstdstring& strcachepath = "z:\\"), where
strrarpath is the path of the rar file("smb://ip/archive.rar"),
strfilepathinrar is the relative path of the compressed file ("folder\file.ext"),
strpwd is the archive password (strpwd = "" if the rar is not encrypted)
strcachepath is a folder where temporary files will be copied (default is z:\
![Wink Wink](https://forum.kodi.tv/images/smilies/wink.png)
strurlpath is a place holder that will be filled with the rar url, which is of the form
strurlpath = "rar://strcachepath,strrarpath,strfilepathinrar,strpwd"
2.) open a file supplying the above rar url:
cfile file;
file.open(strurlpath);
the filesystem first finds the .rar. if it is on the network, it will be cached to strcachepath. then, it opens the .rar and extracts the file strfilepathinrar to the cache. all further file operations are redirected to this cached file so you can read it etc.. note however that compressing back into the original .rar is not supported so when you write to file, you are only modifying the cached version.
3.) when you are done, call
file.close()
this will close the file and automatically delete the cached files.
-----------------------------------
i also got the following idea : when you open any file and the filesystem does not find it, look for a .rar of the same name which would contain that file and open it if it exists. that way, you could rar any file you want and the system would still open it. i did not implement this cause i wasn't sure if it's really a usefull/wanted feature
please post any suggestions/feedback.