Jump to content

Help with a python/ c++ converting program

Guest
Go to solution Solved by Guest,
1 hour ago, mathijs727 said:

 

 

3 hours ago, vorticalbox said:

 

 

Finally got it to work in CMD!! Thanks for both of your help!!!

image.png.af6f8080da144c13e2329934177a700f.png

I needed a program to convert .adf files to .mp3 and nothing worked. Then i found 2 codes and thought that they might work, but i have no idea how to get them running. The first one is python (2.0 i think) 

And when running it just flashes a black console and then closes. When opening in visual studio code i still cant get it to work...

I want to do the proccess, because i like the gta VC radios and would like to convert to mp3 myself, because youtube loses a lot of quality.

Spoiler

#!/usr/bin/env python

import sys
import os

def adf2mp3(input_path, output_path, buffer_size=1024*1024):
    print 'Converting', output_path
    input_file = open(input_path, 'rb')
    output_file = open(output_path, 'wb')
    for read_buffer in iter(lambda: input_file.read(buffer_size), ''):
        output_buffer = (chr(ord(b) ^ 0x22) for b in read_buffer)
        output_file.writelines(output_buffer)
        sys.stdout.write('.')
        sys.stdout.flush()
    input_file.close()
    output_file.close()
    print '[Done]'

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        print 'Usage: %s filename.adf' % sys.argv[0]
        sys.exit(1)
    adf_file = sys.argv[1]
    mp3_file = os.path.splitext(adf_file)[0].lower() + '.mp3'
    adf2mp3(adf_file, mp3_file)

 

The next one is c++.

That i cant get it to work also... I opened it in VS code, saved as a c++ file, and it doesnt open also.

https://codereview.stackexchange.com/questions/75011/converting-gta-vice-city-adf-audio-files-to-mp3

 

If you have any idea how to help, please to.

The proccess should look like this.  FLASH.ADF ----> Flash.mp3

 

Link to comment
Share on other sites

Link to post
Share on other sites

 Python script.py path/to/input path/to/output

 

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, vorticalbox said:

 Python script.py path/to/input path/to/output

 

 

What? I havent used python for complex input/output processes, can you elaborate what do i need to change in code to make it work.

Link to comment
Share on other sites

Link to post
Share on other sites

21 minutes ago, Almostbauws said:

What? I havent used python for complex input/output processes, can you elaborate what do i need to change in code to make it work.

The code will work. It takes two arguments after the script the first is the path to the set file and the second is the output  file.

 

Edit:

It just takes 1 arg and that's the input file. Move the adf file in the same folder as the script and run 

 

 

python scriptname.py thefile.adf

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

30 minutes ago, vorticalbox said:

The code will work. It takes two arguments after the script the first is the path to the set file and the second is the output  file.

 

Edit:

It just takes 1 arg and that's the input file. Move the adf file in the same folder as the script and run 

 

 

python scriptname.py thefile.adf

Still nothing happens.

Link to comment
Share on other sites

Link to post
Share on other sites

36 minutes ago, vorticalbox said:

The code will work. It takes two arguments after the script the first is the path to the set file and the second is the output  file.

 

Edit:

It just takes 1 arg and that's the input file. Move the adf file in the same folder as the script and run 

 

 

python scriptname.py thefile.adf

Do i need to name the files and folder something specific too, or how does this work?

Link to comment
Share on other sites

Link to post
Share on other sites

32 minutes ago, Almostbauws said:

Do i need to name the files and folder something specific too, or how does this work?

Say you had the adf file in c:\my file.adf then to use that file you would put

 

Python theScriptName.py c:\my file.adf

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, vorticalbox said:

Say you had the adf file in c:\my file.adf then to use that file you would put

 

Python theScriptName.py c:\my file.adf

Where would i put this command? Do i open a python terminal and then type that in?

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Almostbauws said:

Where would i put this command? Do i open a python terminal and then type that in?

PowerShell, cmd,  terminal emulators 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

17 hours ago, vorticalbox said:

PowerShell, cmd,  terminal emulators 

Capture.PNG.e0ebe52791f654bd2ca63c3ae2537a82.PNG

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Almostbauws said:

Capture.PNG.e0ebe52791f654bd2ca63c3ae2537a82.PNG

You need to install python

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, vorticalbox said:

You need to install python

 

i have. I installed python 2.7, but maybe i need to install 3.0 then, but i had issues with 3.0 too.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Almostbauws said:

i have. I installed python 2.7, but maybe i need to install 3.0 then, but i had issues with 3.0 too.

Try “python” (without the capital P)

Desktop: Intel i9-10850K (R9 3900X died 😢 )| MSI Z490 Tomahawk | RTX 2080 (borrowed from work) - MSI GTX 1080 | 64GB 3600MHz CL16 memory | Corsair H100i (NF-F12 fans) | Samsung 970 EVO 512GB | Intel 665p 2TB | Samsung 830 256GB| 3TB HDD | Corsair 450D | Corsair RM550x | MG279Q

Laptop: Surface Pro 7 (i5, 16GB RAM, 256GB SSD)

Console: PlayStation 4 Pro

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, mathijs727 said:

 

 

3 hours ago, vorticalbox said:

 

 

Finally got it to work in CMD!! Thanks for both of your help!!!

image.png.af6f8080da144c13e2329934177a700f.png

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×