<table cellpadding="0" cellspacing="0" class="BoxTable"> <tr><td class="BoxTable_td mediumlong"> <div id="MenuBar" class="headline"><a href='index.php'>Home</a></div> <div id="MenuBox"> <?php /** * Get the libraries that are in the database and present them to the user. */ echo "<div class='VideoBox'>"; echo "<div class='VideoHeadline'>Libraries</div>"; echo "<div class='VideoSubtitle'>"; echo "<table cellspacing=0 cellpadding=0 style='width: 100%'>"; if (!$SettingsVerification) { $xml = FetchXML('/library/sections'); foreach ($xml as $xmlrow) { $Section = $xmlrow->attributes(); if ($Debug) { USMLog("debug", "[" . __FILE__ . " Line:" . __LINE__ . "] Value in Section-variable: \n" . var_export($Section, true) . "\n"); } $LibraryName = $Section->title; if ($Section->key == $CurrentLibraryID) { $CurrentLibraryName = $Section->title; $LibraryName = "<b>" . $Section->title . "</b>"; } echo "<tr class='hovering'>"; echo "<td class='mainText'><a href='?libraryID=" . $Section->key . "&startLimit=0'>" . $LibraryName . "</a></td></tr>"; } } echo "</table>";
function CheckForDuplicates($CurrentVideo) { global $SearchSubtitleProviderFiles, $PathToPlexMediaFolder, $DevToolsSecret; //Check if there is duplicates according to .xml file in Subtitle Contributions. $ProviderXMLSubtitles = array(); foreach ($SearchSubtitleProviderFiles as $Provider) { $HashDirectory = substr($CurrentVideo->getHash(), 0, 1) . "/" . substr($CurrentVideo->getHash(), 1) . ".bundle/Contents/Subtitle Contributions/" . $Provider; if (exists($PathToPlexMediaFolder . $HashDirectory)) { $SubtitleProviderXML = FetchXML("/utils/devtools?Func=GetXMLFile&Secret=" . $DevToolsSecret . "&Path=" . $PathToPlexMediaFolder . $HashDirectory); foreach ($SubtitleProviderXML as $SubtitleProvider) { foreach ($SubtitleProvider->Subtitle as $Sub) { if (strlen((string) $Sub->attributes()->name) > 0) { $PositionOfSid = stripos((string) $Sub->attributes()->name, "/sid"); $InsertTo = count($ProviderXMLSubtitles); if ($PositionOfSid === false) { $ProviderXMLSubtitles[$InsertTo][0] = (string) $Sub->attributes()->name; } else { $name = substr((string) $Sub->attributes()->name, 0, $PositionOfSid); $ProviderXMLSubtitles[$InsertTo][0] = $name; } $ProviderXMLSubtitles[$InsertTo][1] = substr($Provider, 0, -4) . "_" . (string) $Sub->attributes()->media; } } } } } for ($i = 0; $i < count($ProviderXMLSubtitles); $i++) { for ($x = 0; $x < count($ProviderXMLSubtitles); $x++) { if ($i != $x) { if ($ProviderXMLSubtitles[$i][0] == $ProviderXMLSubtitles[$x][0]) { foreach ($CurrentVideo->getSubtitles() as $SubtitleLanguageArray) { foreach ($SubtitleLanguageArray as $Subtitle) { if ($ProviderXMLSubtitles[$i][1] == $Subtitle->getFilename()) { $Subtitle->setIsDouble(true); } } } } } } } }