Skip to content

Commit e51878a

Browse files
committed
initial commit
0 parents  commit e51878a

7 files changed

+200
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
.hypothesis/
49+
.pytest_cache/
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Django stuff:
56+
*.log
57+
local_settings.py
58+
db.sqlite3
59+
60+
# Flask stuff:
61+
instance/
62+
.webassets-cache
63+
64+
# Scrapy stuff:
65+
.scrapy
66+
67+
# Sphinx documentation
68+
docs/_build/
69+
70+
# PyBuilder
71+
target/
72+
73+
# Jupyter Notebook
74+
.ipynb_checkpoints
75+
76+
# IPython
77+
profile_default/
78+
ipython_config.py
79+
80+
# pyenv
81+
.python-version
82+
83+
# celery beat schedule file
84+
celerybeat-schedule
85+
86+
# SageMath parsed files
87+
*.sage.py
88+
89+
# Environments
90+
.env
91+
.venv
92+
env/
93+
venv/
94+
ENV/
95+
env.bak/
96+
venv.bak/
97+
98+
# Spyder project settings
99+
.spyderproject
100+
.spyproject
101+
102+
# Rope project settings
103+
.ropeproject
104+
105+
# mkdocs documentation
106+
/site
107+
108+
# mypy
109+
.mypy_cache/
110+
.dmypy.json
111+
dmypy.json
112+
113+
# Pyre type checker
114+
.pyre/

README.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gtasa_usertrack_linker
2+
3+
4+
this tool recursively searches given directorys for audio files (mp3, ogg, wav, wma) and creates shortcuts for them in the GTA:SA user track folder.
5+
6+
USAGE:
7+
8+
either call it from the commandline like this:
9+
gtasa_usertrack_linker.exe dir1 dir2 dir3
10+
11+
or drag and drop the directorys you want to search onto the executable.

build.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: UTF-8 -*-
3+
#
4+
# build.py for gtasa_usertrack_linker by shinrax2
5+
6+
import PyInstaller.__main__
7+
8+
args = [
9+
"--name=gtasa_usertrack_linker",
10+
"--clean",
11+
"--onefile",
12+
"main.py"
13+
]
14+
PyInstaller.__main__.run(args)

buildrequirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyinstaller==4.7

main.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: UTF-8 -*-
3+
#
4+
# main.py for gtasa_usertrack_linker by shinrax2
5+
6+
import os
7+
import sys
8+
9+
import winshell
10+
from win32com.client import Dispatch
11+
12+
def createLnk(shell, path, target):
13+
link = shell.CreateShortCut(path)
14+
link.Targetpath = target
15+
link.WorkingDirectory = os.path.dirname(target)
16+
link.save()
17+
18+
def getfiles(dirpath):
19+
f = []
20+
for root, dirs, files in os.walk(dirpath):
21+
for file in files:
22+
if os.path.isfile(os.path.join(root, file)):
23+
f.append(os.path.join(root, file))
24+
f.sort(key=str.lower)
25+
return f
26+
27+
def filerfiles(files):
28+
filetypes = [".wav", ".ogg", ".mp3", ".wma"]
29+
newfiles = []
30+
for file in files:
31+
for type in filetypes:
32+
if file.endswith(type) == True:
33+
newfiles.append(file)
34+
break
35+
newfiles.sort(key=str.lower)
36+
return newfiles
37+
38+
dirs = sys.argv[1:]
39+
40+
for dir in dirs:
41+
if os.path.isdir(dir) == True:
42+
shell = Dispatch("WScript.Shell")
43+
musicdir = dir
44+
usertrackdir = os.path.join(os.path.join(os.environ["HOMEDRIVE"], os.environ["HOMEPATH"]), "Documents\GTA San Andreas User Files\\User Tracks")
45+
print("scanning "+dir)
46+
files = filerfiles(getfiles(musicdir))
47+
print("found {0} matching files".format(len(files)))
48+
print("creating .lnk files")
49+
counter = 1
50+
for file in files:
51+
createLnk(shell, os.path.join(usertrackdir, os.path.basename(file)+"_"+str(counter)+"_.lnk"), file)
52+
counter += 1
53+
else:
54+
print("skipping {0}. its not a directory".format(dir))
55+
print("please provide a valid path to the music you want to use")
56+
input("done. press enter to exit.")

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pywin32==302
2+
winshell==0.6

0 commit comments

Comments
 (0)