-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathaddon.py
More file actions
40 lines (29 loc) · 901 Bytes
/
Copy pathaddon.py
File metadata and controls
40 lines (29 loc) · 901 Bytes
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
from xbmcswift2 import Plugin
from resources import megacmd
PLUGIN_NAME = 'MegaCMD'
PLUGIN_ID = 'plugin.video.megacmd'
plugin = Plugin(PLUGIN_NAME, PLUGIN_ID, __file__)
@plugin.route('/<path>')
def route_me(path):
return index(path=path)
@plugin.route('/')
def index(path='/'):
megacmd_files = megacmd.list_files(path)
items = []
for file_info in megacmd_files:
item = {
'label': file_info["name"],
'thumbnail': None,
'info': {
'plot': None
},
'is_playable': not file_info["is_dir"] }
if file_info["is_dir"]:
item["path"] = plugin.url_for(route_me, path=file_info["path"])
else:
item["path"] = file_info["url"]
xbmc.log(file_info["path"], xbmc.LOGERROR)
items.append(item)
return items
if __name__ == '__main__':
plugin.run()