Compare commits
No commits in common. "295a44fbaa7619cd15a5b82705b10ef5f4f48359" and "733c7767a3a4c65ad9f8ddff3128ac4a67195da1" have entirely different histories.
295a44fbaa
...
733c7767a3
3 changed files with 15 additions and 8 deletions
|
@ -1,8 +1,16 @@
|
|||
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")
|
||||
|
@ -32,7 +40,7 @@ parser.add_argument(
|
|||
"--number",
|
||||
type=int,
|
||||
default=NUM_MUS,
|
||||
help="Modifier le nombre de musiques par joueur",
|
||||
help=f"Modifier le nombre de musiques par joueur",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--lists",
|
||||
|
@ -89,6 +97,6 @@ write_results(USERS, MUSIK, args.results)
|
|||
# Écriture de la blacklist
|
||||
if not args.no_blacklist:
|
||||
print("> Écriture de la blacklist")
|
||||
write_blacklist(USERS, MUSIK, args.blacklists)
|
||||
write_blacklist(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: _m not in blacklist, _raw_musiks))
|
||||
_musiks = list(filter(lambda _m: not _m 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(USERS, MUSIK, BLACKLIST):
|
||||
def write_blacklist(BLACKLIST):
|
||||
for user, musik in zip(USERS, MUSIK):
|
||||
with bl_path(BLACKLIST, user).open("a") as f:
|
||||
f.write("\n")
|
||||
|
|
|
@ -29,8 +29,7 @@ def create_playlist(MUSIK):
|
|||
)
|
||||
pl_response = pl_request.execute()
|
||||
print(
|
||||
"> > Playlist créée :",
|
||||
f"https://www.youtube.com/playlist?list={pl_response['id']}"
|
||||
f"> > Playlist créée : https://www.youtube.com/playlist?list={pl_response['id']}"
|
||||
)
|
||||
|
||||
# Insertion des musiques dans la playlist
|
||||
|
@ -52,5 +51,5 @@ def create_playlist(MUSIK):
|
|||
}
|
||||
},
|
||||
)
|
||||
request.execute()
|
||||
response = request.execute()
|
||||
print()
|
||||
|
|
Loading…
Reference in a new issue