forked from patrick-klein/script.library.integration.tool
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcontext2.py
More file actions
50 lines (42 loc) · 1.52 KB
/
context2.py
File metadata and controls
50 lines (42 loc) · 1.52 KB
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
# -*- coding: utf-8 -*-
"""This module gets called from the context menu item "Sync directory to library" (32001).
The purpose is to stage all movies/tvshows in the current directory, and update database.
"""
import xbmc
from resources.lib.database import Database
from resources.lib.gui.progressbar import ProgressBar
from resources.lib.gui.select import Select
from resources.lib.menus.synced import SyncedMenu
from resources.lib.misc import get_string, notification
from resources.lib.progressbar import ProgressBar
from resources.lib.utils import entrypoint
LOG = logging.getLogger(basename(__file__))
logger.logging_setup()
@entrypoint
def main():
"""Main entrypoint for context menu item."""
select_menu = Select(heading=get_string(32164), turn_bold=True, back_option=32157)
select_menu.options(
{
32160: "all_items",
32161: "movie",
32162: "tvshow",
32167: "filter",
},
turn_bold=False,
)
selected_option = select_menu.show(use_details=False)
if selected_option:
_, _, selected_value = selected_option
if selected_value == "back":
notification(get_string(32158), 4000)
return
SyncedMenu(
database=Database(), progressdialog=ProgressBar()
).add_all_items_in_directory(
selected_value,
xbmc.getInfoLabel("Container.FolderName"),
xbmc.getInfoLabel("Container.FolderPath"),
)
if __name__ == "__main__":
main()