Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
add generic back options in sub menus
Browse files Browse the repository at this point in the history
  • Loading branch information
pannal committed May 8, 2017
1 parent 223ef16 commit b5e5341
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Contents/Code/interface/item_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def SubtitleOptionsMenu(**kwargs):
oc.add(DirectoryObject(
key=Callback(ItemDetailsMenu, rating_key=kwargs["rating_key"], item_title=kwargs["item_title"],
title=kwargs["title"], randomize=timestamp()),
title=u"Back to: %s" % kwargs["title"],
title=u"< Back to %s" % kwargs["title"],
summary=kwargs["current_data"],
thumb=default_thumb
))
Expand Down Expand Up @@ -172,7 +172,7 @@ def ListAvailableSubsForItemMenu(rating_key=None, part_id=None, title=None, item
oc = SubFolderObjectContainer(title2=unicode(title), replace_parent=True)
oc.add(DirectoryObject(
key=Callback(ItemDetailsMenu, rating_key=rating_key, item_title=item_title, title=title, randomize=timestamp()),
title=u"Back to: %s" % title,
title=u"< Back to %s" % title,
summary=current_data,
thumb=default_thumb
))
Expand Down
38 changes: 34 additions & 4 deletions Contents/Code/interface/sub_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from babelfish import Language

from menu_helpers import debounce, SubFolderObjectContainer
from menu_helpers import debounce, SubFolderObjectContainer, default_thumb
from subzero.modification import registry as mod_registry, SubtitleModifications
from subzero.constants import PREFIX
from support.plex_media import get_plex_metadata, scan_videos
Expand All @@ -25,6 +25,15 @@ def SubtitleModificationsMenu(**kwargs):
current_mods = current_sub.mods or []

oc = SubFolderObjectContainer(title2=kwargs["title"], replace_parent=True)

from interface.item_details import SubtitleOptionsMenu
oc.add(DirectoryObject(
key=Callback(SubtitleOptionsMenu, randomize=timestamp(), **kwargs),
title=u"< Back to subtitle options for: %s" % kwargs["title"],
summary=kwargs["current_data"],
thumb=default_thumb
))

for identifier, mod in mod_registry.mods.iteritems():
if mod.advanced:
continue
Expand Down Expand Up @@ -76,16 +85,21 @@ def SubtitleFPSModMenu(**kwargs):
part_id = kwargs["part_id"]
item_type = kwargs["item_type"]

kwargs.pop("randomize")

oc = SubFolderObjectContainer(title2=kwargs["title"], replace_parent=True)

oc.add(DirectoryObject(
key=Callback(SubtitleModificationsMenu, randomize=timestamp(), **kwargs),
title="< Back to subtitle modification menu"
))

metadata = get_plex_metadata(rating_key, part_id, item_type)
scanned_parts = scan_videos([metadata], kind="series" if item_type == "episode" else "movie", ignore_all=True)
video, plex_part = scanned_parts.items()[0]

target_fps = plex_part.fps

kwargs.pop("randomize")

for fps in ["23.976", "24.000", "25.000", "29.970", "30.000", "50.000", "59.940", "60.000"]:
if float(fps) == float(target_fps):
continue
Expand Down Expand Up @@ -114,6 +128,11 @@ def SubtitleShiftModUnitMenu(**kwargs):

kwargs.pop("randomize")

oc.add(DirectoryObject(
key=Callback(SubtitleModificationsMenu, randomize=timestamp(), **kwargs),
title="< Back to subtitle modifications"
))

for unit, title in POSSIBLE_UNITS:
oc.add(DirectoryObject(
key=Callback(SubtitleShiftModMenu, unit=unit, randomize=timestamp(), **kwargs),
Expand All @@ -128,9 +147,14 @@ def SubtitleShiftModMenu(unit=None, **kwargs):
if unit not in POSSIBLE_UNITS_D:
raise NotImplementedError

kwargs.pop("randomize")

oc = SubFolderObjectContainer(title2=kwargs["title"], replace_parent=True)

kwargs.pop("randomize")
oc.add(DirectoryObject(
key=Callback(SubtitleShiftModUnitMenu, randomize=timestamp(), **kwargs),
title="< Back to unit selection"
))

rng = []
if unit == "h":
Expand Down Expand Up @@ -183,6 +207,12 @@ def SubtitleListMods(**kwargs):
kwargs.pop("randomize")

oc = SubFolderObjectContainer(title2=kwargs["title"], replace_parent=True)

oc.add(DirectoryObject(
key=Callback(SubtitleModificationsMenu, randomize=timestamp(), **kwargs),
title="< Back to subtitle modifications"
))

for identifier in current_sub.mods:
oc.add(DirectoryObject(
key=Callback(SubtitleSetMods, mods=identifier, mode="remove", randomize=timestamp(), **kwargs),
Expand Down

0 comments on commit b5e5341

Please sign in to comment.