Enhanced CreateContainer.cmd

Made command line case insensitive.
Added error handling incase use enters command option where stash port should be.
Change command option for creating image from PULL to IMAGE, and left PULL so as to be backward compatible.
This commit is contained in:
David Maisonave
2025-01-04 02:24:11 -05:00
parent 5f1f716c5b
commit f81fc6e32e
4 changed files with 88 additions and 31 deletions

View File

@@ -6,9 +6,10 @@
:: Example with shared mount paths: :: Example with shared mount paths:
:: CreateContainer.cmd ContainerName1 "stashapp/stash:latest" 9991 C:\MySharedMountPath C:\Another\Shared\Folder :: CreateContainer.cmd ContainerName1 "stashapp/stash:latest" 9991 C:\MySharedMountPath C:\Another\Shared\Folder
:: Example adding Stash IMAGE and container: :: Example adding Stash IMAGE and container:
:: CreateContainer.cmd v0.27.2 "stashapp/stash:v0.27.2" 9997 PULL :: CreateContainer.cmd NewContainer27.2 "stashapp/stash:v0.27.2" 9997 IMAGE
:: Note: The image name (stashapp/stash:v0.27.2) must be an image name listed in following link: https://hub.docker.com/r/stashapp/stash/tags
:: Example with DLNA: :: Example with DLNA:
:: CreateContainer.cmd v272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA :: CreateContainer.cmd MyDLNA272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA
:: Example skipping docker-compose: :: Example skipping docker-compose:
:: CreateContainer.cmd ContainerName "stashapp/stash:v0.26.2" 9992 C:\Videos SKIP :: CreateContainer.cmd ContainerName "stashapp/stash:v0.26.2" 9992 C:\Videos SKIP
set NewContainerName=%1 set NewContainerName=%1
@@ -29,29 +30,40 @@ set SkipDockerCompose=
set DLNAFunctionality="no" set DLNAFunctionality="no"
set PullDockerStashImage= set PullDockerStashImage=
set MountAccess=":ro" set MountAccess=":ro"
if [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=) if /I [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=)
if [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=) if /I [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=)
if [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=) if /I [%SharedMountPath%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=)
if [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=) if /I [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=)
if [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=) if /I [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=)
if [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=) if /I [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=)
if [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=) if /I [%SharedMountPath2%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath2=)
if [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=) if /I [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=)
if [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=) if /I [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=)
if [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=) if /I [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=)
if [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=) if /I [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=)
if [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=) if /I [%SharedMountPath3%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath3=)
if [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=) if /I [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=)
if [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=) if /I [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=)
if [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=) if /I [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=)
if [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=) if /I [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=)
if [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=) if /I [%SharedMountPath4%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath4=)
if [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=) if /I [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=)
if [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=) if /I [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=)
if [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes) if /I [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=)
if [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes) if /I [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=)
if [%VariableArg%]==[PULL] (set PullDockerStashImage=yes) if /I [%SharedMountPath5%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath5=)
if [%VariableArg%]==[WRITE] (set MountAccess=) if /I [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=)
if /I [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=)
if /I [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes)
if /I [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes)
if /I [%VariableArg%]==[IMAGE] (set PullDockerStashImage=yes)
if /I [%VariableArg%]==[PULL] (set PullDockerStashImage=yes)
if /I [%VariableArg%]==[WRITE] (set MountAccess=)
:: If user incorrectly enters below arguments instead of Stash-Port, fetch the values, and let CHECK_STASH_PORT get the required Stash-Port.
if /I [%STASH_PORT%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=)
if /I [%STASH_PORT%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=)
if /I [%STASH_PORT%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=)
if /I [%STASH_PORT%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=)
echo SkipDockerCompose = %SkipDockerCompose% ; DLNAFunctionality = %DLNAFunctionality% echo SkipDockerCompose = %SkipDockerCompose% ; DLNAFunctionality = %DLNAFunctionality%
set DockerComposeFile="docker-compose.yml" set DockerComposeFile="docker-compose.yml"
@@ -59,18 +71,28 @@ if [%NewContainerName%]==[] goto :MissingArgumentNewContainerName
goto :HaveVariableNewContainerName goto :HaveVariableNewContainerName
:MissingArgumentNewContainerName :MissingArgumentNewContainerName
set /p NewContainerName="Enter the new container name: " set /p NewContainerName="Enter the new container name: "
if [%NewContainerName%]==[] goto :eof
:HaveVariableNewContainerName :HaveVariableNewContainerName
if [%Image%]==[] goto :MissingArgumentImage if [%Image%]==[] goto :MissingArgumentImage
goto :HaveVariableImage goto :HaveVariableImage
:MissingArgumentImage :MissingArgumentImage
set /p Image="Enter the image name: " set /p Image="Enter the image name: "
if [%Image%]==[] goto :eof
:HaveVariableImage :HaveVariableImage
:CHECK_STASH_PORT
if [%STASH_PORT%]==[] goto :MissingArgumentSTASH_PORT if [%STASH_PORT%]==[] goto :MissingArgumentSTASH_PORT
IF 1%STASH_PORT% NEQ +1%STASH_PORT% goto STASH_PORT_NOT_NUMERIC
goto :HaveVariableSTASH_PORT goto :HaveVariableSTASH_PORT
:STASH_PORT_NOT_NUMERIC
echo Error ******************
echo Argument #3 requires a numeric value for Stash-Port. You entered "%STASH_PORT%" instead. Please enter a numberic value for Stash Port.
:MissingArgumentSTASH_PORT :MissingArgumentSTASH_PORT
set STASH_PORT=
set /p STASH_PORT="Enter the Stash port number: " set /p STASH_PORT="Enter the Stash port number: "
if [%STASH_PORT%]==[] Goto :eof
goto :CHECK_STASH_PORT
:HaveVariableSTASH_PORT :HaveVariableSTASH_PORT
if exist %NewContainerName%\ ( if exist %NewContainerName%\ (

View File

@@ -3,21 +3,27 @@ var OrgNextPage = null;
var OrgHomePage = null; var OrgHomePage = null;
var RemoveToKeepConfirmValue = null; var RemoveToKeepConfirmValue = null;
var RemoveValidatePromptValue = null; var RemoveValidatePromptValue = null;
var DisableReloadPageValue = null;
let thisUrl = "" + window.location; let thisUrl = "" + window.location;
const isAxterCom = (thisUrl.search("axter.com") > -1); const isAxterCom = (thisUrl.search("axter.com") > -1);
console.log("Cookies = " + document.cookie); console.log("Cookies = " + document.cookie);
const StrRemoveToKeepConfirm = "RemoveToKeepConfirm="; const StrRemoveToKeepConfirm = "RemoveToKeepConfirm=";
const StrRemoveValidatePrompt = "RemoveValidatePrompt="; const StrRemoveValidatePrompt = "RemoveValidatePrompt=";
const StrDisableReloadPage = "DisableReloadPage=";
function SetPaginateButtonChange(){ function SetPaginateButtonChange(){
var chkBxRemoveValid = document.getElementById("RemoveValidatePrompt"); var chkBxRemoveValid = document.getElementById("RemoveValidatePrompt");
var chkBxDisableDeleteConfirm = document.getElementById("RemoveToKeepConfirm"); var chkBxDisableDeleteConfirm = document.getElementById("RemoveToKeepConfirm");
var chkBxDisableReloadPage = document.getElementById("DisableReloadPage");
RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false"; RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false";
RemoveValidatePromptValue = StrRemoveValidatePrompt + "false"; RemoveValidatePromptValue = StrRemoveValidatePrompt + "false";
DisableReloadPageValue = StrDisableReloadPage + "false";
if (chkBxRemoveValid.checked) if (chkBxRemoveValid.checked)
RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "true"; RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "true";
if (chkBxDisableDeleteConfirm.checked) if (chkBxDisableDeleteConfirm.checked)
RemoveValidatePromptValue = StrRemoveValidatePrompt + "true"; RemoveValidatePromptValue = StrRemoveValidatePrompt + "true";
document.cookie = RemoveToKeepConfirmValue + "&" + RemoveValidatePromptValue + "; SameSite=None; Secure"; if (chkBxDisableReloadPage != null && chkBxDisableReloadPage.checked)
DisableReloadPageValue = StrDisableReloadPage + "true";
document.cookie = RemoveToKeepConfirmValue + "&" + RemoveValidatePromptValue + "&" + DisableReloadPageValue + "; SameSite=None; Secure";
console.log("Cookies = " + document.cookie); console.log("Cookies = " + document.cookie);
} }
function trim(str, ch) { function trim(str, ch) {
@@ -48,9 +54,11 @@ function RunPluginOperation(Mode, ActionID, button, asyncAjax){ // Mode=Value an
$('html').removeClass('wait'); $('html').removeClass('wait');
$("body").css("cursor", "default"); $("body").css("cursor", "default");
} }
if (Mode.startsWith("copyScene") || Mode.startsWith("renameFile") || Mode === "clearAllSceneFlags" || Mode.startsWith("clearFlag") || Mode.startsWith("mergeScene") || Mode.startsWith("mergeTags") || (Mode !== "deleteScene" && Mode.startsWith("deleteScene"))) if (Mode.startsWith("copyScene") || Mode.startsWith("renameFile") || Mode === "clearAllSceneFlags" || Mode.startsWith("clearFlag") || Mode.startsWith("mergeScene") || Mode.startsWith("mergeTags") || (Mode !== "deleteScene" && Mode.startsWith("deleteScene"))){
window.location.reload(); const chkBxDisableReloadPage = document.getElementById("DisableReloadPage");
else if (!chkBxRemoveValid.checked && Mode !== "flagScene") alert("Action " + Mode + " for scene(s) ID# " + ActionID + " complete.\\n\\nResults=" + result); if (chkBxDisableReloadPage == null || !chkBxDisableReloadPage.checked)
window.location.reload();
} else if (!chkBxRemoveValid.checked && Mode !== "flagScene") alert("Action " + Mode + " for scene(s) ID# " + ActionID + " complete.\\n\\nResults=" + result);
}, error: function(XMLHttpRequest, textStatus, errorThrown) { }, error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Ajax failed with Status: " + textStatus + "; Error: " + errorThrown); console.log("Ajax failed with Status: " + textStatus + "; Error: " + errorThrown);
if (asyncAjax){ if (asyncAjax){
@@ -118,6 +126,8 @@ $(document).ready(function(){
console.log("urlParams = " + urlParams); console.log("urlParams = " + urlParams);
RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false"; RemoveToKeepConfirmValue = StrRemoveToKeepConfirm + "false";
RemoveValidatePromptValue = StrRemoveValidatePrompt + "false"; RemoveValidatePromptValue = StrRemoveValidatePrompt + "false";
DisableReloadPageValue = StrDisableReloadPage + "false";
const chkBxDisableReloadPage = document.getElementById("DisableReloadPage");
var FetchCookies = true; var FetchCookies = true;
if (urlParams.get('RemoveToKeepConfirm') != null && urlParams.get('RemoveToKeepConfirm') !== ""){ if (urlParams.get('RemoveToKeepConfirm') != null && urlParams.get('RemoveToKeepConfirm') !== ""){
FetchCookies = false; FetchCookies = false;
@@ -136,6 +146,15 @@ $(document).ready(function(){
else else
$( "#RemoveValidatePrompt" ).prop("checked", false); $( "#RemoveValidatePrompt" ).prop("checked", false);
} }
if (chkBxDisableReloadPage != null && urlParams.get('DisableReloadPage') != null && urlParams.get('DisableReloadPage') !== ""){
FetchCookies = false;
DisableReloadPageValue = StrDisableReloadPage + urlParams.get('DisableReloadPage');
console.log("DisableReloadPageValue = " + DisableReloadPageValue);
if (urlParams.get('DisableReloadPage') === "true")
$( "#DisableReloadPage" ).prop("checked", true);
else
$( "#DisableReloadPage" ).prop("checked", false);
}
if (FetchCookies){ if (FetchCookies){
console.log("Cookies = " + document.cookie); console.log("Cookies = " + document.cookie);
var cookies = document.cookie; var cookies = document.cookie;
@@ -157,6 +176,15 @@ $(document).ready(function(){
else else
$( "#RemoveValidatePrompt" ).prop("checked", false); $( "#RemoveValidatePrompt" ).prop("checked", false);
} }
if (chkBxDisableReloadPage != null && cookies.indexOf(StrDisableReloadPage) > -1){
var idx = cookies.indexOf(StrDisableReloadPage) + StrDisableReloadPage.length;
var s = cookies.substring(idx);
console.log("StrDisableReloadPage Cookie = " + s);
if (s.startsWith("true"))
$( "#DisableReloadPage" ).prop("checked", true);
else
$( "#DisableReloadPage" ).prop("checked", false);
}
} }
SetPaginateButtonChange(); SetPaginateButtonChange();
function ProcessClick(This_){ function ProcessClick(This_){
@@ -254,4 +282,7 @@ $(document).ready(function(){
$("#RemoveToKeepConfirm").change(function() { $("#RemoveToKeepConfirm").change(function() {
SetPaginateButtonChange(); SetPaginateButtonChange();
}); });
$("#DisableReloadPage").change(function() {
SetPaginateButtonChange();
});
}); });

View File

@@ -120,8 +120,11 @@ var GraphQl_URL = "http://localhost:9999/graphql";
</div> </div>
</div> </div>
</td> </td>
<td><input type="checkbox" id="RemoveValidatePrompt" name="RemoveValidatePrompt"><label for="RemoveValidatePrompt" title="Disable notice for task completion (Popup).">Disable Complete Confirmation</label><br></td> <td>
<td><input type="checkbox" id="RemoveToKeepConfirm" name="RemoveToKeepConfirm"><label for="RemoveToKeepConfirm" title="Disable confirmation prompts for delete scenes">Disable Delete Confirmation</label><br></td> <input type="checkbox" id="RemoveValidatePrompt" name="RemoveValidatePrompt"><label for="RemoveValidatePrompt" title="Disable notice for task completion (Popup).">Disable Complete Confirmation</label>
<input type="checkbox" id="RemoveToKeepConfirm" name="RemoveToKeepConfirm"><label for="RemoveToKeepConfirm" title="Disable confirmation prompts for delete scenes">Disable Delete Confirmation</label>
</td>
<td><input type="checkbox" id="DisableReloadPage" name="DisableReloadPage"><label for="DisableReloadPage" title="Disable reloading/updating page when making single scene changes.">Disable Updating Page</label><br></td>
</tr></table></td> </tr></table></td>
</tr></table></center> </tr></table></center>

View File

@@ -134,6 +134,7 @@ Users can setup a private or alternate remote site by changing variables **remot
### Future Planned Features, Changes, or Fixes ### Future Planned Features, Changes, or Fixes
- Scheduled Changes - Scheduled Changes
- Add option to report to avoid reloading page after updating report. Planned for 1.2.0 Version. - Add option to report to avoid reloading page after updating report. Planned for 1.2.0 Version.
- After deleting scene from report, disable preview for the deleted scene on the report. Planned for 1.2.0 Version.
- Remove [Max Dup Process] from the Stash->Plugins GUI. This option already exist in advance menu. Planned for 1.2.0 Version. - Remove [Max Dup Process] from the Stash->Plugins GUI. This option already exist in advance menu. Planned for 1.2.0 Version.
- Add chat icon to report which on hover, displays a popup window showing scene details content. Planned for 1.2.0 Version. - Add chat icon to report which on hover, displays a popup window showing scene details content. Planned for 1.2.0 Version.
- Add image icon to report; on hover show scene cover image. Planned for 1.2.0 Version. - Add image icon to report; on hover show scene cover image. Planned for 1.2.0 Version.