31 lines
654 B
Python
31 lines
654 B
Python
|
# coding: utf-8
|
||
|
import os
|
||
|
import os.path
|
||
|
import codecs
|
||
|
import json
|
||
|
|
||
|
class stream_cl(object):
|
||
|
exposed = True
|
||
|
|
||
|
def __init__(self):
|
||
|
pass
|
||
|
|
||
|
def loadCharge(self, id):
|
||
|
filename = str(id)
|
||
|
filename += '.json'
|
||
|
|
||
|
file = codecs.open(os.path.join('data', filename), 'r', 'utf-8')
|
||
|
charge = file.read()
|
||
|
file.close()
|
||
|
|
||
|
return charge
|
||
|
|
||
|
def anzChargen(self):
|
||
|
files = os.listdir('data')
|
||
|
fileCounter = 0
|
||
|
|
||
|
for file in files:
|
||
|
if file.endswith('.json'):
|
||
|
fileCounter += 1
|
||
|
|
||
|
return fileCounter
|