NFLmusic库文件
This commit is contained in:
50
nflmusic/files.py
Normal file
50
nflmusic/files.py
Normal file
@ -0,0 +1,50 @@
|
||||
import os
|
||||
from nflmusic.assets import images as ima
|
||||
import json
|
||||
|
||||
|
||||
def create_path():
|
||||
# 父文件夹
|
||||
if not os.path.exists("../.NFLmusic"):
|
||||
os.makedirs("../.NFLmusic")
|
||||
# 子文件夹assets
|
||||
if not os.path.exists("../.NFLmusic/assets"):
|
||||
os.makedirs("../.NFLmusic/assets")
|
||||
# 子文件夹data
|
||||
if not os.path.exists("../.NFLmusic/data"):
|
||||
os.makedirs("../.NFLmusic/data")
|
||||
# 子文件夹downloads
|
||||
if not os.path.exists("../.NFLmusic/downloads"):
|
||||
os.makedirs("../.NFLmusic/downloads")
|
||||
# 子文件夹assets/buttons
|
||||
if not os.path.exists("../.NFLmusic/assets/buttons"):
|
||||
os.makedirs("../.NFLmusic/assets/buttons")
|
||||
# 子文件夹data/settings
|
||||
if not os.path.exists("../.NFLmusic/data/settings"):
|
||||
os.makedirs("../.NFLmusic/data/settings")
|
||||
|
||||
|
||||
def create_files(file, method, content=None):
|
||||
if content is not None:
|
||||
with open(file, method) as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
def init():
|
||||
create_path()
|
||||
create_files("../.NFLmusic/assets/buttons/play_music.png", "wb", ima.buttons["play_music"])
|
||||
create_files("../.NFLmusic/assets/buttons/pause_music.png", "wb", ima.buttons["pause_music"])
|
||||
create_files("../.NFLmusic/assets/buttons/stop_music.png", "wb", ima.buttons["stop_music"])
|
||||
create_files("../.NFLmusic/assets/buttons/delete.png", "wb", ima.buttons["delete"])
|
||||
create_files("../.NFLmusic/assets/buttons/refresh.png", "wb", ima.buttons["refresh"])
|
||||
create_files("../.NFLmusic/assets/icon.ico", "wb", ima.icon)
|
||||
|
||||
data = {
|
||||
"auto_update": True
|
||||
}
|
||||
|
||||
create_files("../NFLmusic/assets/data/settings/auto_update.json", "w", json.dumps(data["auto_update"]))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
init()
|
Reference in New Issue
Block a user