ERROR: This is not rar file

I’m using the “RAR archive support” plugin (section Virtual Filesystems), since some of my older movies are packed in rar files. Great Kodi feature :slight_smile:
Running the opensubtitles plugin works fine on non-rarred movies/series.
But when running the opensubtitles.com plugin on a movie that is packed in rar files, I get the following error:

2024-08-06 10:49:03.769 T:94555   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'Exception'>
                                                   Error Contents: ERROR: This is not rar file.
                                                   Traceback (most recent call last):
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/service.py", line 8, in <module>
                                                       SubtitleDownloader().handle_action()
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/resources/lib/subtitle_downloader.py", line 58, in handle_action
                                                       self.search()
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/resources/lib/subtitle_downloader.py", line 63, in search
                                                       file_data = get_file_data(get_file_path())
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/resources/lib/file_operations.py", line 42, in get_file_data
                                                       item["file_size"], item["moviehash"] = hash_file(item["file_original_path"], item["rar"])
                                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/resources/lib/file_operations.py", line 50, in hash_file
                                                       return hash_rar(file_path)
                                                              ^^^^^^^^^^^^^^^^^^^
                                                     File "/Users/mark/Library/Application Support/Kodi/addons/service.subtitles.opensubtitles-com/resources/lib/file_operations.py", line 82, in hash_rar
                                                       raise Exception("ERROR: This is not rar file.")
                                                   Exception: ERROR: This is not rar file.
                                                   -->End of Python script error report<--

2024-08-06 10:49:03.814 T:94392   error <general>: GetDirectory - Error getting plugin://service.subtitles.opensubtitles-com/?action=search&languages=English&preferredlanguage=English

I’m using the latest plugin from the official kodi repo (1.04).
I hope this can be fixed. Let me know if i can do anything to help.

yeah sorry about that, the RAR files are not working at the moment. if you are an experienced python developper and wish to contribute to help implement this you’ll be most welcome.

I’m not really a programmer but i can read python a bit.
I can make it work if you change file file_operations.py
from:

    elif file_original_path.find("rar://") > -1:
        item["rar"] = True
        item["file_original_path"] = os.path.dirname(file_original_path[6:])

to:

    elif file_original_path.find("rar://") > -1:
        item["rar"] = True
        item["file_original_path"] = os.path.dirname(file_original_path[6:])
        item["basename"] = os.path.basename(file_original_path)
        return item

But i’m not sure if other properties like file_size and/or moviehash are needed to get better results?