Changed to a directory structure
This commit is contained in:
parent
5fd30dcbe8
commit
8f3eaf520c
@ -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
|
||||
L’Equipe
|
||||
6ter
|
||||
RMC Story
|
||||
RMC Découverte
|
||||
Chérie 25
|
||||
LCI
|
||||
Franceinfo
|
||||
8
todb.py
8
todb.py
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user