Changed to a directory structure

This commit is contained in:
MysaaJava 2024-01-10 17:09:51 +01:00
parent 5fd30dcbe8
commit 8f3eaf520c
Signed by: Mysaa
GPG Key ID: DBA23608F23F5A10
50 changed files with 3 additions and 32 deletions

View File

@ -1,27 +0,0 @@
TF1
France 2
France 3
Canal +
France 5
M6
Arte
C8
W9
TMC
TFX
NRJ 12
LCP Assemblée Nationale
Public Sénat
France 4
BFM TV
CNews
CStar
Gulli
TF1 Séries Films
LEquipe
6ter
RMC Story
RMC Découverte
Chérie 25
LCI
Franceinfo

View File

@ -40,19 +40,17 @@ conn.commit()
folder = pathlib.Path(".")
groups = {}
for item in folder.glob("*.txt"):
arr = str(item)[0:-4].split("_")
for item in folder.rglob("*.txt"):
arr = str(item)[0:-4].split("/")
for i in range(len(arr)):
groups.setdefault(i,set())
groups[i].add(tuple(arr[:i+1]))
conn.commit()
groupids = {}
for i in groups.keys():
for group in groups[i]:
name = group[-1]
filename="_".join(group) + ".txt"
filename="/".join(group) + ".txt"
parentid = groupids[tuple(group[:-1])] if len(group)>1 else None
newid = newgroup(name,parentid)
groupids[group] = newid