diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad6ea99..30309a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Next +## Version 9.2.10 (2025-04-04) +* SD EPG changes to correct Error 6000, 4009 and some other login issues with SD + ## Version 9.2.9 (2025-03-11) * Updated gradle script so that project could build in Netbeans * Updated the FFMPEGTranscoder to fallback to frame count instead of time to calculate progress diff --git a/java/sage/EPG.java b/java/sage/EPG.java index a7b81aa7..d9a6dbaf 100644 --- a/java/sage/EPG.java +++ b/java/sage/EPG.java @@ -687,6 +687,9 @@ public void run() } } if(Sage.getBoolean("sdepg_core/bypassEPGUpdates", false)){ + if(minWait==0){ + minWait = MAINTENANCE_FREQ; //wait 24 hours to check again as the user disabled the updates + } if (Sage.DBG) System.out.println("SD EPG Updates are disabled by sdepg_core/bypassEPGUpdates setting. Check again in " + (minWait/60000) + " minutes"); if (minWait > 0) { diff --git a/java/sage/SageConstants.java b/java/sage/SageConstants.java index be9a36a3..064bdc9b 100644 --- a/java/sage/SageConstants.java +++ b/java/sage/SageConstants.java @@ -22,5 +22,5 @@ private SageConstants() // Non-instantiable } - public static final int BUILD_VERSION = 1056; + public static final int BUILD_VERSION = 1037; } diff --git a/java/sage/Version.java b/java/sage/Version.java index 74902244..6f8abe64 100644 --- a/java/sage/Version.java +++ b/java/sage/Version.java @@ -23,7 +23,7 @@ public class Version { public static final byte MAJOR_VERSION = 9; public static final byte MINOR_VERSION = 2; - public static final byte MICRO_VERSION = 9; + public static final byte MICRO_VERSION = 10; public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + MICRO_VERSION + "." + SageConstants.BUILD_VERSION; diff --git a/java/sage/epg/sd/SDRipper.java b/java/sage/epg/sd/SDRipper.java index 5a8c26d3..15061a32 100644 --- a/java/sage/epg/sd/SDRipper.java +++ b/java/sage/epg/sd/SDRipper.java @@ -81,8 +81,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import static sage.epg.sd.SDErrors.ACCOUNT_DISABLED; @@ -1775,7 +1773,7 @@ else if (chanDownloadComplete && prevChans.length == 1 && prevChans[0].equals("" break; } } - + // We have to do >= 500 programs because we could be anywhere from 500 to ~600. The // limit is 5000 and a typical request is a little over 500 combined between several // stations, so this should never be a problem. The most I have ever seen added for @@ -1820,9 +1818,17 @@ else if (chanDownloadComplete && prevChans.length == 1 && prevChans[0].equals("" String removeSeries = SDUtils.getSeriesForEpisode(extID); if (removeSeries != null) needSeriesDetails.remove(removeSeries); } + + if (programDetail.getCode() == 6000){ + if (Sage.DBG) System.out.println("SDEPG 6000 ERROR: skipping id:" + programDetail.getProgramID()); + // Ensure we don't try to create an airing for this program. + noProgramDetails.add(programDetail.getProgramID()); + continue; + } - if (schedule.getCode() != 0) + if (programDetail.getCode() != 0) { + if (Sage.DBG) System.out.println("SDEPG NON ZERO ERROR " + programDetail.getProgramID() + " Error code:" + programDetail.getCode()); // Ensure we don't try to create an airing for this program. noProgramDetails.add(programDetail.getProgramID()); continue; @@ -2565,6 +2571,9 @@ public void run() break; case TOO_MANY_LOGINS: sage.msg.MsgManager.postMessage(sage.msg.SystemMessage.createSDTooManyLoginsMsg()); + // Set this to an hour so we aren't too obnoxious about the authentication error messages + // and so we shouldn't accidentally lock the account out. + SDRipper.retryWait = Sage.time() + Sage.MILLIS_PER_HR; resetToken(); break; } @@ -3071,12 +3080,12 @@ private static void resetToken(){ } catch (SDException ex) { if (Sage.DBG) { - System.out.println("SDEPG invalid SD authentication - token reset so next call will get a new token"); + System.out.println("SDEPG SDException. Invalid SD authentication - token reset so next call will get a new token: " + ex.getMessage()); } } catch (IOException ex) { if (Sage.DBG) { - System.out.println("SDEPG invalid SD authentication - token reset so next call will get a new token"); + System.out.println("SDEPG IOException. Invalid SD authentication - token reset so next call will get a new token: " + ex.getMessage()); } } diff --git a/java/sage/epg/sd/SDSageSession.java b/java/sage/epg/sd/SDSageSession.java index 95069e07..b4ef941c 100644 --- a/java/sage/epg/sd/SDSageSession.java +++ b/java/sage/epg/sd/SDSageSession.java @@ -158,6 +158,13 @@ private InputStreamReader post(URL url, byte sendBytes[], int off, int len, bool // because another program is using the same account, so we try once to get the token back. if (retry && connection.getResponseCode() == 403) { + if (SDSession.debugEnabled()) + { + SDSession.writeDebugLine("POST response 403 received. Skipping retry."); + } + //2025-03-28 jusjoken remove the retry as it used to be needed for expired tokens but since we get + // a new token if expired then this just causes an infinite loop of 403 errors + /* token = null; if (SDSession.debugEnabled()) { @@ -179,6 +186,7 @@ private InputStreamReader post(URL url, byte sendBytes[], int off, int len, bool SDSession.writeDebugLine("POST retry after authenticate call. token = '" + token + "'"); } return post(url, sendBytes, off, len, false); + */ } // We can timeout just getting the InputStream. @@ -229,6 +237,13 @@ private InputStreamReader get(URL url, boolean retry) throws IOException, SDExce // because another program is using the same account, so we try once to get the token back. if (retry && connection.getResponseCode() == 403) { + if (SDSession.debugEnabled()) + { + SDSession.writeDebugLine("GET response 403 received. Skipping retry."); + } + //2025-03-28 jusjoken remove the retry as it used to be needed for expired tokens but since we get + // a new token if expired then this just causes an infinite loop of 403 errors + /* token = null; if (SDSession.debugEnabled()) { @@ -250,6 +265,7 @@ private InputStreamReader get(URL url, boolean retry) throws IOException, SDExce SDSession.writeDebugLine("GET retry after authenticate call. token = '" + token + "'"); } return get(url, false); + */ } try diff --git a/java/sage/epg/sd/SDUtils.java b/java/sage/epg/sd/SDUtils.java index 843cab55..82fda5a1 100644 --- a/java/sage/epg/sd/SDUtils.java +++ b/java/sage/epg/sd/SDUtils.java @@ -113,10 +113,13 @@ else if (errorPresent403){ if (SDSession.debugEnabled()) { SDSession.writeDebugLine("HTTP 403 received. Processing"); - SDSession.writeDebugLine("HTTP 403 Disabling debug_sd_support. Process will restart"); if(Sage.getBoolean("debug_sd_support", false)){ + SDSession.writeDebugLine("HTTP 403 Disabling debug_sd_support. Process will restart"); Sage.putBoolean("debug_sd_support", false); - } + } + } + if(Sage.getBoolean("debug_sd_support", false)){ + Sage.putBoolean("debug_sd_support", false); } //stop processing @@ -169,6 +172,23 @@ else if (errorPresent403){ { JsonElement codeElement = ((JsonObject) errorElement).get("code"); int code = codeElement != null ? codeElement.getAsInt() : -1; + + if (code==2055){ + if (SDSession.debugEnabled()) + { + SDSession.writeDebugLine("HTTP 400 received with ERROR 2055. Disabling debug_sd_support. Process will restart"); + } + if(Sage.getBoolean("debug_sd_support", false)){ + Sage.putBoolean("debug_sd_support", false); + } + }else if (code==4009){ + if (SDSession.debugEnabled()) + { + SDSession.writeDebugLine("HTTP 400 received with ERROR 4009. Process will restart"); + //NEED TO ADD A WAIT + + } + } SDErrors.throwErrorForCode(code); }