RAR5 being detected incorrectly

Issue #165 new
Adam Baxter created an issue

2018-02-09.png

Trying 'renamed' file: MADAGASCAR.KARTZ.ATAX/PS3_GAME/ICON0.PNG
Grabbing large enough data piece size for testing.
Trying 2011-03-02 4.00.
Trying 2011-05-29 4.01.
Trying 2012-01-10 4.10.
Trying 2012-02-18 4.11.
Trying 2012-06-09 4.20.
Trying 2013-08-22 5.00.
Trying 2013-12-01 5.01.
Trying 2014-06-11 5.10.
Trying 2014-08-28 5.11.
Trying 2014-12-02 5.20.
Trying 2015-02-15 5.21.
Trying 2015-11-18 5.30.
Trying 2016-08-15 5.40.
RAR5 files are not yet supported!
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/rescene/srr.py", line 602, in main
    parser.exit(manage_srr(options, infolder, infiles, working_dir))
  File "/usr/local/lib/python2.7/dist-packages/rescene/srr.py", line 316, in manage_srr
    options.volume is None, options.volume, rar_mt)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 1323, in reconstruct
    in_folder, hints, auto_locate_renamed)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 1712, in get_rar_data_object
    auto_locate_renamed))
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 2024, in compressed_rar_file_factory
    nblock, followup_src, solid=False)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 2149, in __init__
    first_block, blocks, thread_count)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 2397, in search_matching_rar_executable
    if try_rar_executable(rar, args, old):
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 2327, in try_rar_executable
    with RarStream(out, compressed=True, packed_file_name=pfn) as rs:
  File "/usr/local/lib/python2.7/dist-packages/rescene/rarstream.py", line 76, in __init__
    if not middle and not _check(first_rar):
  File "/usr/local/lib/python2.7/dist-packages/rescene/rarstream.py", line 44, in _check
    rar_reader = rar.RarReader(first_rar)
  File "/usr/local/lib/python2.7/dist-packages/rescene/rar.py", line 1429, in __init__
    raise ValueError("RAR5 files are not yet supported!")
ValueError: RAR5 files are not yet supported!
Unexpected Error: RAR5 files are not yet supported!Trying 2017-08-11 5.50.

Comments (6)

  1. Da Fox

    I think the problem is not with the input rar, but with one of the rars created by srr as it searches for the correct rar version. Probably 5.40 is creating a rar5 archive. You need to tell it to generate a rar4 archive instead; use the -ma4 switch. This is probably a known issue, as rar5 support is currently still under construction.

  2. Pieter De Cang (Duckbuster)

    Hi, Any idea when RAR5 support will be implemented?

    A lot of new scene files use RAR5 now.

  3. Paul Mulders

    I fixed this locally. In main.py you want to add a “-ma4” param to the arguments in arglist() in case int(RarExecutable.major) == 5. I’ll make a pull request once I fully test my implementation. Just wanted to make a quick comment

  4. XP1

    I have added a few lines to force the switch.

    a = [self.path()]
    if int(self.major) >= 5:
        a.append("-ma4")
    

    In my local "\rescene\main.py", I have made the above change in 3 places:

    1. RarExecutable def full(self):
    2. def search_matching_rar_executable(self, block, blocks, thread_count, more_files=False):
    3. def try_rar_executable(rar, args, old=False):

    before custom_popen([rarexe.path()] + args.arglist()).

    Make sure that the variable names rarexe or rar are correct.

  5. Paul Mulders
    From 1a99b7847579109475486f59f6c3050aa1f84705 Mon Sep 17 00:00:00 2001
    From: Me <me@me.me>
    Date: Tue, 25 Oct 2022 15:59:15 +0200
    Subject: [PATCH] pass -ma4 flag for rar exes that create RAR 5.0 files by
     default
    
    ---
     rescene/main.py | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/rescene/main.py b/rescene/main.py
    index 4d78672..ca41a95 100644
    --- a/rescene/main.py
    +++ b/rescene/main.py
    @@ -1865,6 +1865,7 @@ class RarArguments(object):
            self.threads = ""
            self.split = ""
            self.old_naming_flag = "-vn"
    +       self.format_flag = ""
    
        def increase_thread_count(self, rarbin):
            # <threads> parameter can take values from 0 to 16.
    @@ -1917,6 +1918,7 @@ class RarArguments(object):
                ["a", self.compr_level, self.dict_size, 
                self.solid, self.solid_namesort, self.threads,
                self.old_naming_flag, # old style volume naming scheme
    +           self.format_flag, # format flag for rar exes that default to RAR 5.0
                "-o+", # Overwrite all
                "-ep", # Exclude paths from names.
                "-idcd", # Disable messages: copyright string, "Done" string
    @@ -1975,6 +1977,9 @@ class RarArguments(object):
        def set_rar2_flags(self, rar2_detected):
            self.old_naming_flag = "" if rar2_detected else "-vn"
    
    +   def set_rar5_flags(self, rar5_detected):
    +       self.format_flag = "-ma4" if rar5_detected else ""
    +
     def compressed_rar_file_factory(block, blocks, src,
                                    in_folder, hints, auto_locate_renamed):
        global regular_method_failed
    @@ -2273,6 +2278,8 @@ class CompressedRarFile(io.IOBase):
                # we assume that newer versions always compress better
                rarexe = repository.get_most_recent_version()
                args.set_rar2_flags(re.search(r'_rar2', rarexe.path()) is not None)
    +           args.set_rar5_flags(int(rarexe.major) > 5 or
    +               int(rarexe.major) == 5 and int(rarexe.minor) >= 50)
    
                window_size = block.get_dict_size()
                amount = 0
    -- 
    2.38.1
    

    in case paste expires

  6. Log in to comment