-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.py
executable file
·72 lines (48 loc) · 1.81 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
pre-reqs: Python 3.x, requests, and google-api-python-client libraries
Last modified: Feb 2018
By: Dave Bunten
License: MIT - see license.txt
"""
import os
import sys
import logging
import argparse
import datetime
from datetime import datetime,timedelta
import json
import random
import assets.mediasite.controller as controller
if __name__ == "__main__":
"""
args:
--file: json configuration file
"""
#gather our runpath for future use with various files
run_path = os.path.dirname(os.path.realpath(__file__))
#log file datetime
current_datetime_string = '{dt.month}-{dt.day}-{dt.year}_{dt.hour}-{dt.minute}-{dt.second}'.format(dt = datetime.now())
logfile_path = run_path+'/test_'+current_datetime_string+'.log'
#logger for log file
logging_format = '%(asctime)s - %(levelname)s - %(message)s'
logging_datefmt = '%m/%d/%Y - %I:%M:%S %p'
logging.basicConfig(filename=logfile_path,
filemode='w',
format=logging_format,
datefmt=logging_datefmt,
level=logging.INFO
)
#logger for console
console = logging.StreamHandler()
formatter = logging.Formatter(logging_format, datefmt=logging_datefmt)
console.setFormatter(formatter)
logging.getLogger().addHandler(console)
#open config file with configuration info
config_file = open(run_path+"/config/config.json")
config_data = json.load(config_file)
#creating the mediasite controller
mediasite = controller.controller(config_data)
catalogs = mediasite.catalog.get_all_catalogs()
for catalog in catalogs:
if not catalog["LinkedFolderId"]:
print(catalog["Name"])