Fix index json path
This commit is contained in:
parent
6f5fb3a07b
commit
99736540b9
2 changed files with 94 additions and 76 deletions
|
|
@ -28,9 +28,9 @@ class Fragments:
|
|||
self.index_file = 'index.json'
|
||||
|
||||
def init_json(self, directory):
|
||||
index_path = os.path.join(directory, self.index_file)
|
||||
if os.path.isfile(index_path):
|
||||
with open(index_path) as json_file:
|
||||
self.index_path = index_path = os.path.join(directory, self.index_file)
|
||||
if os.path.isfile(self.index_path):
|
||||
with open(self.index_path) as json_file:
|
||||
self.json_data = json.load(json_file)
|
||||
|
||||
self.temp_data = {"fragments":[]}
|
||||
|
|
@ -191,7 +191,7 @@ class Fragments:
|
|||
|
||||
def save(self):
|
||||
print(json.dumps(self.indextable, cls=CustomEncoder))
|
||||
with open(self.index_file, 'w') as outfile:
|
||||
with open(self.index_path, 'w') as outfile:
|
||||
json.dump(self.indextable, outfile, indent=4, cls=CustomEncoder)
|
||||
self.count = len(self.indextable)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"__Fragment__": {
|
||||
"index": 0,
|
||||
"update": 1605624006.157665,
|
||||
"update": 1605935441.1233928,
|
||||
"directory": "./test_data/event_lecture",
|
||||
"artist": "event_lecture",
|
||||
"file": "event_0000"
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
{
|
||||
"__Fragment__": {
|
||||
"index": 1,
|
||||
"update": 1605624006.16457,
|
||||
"update": 1605935441.1251554,
|
||||
"directory": "./test_data/event_lecture",
|
||||
"artist": "event_lecture",
|
||||
"file": "event_0001"
|
||||
|
|
@ -20,52 +20,52 @@
|
|||
{
|
||||
"__Fragment__": {
|
||||
"index": 2,
|
||||
"update": 1503837516.0,
|
||||
"update": 1603870906.290785,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "\u110c\u1175\u11af\u110c\u116e.mp4"
|
||||
"file": "\uc9c8\uc8fc.mp4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 3,
|
||||
"update": 1567569419.653444,
|
||||
"update": 1604043931.1111157,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "\u1101\u116e\u1106\u116e\u11af\u1101\u116e\u1106\u116e\u11af.mov"
|
||||
"file": "RTF\ud14c\uc2a4\ud2b8.rtf"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 4,
|
||||
"update": 1603737283.2655902,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1693.png"
|
||||
"update": 1604043931.1281314,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "\uafb8\ubb3c\uafb8\ubb3c.mov"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 5,
|
||||
"update": 1603737296.0838926,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1340.jpg"
|
||||
"update": 1604043931.147918,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "20201022"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 6,
|
||||
"update": 1603737307.8227732,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1690.png"
|
||||
"update": 1604043931.1488578,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "20201029"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 7,
|
||||
"update": 1603737326.0093782,
|
||||
"update": 1604043931.238141,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1334.png"
|
||||
|
|
@ -74,61 +74,61 @@
|
|||
{
|
||||
"__Fragment__": {
|
||||
"index": 8,
|
||||
"update": 1603737524.8806562,
|
||||
"update": 1605581893.2483907,
|
||||
"directory": "./test_data/event_workshop",
|
||||
"artist": "event_workshop",
|
||||
"file": "event_0008"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 9,
|
||||
"update": 1604043931.259867,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1340.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 10,
|
||||
"update": 1604043931.3548143,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1690.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 11,
|
||||
"update": 1604043931.4324255,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "IMG_1693.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 12,
|
||||
"update": 1604043931.4409137,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "sample.pdf"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 9,
|
||||
"update": 1604243002.5126157,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "RTF\ud14c\uc2a4\ud2b8.rtf"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 10,
|
||||
"update": 1604247403.2948427,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "md\uc4f0\uae30.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 11,
|
||||
"update": 1604247403.2950983,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "txt\uc4f0\uae30.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 12,
|
||||
"update": 1604851924.8719456,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "20201022"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 13,
|
||||
"update": 1604851924.8802848,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "20201029"
|
||||
"update": 1604912200.5855331,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "test_folder"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 14,
|
||||
"update": 1605496049.4045768,
|
||||
"update": 1605935441.120187,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "1030.txt"
|
||||
|
|
@ -137,7 +137,16 @@
|
|||
{
|
||||
"__Fragment__": {
|
||||
"index": 15,
|
||||
"update": 1605496049.4053128,
|
||||
"update": 1605935441.1206152,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "md\uc4f0\uae30.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 16,
|
||||
"update": 1605935441.1206863,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "test002.txt"
|
||||
|
|
@ -145,8 +154,17 @@
|
|||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 16,
|
||||
"update": 1605496049.4058702,
|
||||
"index": 17,
|
||||
"update": 1605935441.1208577,
|
||||
"directory": "./test_data/carrot",
|
||||
"artist": "carrot",
|
||||
"file": "txt\uc4f0\uae30.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 18,
|
||||
"update": 1605935441.1260843,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "20201020"
|
||||
|
|
@ -154,8 +172,8 @@
|
|||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 17,
|
||||
"update": 1605496049.4062285,
|
||||
"index": 19,
|
||||
"update": 1605935441.1264834,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "fig002.txt"
|
||||
|
|
@ -163,8 +181,8 @@
|
|||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 18,
|
||||
"update": 1605496049.4064658,
|
||||
"index": 20,
|
||||
"update": 1605935441.126623,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "test.txt"
|
||||
|
|
@ -172,8 +190,8 @@
|
|||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 19,
|
||||
"update": 1605496049.406584,
|
||||
"index": 21,
|
||||
"update": 1605935441.126737,
|
||||
"directory": "./test_data/fig",
|
||||
"artist": "fig",
|
||||
"file": "test001.txt"
|
||||
|
|
@ -181,8 +199,8 @@
|
|||
},
|
||||
{
|
||||
"__Fragment__": {
|
||||
"index": 20,
|
||||
"update": 1605496049.407514,
|
||||
"index": 22,
|
||||
"update": 1605935441.127966,
|
||||
"directory": "./test_data/grape",
|
||||
"artist": "grape",
|
||||
"file": "fbdbdbf54d766dd86e5964de01ddc16b.jpg"
|
||||
|
|
|
|||
Loading…
Reference in a new issue