From 27b041374ab6699c54311215c63edd2409fdf80c Mon Sep 17 00:00:00 2001 From: Sattva <74269253+Sattva-108@users.noreply.github.com> Date: Sun, 18 May 2025 07:45:16 +0300 Subject: [PATCH] media: movies are back! --- Leatrix_Plus.lua | 31 ++++++++++++++++++----- Leatrix_Plus_Media.lua | 57 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index ad861be..de6cda6 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -15908,14 +15908,33 @@ function LeaPlusLC:RunOnce() return elseif originalTrackItemFromListData and type(originalTrackItemFromListData) == "string" and strfind(originalTrackItemFromListData, "|r") and not strfind(originalTrackItemFromListData, "#") then - -- Movie - local movieName, movieID = originalTrackItemFromListData:match("([^,]+)%|r([^,]+)") - if movieName and movieID then - movieID = strtrim(movieID, "()") - stopBtn:Click() - print("Movies are not yet supported in 3.3.5 backport.") + -- MOVIE section (Minimal with "Not Found" message) + stopBtn:Click() -- Stop any currently playing music + + local displayNamePart, identifierPart = originalTrackItemFromListData:match("^(.-)|r(.*)$") + identifierPart = identifierPart and strtrim(identifierPart) or "" + displayNamePart = displayNamePart and strtrim(displayNamePart) or L["Unknown Movie"] -- Get display name for message + + -- Check if the resolved path is empty or our "nil_path_" placeholder + if identifierPart == "" or string.find(identifierPart, "nil_path_") then + -- Use your addon's standard print function (LeaPlusLC:Print) + -- and try to provide the name of the movie the user clicked on. + LeaPlusLC:Print(string.format(L["Movie not found: %s"], displayNamePart)) + return + end + + local movieVolume = 150 -- Fixed default volume + + if _G.MovieFrame_PlayMovie and _G.MovieFrame then + _G.MovieFrame_PlayMovie(_G.MovieFrame, identifierPart:gsub("/", "\\"), movieVolume) + -- else + -- If MovieFrame_PlayMovie system itself is missing, playback will silently fail here. + -- This is a more fundamental addon issue than a single missing movie. + -- Optionally, you could add a developer-level print here for debugging if MovieFrame isn't loaded. + -- print("Developer: MovieFrame_PlayMovie or MovieFrame is nil.") end return + -- ... (rest of your OnClick logic for zone navigation, etc.) else -- Zone or other navigation ZonePage = scrollFrame:GetVerticalScroll() diff --git a/Leatrix_Plus_Media.lua b/Leatrix_Plus_Media.lua index 295fe61..889957e 100644 --- a/Leatrix_Plus_Media.lua +++ b/Leatrix_Plus_Media.lua @@ -712,16 +712,57 @@ -- Movies ---------------------------------------------------------------------- - -- Movies - Zn(L["Movies"], L["Movies"], "|cffffd800" .. L["Movies"], {""}) - Zn(L["Movies"], L["Movies"], L["World of Warcraft"] , { "|cffffd800" .. L["Movies"] .. ": " .. L["World of Warcraft"], prefol, L["Ten Years of Warcraft"] .. " |r(1)", L["World of Warcraft"] .. " |r(2)",}) - Zn(L["Movies"], L["Movies"], L["The Burning Crusade"] , { "|cffffd800" .. L["Movies"] .. ": " .. L["The Burning Crusade"], prefol, L["The Burning Crusade"] .. " |r(27)",}) - Zn(L["Movies"], L["Movies"], L["Wrath of the Lich King"], { "|cffffd800" .. L["Movies"] .. ": " .. L["Wrath of the Lich King"], prefol, - L["Wrath of the Lich King"] .. " |r(18)", - L["Battle of Angrathar the Wrathgate"] .. " |r(14)", - L["Fall of the Lich King"] .. " |r(16)", + -- In your Leatrix_Plus database file (e.g., Leatrix_Plus_DB.lua) + + -- Ensure L is available (Localization table) + -- local L = Leatrix_Plus.L or {}; -- Or however your localization is loaded + + -- MOVIE_PATHS contains the specific file paths your addon will use. + -- Keys are descriptive and used by the GetMoviePath helper. + local MOVIE_PATHS = { + WOW_LOGO_800 = "Interface\\Cinematics\\Logo_800", + WOW_LOGO_1024 = "Interface\\Cinematics\\Logo_1024", + WOW_INTRO_800 = "Interface\\Cinematics\\WOW_Intro_800", + WOW_INTRO_1024 = "Interface\\Cinematics\\WOW_Intro_1024", + TBC_INTRO_800 = "Interface\\Cinematics\\WOW_Intro_BC_800", + TBC_INTRO_1024 = "Interface\\Cinematics\\WOW_Intro_BC_1024", + WOTLK_INTRO_800 = "Interface\\Cinematics\\WOW_Intro_LK_800", + WOTLK_INTRO_1024 = "Interface\\Cinematics\\WOW_Intro_LK_1024", + } + + -- Simplified helper function: + -- Tries to get the 1024 resolution path, then falls back to 800, from MOVIE_PATHS. + local function GetMoviePath(highResKey, lowResKey) + if MOVIE_PATHS[highResKey] then + return MOVIE_PATHS[highResKey] + elseif MOVIE_PATHS[lowResKey] then + return MOVIE_PATHS[lowResKey] + end + -- Optional: return a specific "not found" key if neither is found, + -- or just nil and let the ( ... or "nil_path_..." ) handle it. + return nil + end + + + -- Zn calls now use the simpler GetMoviePath function. + -- Each movie has one entry, preferring 1024 resolution. + Zn(L["Movies"], L["Movies"], L["World of Warcraft"], { + "|cffffd800" .. L["Movies"] .. ": " .. L["World of Warcraft"], prefol, + L["WoW Cinematic Logo"] .. " |r" .. (GetMoviePath("WOW_LOGO_1024", "WOW_LOGO_800") or "nil_path_logo"), + L["World of Warcraft Intro"] .. " |r" .. (GetMoviePath("WOW_INTRO_1024", "WOW_INTRO_800") or "nil_path_wow_intro"), }) + Zn(L["Movies"], L["Movies"], L["The Burning Crusade"], { + "|cffffd800" .. L["Movies"] .. ": " .. L["The Burning Crusade"], prefol, + L["The Burning Crusade Intro"] .. " |r" .. (GetMoviePath("TBC_INTRO_1024", "TBC_INTRO_800") or "nil_path_tbc_intro"), + }) + + Zn(L["Movies"], L["Movies"], L["Wrath of the Lich King"], { + "|cffffd800" .. L["Movies"] .. ": " .. L["Wrath of the Lich King"], prefol, + L["Wrath of the Lich King Intro"] .. " |r" .. (GetMoviePath("WOTLK_INTRO_1024", "WOTLK_INTRO_800") or "nil_path_wotlk_intro"), + }) + + -- ... (rest of your database definitions for music, etc.) ---------------------------------------------------------------------- -- End ----------------------------------------------------------------------