Jump to content
  • Announcements

    • alpenwasser

      Please Use CODE Tags   31 Jan 2016

      Welcome to the Programming and Software Design Section,

      When asking for help with programming issues, please use the code tags to enclose your code, it makes things much more easily readable for the people trying to help you, thus improving your chances of actually getting help.
        To add code tags, click the <> button on the editor toolbar, then enter your code in the code editor that appears. If you are on a mobile device, or prefer to use BBCode, you can use [code] // Your code here // It will be syntax highlighted, though not necessarily corectly. [/code] (but the code editor is more consistent and less buggy).
Almostbauws

Help with a python/ c++ converting program

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

Recommended Posts

Posted · Original PosterOP

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 post
Share on other sites

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

 

 


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

Link to post
Share on other sites
Posted · Original PosterOP
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 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 post
Share on other sites
Posted · Original PosterOP
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 post
Share on other sites
Posted · Original PosterOP
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 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 post
Share on other sites
Posted · Original PosterOP
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 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 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 post
Share on other sites
Posted · Original PosterOP
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 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: Corsair RM550x | I7 4790k @ 4.7GHz | Corsair H100i (NF-F12 fans) | MSI GTX 1080 (2038MHz core / 5550MHz mem) | 16GB 1600MHz Corsair Vengeance (4x4GB) | Gigabyte MSI Z97 Gaming 5 Motherboard | Samsung 830 256GB SSD | 3TB HDD | 640GB HDD | Corsair 450D | MG279Q 144Hz 1440p IPS Monitor

Link to post
Share on other sites
Posted · Original PosterOP · Best Answer
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 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


  • Recently Browsing   0 members

    No registered users viewing this page.


×