-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaplistmaker.py
More file actions
32 lines (25 loc) · 811 Bytes
/
maplistmaker.py
File metadata and controls
32 lines (25 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import tkinter as tk
from tkinter import filedialog
from tkinter import *
root = tk.Tk()
root.withdraw()
filepath = ''
path1 = os.getenv('LOCALAPPDATA') + '\\osu!\\Songs'
if os.path.isdir(path1):
filepath = path1
else:
filepath = filedialog.askdirectory()
map_list = [dI for dI in os.listdir(filepath) if os.path.isdir(os.path.join(filepath,dI))]
url_list = []
for map_dir in map_list:
tokens = map_dir.split()
url_list.append('https://osu.ppy.sh/s/' + tokens[0])
def redirect_to_file():
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
os.chdir(desktop)
with open('beatmaplist.txt', 'w', encoding='utf-8') as outfile:
for item in url_list:
outfile.write('%s\n' % item)
if __name__ == '__main__':
redirect_to_file()