Compare commits
2 commits
733c7767a3
...
295a44fbaa
Author | SHA1 | Date | |
---|---|---|---|
295a44fbaa | |||
1c92be85d1 |
3 changed files with 8 additions and 15 deletions
|
@ -1,16 +1,8 @@
|
|||
import argparse
|
||||
import itertools
|
||||
import pathlib
|
||||
import random
|
||||
import re
|
||||
|
||||
from datetime import date, datetime
|
||||
from pathlib import Path
|
||||
from urllib import parse, request
|
||||
|
||||
from .list import generate_list, write_blacklist, write_results
|
||||
|
||||
|
||||
ROOT_PATH = Path("./lists")
|
||||
BLACKLIST = Path("./blacklists")
|
||||
RESULTS = Path("./results")
|
||||
|
@ -40,7 +32,7 @@ parser.add_argument(
|
|||
"--number",
|
||||
type=int,
|
||||
default=NUM_MUS,
|
||||
help=f"Modifier le nombre de musiques par joueur",
|
||||
help="Modifier le nombre de musiques par joueur",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--lists",
|
||||
|
@ -97,6 +89,6 @@ write_results(USERS, MUSIK, args.results)
|
|||
# Écriture de la blacklist
|
||||
if not args.no_blacklist:
|
||||
print("> Écriture de la blacklist")
|
||||
write_blacklist(args.blacklists)
|
||||
write_blacklist(USERS, MUSIK, args.blacklists)
|
||||
|
||||
print("--- FIN ---")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from datetime import datetime
|
||||
import random
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def bl_path(BLACKLIST, user):
|
||||
|
@ -28,7 +28,7 @@ def generate_list(ROOT_PATH, NO_BLACKLIST, NUM_MUS, BLACKLIST):
|
|||
(re.compile(r"[\?\&]v=(\w+)").search(_musik) or ("", _musik))[1]
|
||||
for _musik in f.read().splitlines()
|
||||
]
|
||||
_musiks = list(filter(lambda _m: not _m in blacklist, _raw_musiks))
|
||||
_musiks = list(filter(lambda _m: _m not in blacklist, _raw_musiks))
|
||||
|
||||
assert (
|
||||
len(_musiks) >= NUM_MUS
|
||||
|
@ -45,7 +45,7 @@ def generate_list(ROOT_PATH, NO_BLACKLIST, NUM_MUS, BLACKLIST):
|
|||
return zip(*UM)
|
||||
|
||||
|
||||
def write_blacklist(BLACKLIST):
|
||||
def write_blacklist(USERS, MUSIK, BLACKLIST):
|
||||
for user, musik in zip(USERS, MUSIK):
|
||||
with bl_path(BLACKLIST, user).open("a") as f:
|
||||
f.write("\n")
|
||||
|
|
|
@ -29,7 +29,8 @@ def create_playlist(MUSIK):
|
|||
)
|
||||
pl_response = pl_request.execute()
|
||||
print(
|
||||
f"> > Playlist créée : https://www.youtube.com/playlist?list={pl_response['id']}"
|
||||
"> > Playlist créée :",
|
||||
f"https://www.youtube.com/playlist?list={pl_response['id']}"
|
||||
)
|
||||
|
||||
# Insertion des musiques dans la playlist
|
||||
|
@ -51,5 +52,5 @@ def create_playlist(MUSIK):
|
|||
}
|
||||
},
|
||||
)
|
||||
response = request.execute()
|
||||
request.execute()
|
||||
print()
|
||||
|
|
Loading…
Reference in a new issue