Browse Source

Initial Commit

Signed-off-by: ewft <bnj@ewft.org>
ewft 3 years ago
commit
b3c2632d0e
26 changed files with 1045 additions and 0 deletions
  1. BIN
      build/ewft.menu.txz
  2. BIN
      build/ewft.minidlna.txz
  3. BIN
      build/minidlna-1.3.0_static.txz
  4. 100 0
      ewft.minidlna.plg
  5. 97 0
      minidlna.conf
  6. 5 0
      usr/local/emhttp/plugins/ewft.menu/EWFT.page
  7. BIN
      usr/local/emhttp/plugins/ewft.menu/icons/ewftplugins.png
  8. 5 0
      usr/local/emhttp/plugins/ewft.minidlna/README.md
  9. 8 0
      usr/local/emhttp/plugins/ewft.minidlna/event/started
  10. 2 0
      usr/local/emhttp/plugins/ewft.minidlna/event/unmounting_disks
  11. 8 0
      usr/local/emhttp/plugins/ewft.minidlna/ewft.minidlna.page
  12. BIN
      usr/local/emhttp/plugins/ewft.minidlna/ewft.minidlna.png
  13. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/correct.png
  14. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/depends.png
  15. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/device_status.png
  16. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/ewft.minidlna.png
  17. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/information.png
  18. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/loader.gif
  19. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/minidlna.png
  20. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/new_config.png
  21. BIN
      usr/local/emhttp/plugins/ewft.minidlna/icons/warning.png
  22. 247 0
      usr/local/emhttp/plugins/ewft.minidlna/include/ewft.minidlna.php
  23. 1 0
      usr/local/emhttp/plugins/ewft.minidlna/scripts/jquery.min.js
  24. 259 0
      usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna
  25. 3 0
      usr/local/emhttp/plugins/ewft.minidlna/scripts/tail_log
  26. 310 0
      usr/local/emhttp/plugins/ewft.minidlna/styles/ewft.minidlna.css

BIN
build/ewft.menu.txz


BIN
build/ewft.minidlna.txz


BIN
build/minidlna-1.3.0_static.txz


+ 100 - 0
ewft.minidlna.plg

@@ -0,0 +1,100 @@
+<?xml version='1.0' standalone='yes'?>
+
+<!DOCTYPE PLUGIN [
+<!ENTITY name      "ewft.minidlna">
+<!ENTITY author    "EWFT">
+<!ENTITY version   "2021.01.17a">
+<!ENTITY launch    "Settings/ewft.minidlna">
+<!ENTITY pluginURL "https://git.ewft.org/Unraid/ewft.minidlna/raw/master/ewft.minidlna.plg">
+<!ENTITY pkgURL    "https://git.ewft.org/Unraid/ewft.minidlna/raw/master/build/">
+<!ENTITY minidlnapkg    "minidlna-1.3.0_static">
+<!ENTITY minidlnaMD5       "338b106e1dd12d994be41d6815050ba5">
+<!ENTITY plginpkg  "ewft.minidlna">
+<!ENTITY plginMD5       "dfae62c8ea5675f5850a64113d6d1acf">
+<!ENTITY menupkg  "ewft.menu">
+<!ENTITY menupkgMD5       "56c7a49d0c1b6355b7ff99560d4a5b1e">
+<!ENTITY pluginLoc "/boot/config/plugins/&name;">
+]>
+
+<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.4.0">
+
+<CHANGES>
+##&name;
+
+###&version;
+
+###2021.01.17
+- Initial release
+
+</CHANGES>
+
+<!-- PRE-INSTALL SCRIPT -->
+<FILE Run="/bin/bash">
+<INLINE>
+</INLINE>
+</FILE>
+
+<!-- SOURCE PACKAGE -->
+<FILE Name="&pluginLoc;/&minidlnapkg;.txz" Run="upgradepkg --install-new --reinstall">
+<URL>&pkgURL;&minidlnapkg;.txz</URL>
+<MD5>&minidlnaMD5;</MD5>
+</FILE>
+
+<FILE Name="&pluginLoc;/&plginpkg;.txz" Run="upgradepkg --install-new --reinstall">
+<URL> &pkgURL;&plginpkg;.txz</URL>
+<MD5>&plginMD5;</MD5>
+</FILE>
+
+<FILE Name="&pluginLoc;/&menupkg;.txz" Run="upgradepkg --install-new --reinstall">
+<URL> &pkgURL;&menupkg;.txz</URL>
+<MD5>&menupkgMD5;</MD5>
+</FILE>
+
+<FILE Name="&pluginLoc;/minidlna.conf" >
+<URL>https://git.ewft.org/Unraid/ewft.minidlna/raw/master/minidlna.conf</URL>
+</FILE>
+
+<FILE Name="/boot/config/plugins/&name;/&name;.cfg">
+<INLINE>
+<![CDATA[
+# EWFT MiniDLNA
+SERVICE="enable"
+]]>
+</INLINE>
+</FILE>
+
+<!-- POST-INSTALL SCRIPT -->
+<FILE Run="/bin/bash">
+<INLINE>
+
+cp /boot/config/plugins/&name;/minidlna.conf /etc/
+
+[ -e "/etc/rc.d/rc.ewft.minidlna" ] &amp;&amp; rm -f "/etc/rc.d/rc.ewft.minidlna"
+ln -s "/usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna" "/etc/rc.d/rc.ewft.minidlna"
+
+
+echo ""
+echo "-----------------------------------------------------------"
+echo " Plugin &name; is installed."
+echo " Version: &version;"
+echo "-----------------------------------------------------------"
+echo ""
+</INLINE>
+</FILE>
+
+<!-- REMOVE SCRIPT -->
+<FILE Run="/bin/bash" Method="remove">
+<INLINE>
+# Remove plugin related files
+rm -rf /etc/minidlna.conf
+rm -f "/etc/rc.d/rc.ewft.minidlna"
+
+
+# Uninstall the 'source' package
+removepkg minidlna-1.3.0_static
+removepkg ewft.minidlna
+removepkg ewft.menu
+</INLINE>
+</FILE>
+
+</PLUGIN>

+ 97 - 0
minidlna.conf

@@ -0,0 +1,97 @@
+# port for HTTP (descriptions, SOAP, media transfer) traffic
+port=8200
+
+# network interfaces to serve, comma delimited (8 interfaces max)
+#network_interface=eth0
+
+# specify the user account name or uid to run as
+#user=jmaggard
+
+# set this to the directory you want scanned.
+# * if you want multiple directories, you can have multiple media_dir= lines
+# * if you want to restrict a media_dir to specific content types, you
+#   can prepend the types, followed by a comma, to the directory:
+#   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)
+#   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)
+#   + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
+#   + "PV" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)
+media_dir=A,/mnt/user/Music
+
+# set this to merge all media_dir base contents into the root container
+# note: the default is no
+#merge_media_dirs=no
+
+# set this if you want to customize the name that shows up on your clients
+friendly_name=Dedale DLNA
+
+# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
+db_dir=/mnt/user/.cache/minidlna
+
+# set this if you would like to specify the directory where you want MiniDLNA to store its log file
+log_dir=/var/log/minidlna
+
+# set this to change the verbosity of the information that is logged
+# each section can use a different level: off, fatal, error, warn, info, or debug
+#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
+
+# this should be a list of file names to check for when searching for album art
+# note: names should be delimited with a forward slash ("/")
+album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
+
+# set this to no to disable inotify monitoring to automatically discover new files
+# note: the default is yes
+inotify=yes
+
+# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO
+enable_tivo=no
+
+# set this to beacon to use legacy broadcast discovery method
+# defauts to bonjour if avahi is available
+tivo_discovery=bonjour
+
+# set this to strictly adhere to DLNA standards.
+# * This will allow server-side downscaling of very large JPEG images,
+#   which may hurt JPEG serving performance on (at least) Sony DLNA products.
+strict_dlna=no
+
+# default presentation url is http address on port 80
+#presentation_url=http://www.mylan/index.php
+
+# notify interval in seconds. default is 895 seconds.
+notify_interval=900
+
+# serial and model number the daemon will report to clients
+# in its XML description
+serial=12345678
+model_number=1
+
+# specify the path to the MiniSSDPd socket
+#minissdpdsocket=/var/run/minissdpd.sock
+
+# use different container as root of the tree
+# possible values:
+#   + "." - use standard container (this is the default)
+#   + "B" - "Browse Directory"
+#   + "M" - "Music"
+#   + "V" - "Video"
+#   + "P" - "Pictures"
+#   + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists)
+# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
+root_container=M
+
+# always force SortCriteria to this value, regardless of the SortCriteria passed by the client
+# note: you can prepend the sort criteria with "!" to alter the titles of the objects so that they
+# will be alphanumerically sorted in the order you specify here, to work around clients that do their
+# own alphanumeric sorting.
+#force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title
+
+# maximum number of simultaneous connections
+# note: many clients open several simultaneous connections while streaming
+#max_connections=50
+
+# set this to yes to allow symlinks that point outside user-defined media_dirs.
+#wide_links=no
+
+# enable subtitle support by default on unknown clients.
+# note: the default is yes
+#enable_subtitles=yes

+ 5 - 0
usr/local/emhttp/plugins/ewft.menu/EWFT.page

@@ -0,0 +1,5 @@
+Author="Ben"
+Version="1.0"
+Title="EWFT Plugins"
+Menu="Settings"
+Type="menu"

BIN
usr/local/emhttp/plugins/ewft.menu/icons/ewftplugins.png


+ 5 - 0
usr/local/emhttp/plugins/ewft.minidlna/README.md

@@ -0,0 +1,5 @@
+**MiniDLNA**
+
+ReadyMedia (formerly known as MiniDLNA) is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients. It was originally developed by a NETGEAR employee for the ReadyNAS product line.
+
+It is not in any way endorsed by the Digital Living Network Alliance®.

+ 8 - 0
usr/local/emhttp/plugins/ewft.minidlna/event/started

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+source /boot/config/plugins/ewft.minidlna/ewft.minidlna.cfg
+
+# If service is set to enable, start the application
+if [ "$SERVICE" = "enable" ]; then
+	/usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna start
+fi

+ 2 - 0
usr/local/emhttp/plugins/ewft.minidlna/event/unmounting_disks

@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna stop

+ 8 - 0
usr/local/emhttp/plugins/ewft.minidlna/ewft.minidlna.page

@@ -0,0 +1,8 @@
+Menu="EWFT"
+Icon="ewft.minidlna.png"
+Author="Ben"
+Type="php"
+Title="MiniDLNA"
+---
+<?php include '/usr/local/emhttp/plugins/ewft.minidlna/styles/ewft.minidlna.css';?>
+<?php include '/usr/local/emhttp/plugins/ewft.minidlna/include/ewft.minidlna.php';?>

BIN
usr/local/emhttp/plugins/ewft.minidlna/ewft.minidlna.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/correct.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/depends.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/device_status.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/ewft.minidlna.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/information.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/loader.gif


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/minidlna.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/new_config.png


BIN
usr/local/emhttp/plugins/ewft.minidlna/icons/warning.png


+ 247 - 0
usr/local/emhttp/plugins/ewft.minidlna/include/ewft.minidlna.php

@@ -0,0 +1,247 @@
+<?PHP
+# Setup page variables
+$appname="ewft.minidlna";
+$displayname="MiniDLNA";
+$appexecutable="usr/sbin/minidlnad";
+$appconfigfile="settings.json";
+$plglogfile="/var/log/minidlnad/{$appname}.log";
+$arrayState=trim(shell_exec( "grep fsState /var/local/emhttp/var.ini | sed -n 's!fsState=\"\(.*\)\"!\\1!p'" ));
+$ver60check=trim(shell_exec( "grep version /etc/unraid-version | sed -n 's!version=\"\(.*\)\"!\\1!p'" ));
+
+
+# Sets the loader background to match the theme based on unRaid version sicne 6 has a dark theme
+$machine_type = trim(shell_exec( "uname -m" ));
+if ($machine_type == "x86_64") {
+	$loaderbgcolor = "html";
+	$prefix = "";
+	if (substr($ver60check, 0, 3) === "6.0") {
+		$prefix = "/usr/local/emhttp";
+	}
+} else {
+	$loaderbgcolor = ".Container";
+	$prefix = "/usr/local/emhttp";
+}
+?>
+
+<!-- ========================================================================= -->
+<!-- Page load animation and text -->
+<!-- ========================================================================= -->
+
+<!-- # Add jquery library, show loader, fade out when loaded -->
+<script type="text/javascript">
+	if(typeof jQuery == 'undefined'){
+		var oScriptElem = document.createElement("script");
+		oScriptElem.type = "text/javascript";
+		oScriptElem.src = "/plugins/<?=$appname;?>/scripts/jquery.min.js";
+		document.head.insertBefore(oScriptElem, document.getElementsByTagName("script")[0])
+    }
+</script>
+<div id="loading">
+	<img id="loading-image" src='/plugins/<?=$appname;?>/icons/loader.gif' alt="Loading..." />
+	<p id="loading-text">LOADING PLUGIN</p>
+</div>
+<script language="javascript" type="text/javascript">
+	$("#loading").css("background-color",$("<?=$loaderbgcolor;?>").css("background-color"));
+	$("#loading").show();
+</script>
+<script language="javascript" type="text/javascript">
+	$(window).load(function() {$("#loading").fadeOut("slow");});
+</script>
+
+<!-- ========================================================================= -->
+<!-- Load current config file and check if program is installed already -->
+<!-- ========================================================================= -->
+
+<?PHP
+
+# This will clean any ^M characters caused by windows from the config file before use
+if (file_exists("/boot/config/plugins/{$appname}/{$appname}.cfg"))
+	shell_exec("sed -i 's!\r!!g' \"/boot/config/plugins/{$appname}/{$appname}.cfg\"");
+if (file_exists("/usr/local/emhttp/plugins/{$appname}/scripts/rc.{$appname}"))
+	shell_exec("sed -i 's!\r!!g' \"/usr/local/emhttp/plugins/{$appname}/scripts/rc.{$appname}\"");
+
+# Check existence of files and make startfile if missing
+$app_cfg = parse_ini_file( "/boot/config/plugins/{$appname}/{$appname}.cfg" );
+$app_installed = file_exists("/{$appexecutable}" ) ? "yes" : "no";
+
+
+
+# =========================================================================
+## Collect local variables from config files and verify data as best as possible
+# =========================================================================
+
+
+
+# Set readonly status if array is offline
+if ($arrayState == "Started") {
+	$app_readonly = "";
+	$app_disabled = "";
+} else {
+	$app_readonly = 'readonly="readonly"';
+	$app_disabled = 'disabled="disabled"';
+}
+
+# Plugin Current Version Variable
+if (file_exists("/boot/config/plugins/{$appname}.plg")) {
+	$app_plgver = trim(shell_exec ( "grep 'ENTITY version' /boot/config/plugins/{$appname}.plg | sed -n 's!.*\s\"\(.*\)\".*!\\1!p'" ));
+	if ($app_plgver == "") {
+		$app_plgver = "Unknown plugin version";
+	}
+} else {
+	$app_plgver = "(Plugin File Missing)";
+}
+
+
+
+# Service Status Variable
+if (isset($app_cfg['SERVICE']) && ($app_cfg['SERVICE'] == "enable" || $app_cfg['SERVICE'] == "disable"))
+	$app_service = $app_cfg['SERVICE'];
+else
+	$app_service = "disable";
+
+
+
+# =========================================================================
+## Check is program is installed and running to get extra information
+# =========================================================================
+
+# Get current installed version of the program
+if ($arrayState=="Started") {
+	$app_curversion = trim(shell_exec ( "/usr/local/emhttp/plugins/{$appname}/scripts/rc.{$appname} currentversion" ));
+	if ($app_curversion == "")
+		$app_curversion = "UNKNOWN";
+}
+
+if ($app_installed=="yes" && $arrayState=="Started") {
+	$app_running = trim(shell_exec( "[ -f /proc/`cat /var/run/minidlna/minidlna.pid 2> /dev/null`/exe ] && echo 'yes' || echo 'no' 2> /dev/null" ));
+	if ($app_running == "yes")
+		$app_updatestatus = "Running";
+	else
+		$app_updatestatus = "Stopped";
+
+}
+
+echo "<script>document.getElementById('loading-text').innerHTML = \"DONE\";</script>";
+?>
+
+<!-- ========================================================================= -->
+<!-- Create the HTML code used to display the settings GUI -->
+<!-- ========================================================================= -->
+
+<div id="PANELALL"><div id="PANELLEFT">
+	<div class="TITLEBARLEFT title" id="title">
+		<span class="left"><img id="IMGICON" src="/plugins/<?=$appname;?>/icons/device_status.png">&#32;Status:
+			<?if ($app_installed=="yes" && $arrayState=="Started"):?>
+				<?if ($app_running=="yes"):?>
+					<span class="green"><b>RUNNING</b></span>
+				<?else:?>
+					<span class="red"><b>STOPPED</b></span>
+				<?endif;?>
+			<?else:?>
+				<span class="red"><b>NOT READY</b></span>
+			<?endif;?>  
+		</span>
+	</div>
+	<div id="DIVLEFT">
+		<div id="T50LM">
+			<?if ($arrayState == "Started"):?>
+				<p id="PLINE">Array State:<b><span class="green">ONLINE</span></b></p>
+				<?if ($app_curversion == "NOT INSTALLED" || $app_curversion == "UNKNOWN"):?>
+					<p id="PLINE">Installed Version:<b><span class="red"><?=$app_curversion;?></span></b></p>
+				<?else:?>
+					<p id="PLINE" class="longver">Installed Version:<b><span class="green" title="<?=$app_curversion;?>"><?=$app_curversion;?></span></b></p>
+				<?endif;?>
+			<?else:?>
+				<p id="PLINE">Array State:<b><span class="red">OFFLINE</span></b></p>
+			<?endif;?>
+		</div>
+		<?if ($app_installed=="yes"):?>
+			<?if ($app_running=="yes"):?>
+				<div id="T25RM">
+					<form name="app_stop" method="POST" action="/update.htm" target="progressFrame">
+						<input type="hidden" name="cmd" value="<?=$prefix;?>/plugins/ewft.minidlna/scripts/rc.ewft.minidlna"/>
+						<input type="hidden" name="arg1" value="stop"/>
+						<input <?=$app_disabled;?> type="submit" name="runCmd" id="STDSMBUTTONR" value="Stop"/>
+					</form>
+				</div>
+				<div id="T25LM">
+					<form name="app_restart" method="POST" action="/update.htm" target="progressFrame">
+						<input type="hidden" name="cmd" value="<?=$prefix;?>/plugins/ewft.minidlna/scripts/rc.ewft.minidlna"/>
+						<input type="hidden" name="arg1" value="restart"/>
+						<input <?=$app_disabled;?> type="submit" name="runCmd" id="STDSMBUTTONL" value="Restart"/>
+					</form>
+				</div>
+			<?else:?>
+				<div id="T50CM">
+					<form name="app_start" method="POST" action="/update.htm" target="progressFrame">
+						<input type="hidden" name="cmd" value="<?=$prefix;?>/plugins/ewft.minidlna/scripts/rc.ewft.minidlna"/>
+						<input type="hidden" name="arg1" value="start"/>
+						<input <?=$app_disabled;?> type="submit" name="runCmd" id="STDSMBUTTON" value="Start"/>
+					</form>
+				</div>
+			<?endif;?>
+		<?else:?>
+			<div id="T50CM">
+				<form name="app_install" method="POST" action="/update.htm" target="progressFrame">
+					<input type="hidden" name="cmd" value="<?=$prefix;?>/plugins/ewft.minidlna/scripts/rc.ewft.minidlna"/>
+					<input type="hidden" name="arg1" value="install"/>
+					<input <?=$app_disabled;?> type="submit" name="runCmd" id="STDSMBUTTON" value="Install"/>
+				</form>
+			</div>
+		<?endif;?>
+	</div>
+	<? if ($app_installed=="yes" && $arrayState=="Started"): ?>
+		<?if ($app_canupdate=="yes"):?>
+			<div id="DIVLEFT">
+				<div id="T50LM">
+					<p id="PLINE"></p>
+				</div>
+				<div id="T50CM">
+					<form name="app_updateapp" method="POST" action="/update.htm" target="progressFrame">
+						<input type="hidden" name="cmd" value="<?=$prefix;?>/plugins/ewft.minidlna/scripts/rc.ewft.minidlna"/>
+						<input type="hidden" name="arg1" value="update"/>
+						<input type="hidden" name="arg3" value="<?=$app_updatestatus;?>"/>
+						<input id="UPDATEBUTTON" type="submit" name="runCmd" value="Update <?=$displayname;?>"/>
+					</form>
+					<p id="VERSION" class="longver" title="<?=$app_newversion;?>"><b>New Version: <?=$app_newversion;?></b></p>
+				</div>
+			</div>
+		<?endif;?>
+	<? endif; ?>
+	<div class="TITLEBARLEFT title" id="title">
+		<span class="left"><img id="IMGICON" src="/plugins/<?=$appname;?>/icons/information.png">&#32;Information:</span>
+	</div>
+	<div id="DIVLEFT">
+		<div id="T50LM">
+			<p id="PLINE"><b>Plugin Version: <?=$app_plgver;?></b></p>
+		</div>
+	</div>
+	<div id="DIVLEFT">
+		<div id="T50LT">
+			<p id="PLINE"><a title="<?=$appname;?> Activity Log - <?=$plglogfile;?>" href="#" target="_blank" id="ACTIVITYLINK" onclick="openLog();return false;">View Activity Log</a></p>
+		</div>
+
+	</div>
+</div>
+
+<script type="text/javascript">
+
+function openLog() {
+	var machine_type = "<?=$machine_type;?>";
+	var title="<?=$appname;?> Activity Log";
+	if (machine_type == "x86_64") {
+		<?if (substr($ver60check, 0, 3) === "6.0"):?>
+			var url="/usr/bin/tail -n 42 -f <?=$plglogfile;?>";
+			openWindow( url, title,600,900);
+		<?else:?>
+			var url="<?=$prefix;?>/plugins/<?=$appname;?>/scripts/tail_log&arg1=<?=$appname;?>.log";
+			openWindow( url, title,600,900);
+		<?endif;?>
+	} else {
+		var url="/logging.htm?title=" + title + "&cmd=/usr/bin/tail -n 42 -f <?=$plglogfile;?>&forkCmd=Start";
+		openWindow( url, title.replace(/ /g, "_"),600,900);
+	}
+}
+
+</script>
+

File diff suppressed because it is too large
+ 1 - 0
usr/local/emhttp/plugins/ewft.minidlna/scripts/jquery.min.js


+ 259 - 0
usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna

@@ -0,0 +1,259 @@
+#!/bin/sh
+
+# Read our configuration file and set variables
+APPNAME="ewft.minidlna"
+DISPLAYNAME="MiniDLNA"
+PLGCONFFILE="/boot/config/plugins/ewft.minidlna/${APPNAME}.cfg"
+APPCONFFILE="settings.json"
+APPEXECUTABLE="/usr/sbin/minidlnad"
+PIDFILE="/var/run/minidlna/minidlna.pid"
+PLGLOGFILE="/var/log/minidlna/${APPNAME}.log"
+ARRAYSTATE=`grep fsState /var/local/emhttp/var.ini | sed -n 's!fsState="\(.*\)"!\1!p'`
+source "$PLGCONFFILE"
+
+# This needs to be near the top so the dependency common directory can be set
+app_check_cache() {
+	local COMMONVAR="false"
+	if [ -e "/mnt/cache" ] && [ -w "/mnt/cache" ]; then
+		local CDRIVE=$( stat -f -c '%T' "/mnt/cache" )
+		if [ "$CDRIVE" != "ramfs" ] && [ "$CDRIVE" != "tmpfs" ] && [ "$CDRIVE" != "proc" ] && [ "$CDRIVE" != "sysfs" ] && [ "$CDRIVE" != "msdos" ]; then
+			COMMONVAR="true"
+		fi
+	fi
+
+	echo "$COMMONVAR"
+}
+
+# Check for cache drive and make sure its an actual disk drive
+PHAZECOMMON="/usr/local/PhAzE-Common"
+COMMONCHECK=`app_check_cache`
+[ "$COMMONCHECK" == "true" ] && PHAZECOMMON="/mnt/cache/.PhAzE-Common"
+STARTFILE="$PHAZECOMMON/${APPNAME}/startcfg.sh"
+
+app_start() {
+	# Get array status and exit if not started
+	if [ "$ARRAYSTATE" != "Started" ]; then
+		app_logger "Starting $DISPLAYNAME..." info all
+		app_logger "Start failed: Array stopped " warn all
+		return
+	fi
+
+	# Set service to enabled
+	[ "$SERVICE" != "enable" ] && sed -i 's/disable/enable/' "$PLGCONFFILE"
+
+	# No-op if already running and install if not installed
+	local STATUS=`app_status`
+	if [ "$STATUS" == "RUNNING" ]; then
+		app_logger "Starting $DISPLAYNAME..." info all
+		app_logger "Start OK: Already running " info all
+		return
+	else
+		app_logger "Starting $DISPLAYNAME..." info all
+
+		# Create export file and check dependencies
+		# write_export_config
+		if [ "$EXPORTOK" == "no" ]; then
+			app_logger "Start failed: Unable to update export file " error all
+			return
+		fi
+	fi
+
+	# Make working directories and write the app config file
+	#app_make_dirs
+	#write_app_config
+
+	
+	# Start the app
+	sudo -H -u root /bin/bash -c 'nohup '$APPEXECUTABLE' > /dev/null 2>&1 &'
+
+	# Checks if the app started properly or not, giving it 10 seconds to create the PID file
+	local TIMER=0
+	while [ ! -e "$PIDFILE" ]; do
+		let TIMER=$TIMER+1
+		sleep 1
+		if [ $TIMER -gt 10 ]; then
+			app_logger "Start failed: No PID created " error all
+			sleep 3
+			return
+		fi
+	done
+
+	# Check if process specified in the PID is actually running, as a double check
+	TIMER=0
+	while [[ -e "$PIDFILE" && ! -f /proc/`cat "$PIDFILE" 2> /dev/null`/exe ]]; do
+		let TIMER=$TIMER+1
+		sleep 1
+		if [ $TIMER -gt 5 ]; then
+			app_logger "Start failed: PID created but no process exists " error all
+			sleep 3
+			return
+		fi
+	done
+
+	# Notify if start was successful or failed
+	app_logger "Start OK! " info all
+	sleep 1
+}
+
+app_stop() {
+	# No-op if already running
+	local STATUS=`app_status`
+	app_logger "Stopping $DISPLAYNAME..." info all
+	if [ "$STATUS" == "STOPPED" ]; then
+		app_logger "Stop OK: Already stopped " info all
+		sleep 1
+		return
+	fi
+
+	# Send the kill command to gracefully shutdown
+	kill $(cat "$PIDFILE" ) 2> /dev/null
+
+	# Begin a timer for shutdown, force kill process if not shut down by end of timer
+	let TIMER=0
+	while [ -e "$PIDFILE" ]; do
+		let TIMER=$TIMER+1
+		sleep 1
+
+		# Process has ended but PID file remains, so remove it
+		if [ ! -f /proc/`cat "$PIDFILE" 2> /dev/null`/exe ]; then
+			rm "$PIDFILE" 2> /dev/null
+		fi
+
+		if [ $TIMER -gt 30 ]; then
+			app_logger "Taking too long: Force killing process" warn log
+			kill -9 $(cat "$PIDFILE" ) 2> /dev/null
+			rm "$PIDFILE"
+			break
+		fi
+	done
+
+	app_logger "Stop OK! " info all
+	sleep 1
+}
+
+app_restart() {
+	app_stop
+	app_start
+}
+
+app_status() {
+	# Get running status
+	local STATUS=""
+	if [ ! -f "$APPEXECUTABLE" ]; then
+		STATUS="NOT INSTALLED"
+	elif [ -f "$PIDFILE" ] && [ -f /proc/`cat "$PIDFILE" 2> /dev/null`/exe ]; then
+		STATUS="RUNNING"
+	else
+		STATUS="STOPPED"
+
+		# Remove stale PID file that shouldn't exist anymore
+		[ -f "$PIDFILE" ] && rm -f "$PIDFILE"
+	fi
+
+	echo "$STATUS"
+}
+
+app_buttonstart() {
+	if [ -f "$PLGCONFFILE" ]; then
+		sync_app_config
+		app_start
+	else
+		app_logger "Start failed: Config file missing - Reinstall plugin " error all
+		sleep 3
+	fi
+}
+
+
+
+
+app_logger() {
+	# First passed item is the text ($1), secone item is severity ($2 - info, warn, error), third is where to log ($3 - all, log)
+	local LOGTEXT=$1
+	local LOGTYPE=$2
+	local LOGVAR=$3
+	local TIMESTAMP=`date +"%Y-%m-%d %T"`
+
+	# Set the type of log
+	if [ "$LOGTYPE" == "info" ]; then
+		TYPE="[INFO]"
+	elif [ "$LOGTYPE" == "warn" ]; then
+		TYPE="[WARNING]"
+	elif [ "$LOGTYPE" == "error" ]; then
+		TYPE="[ERROR]"
+	fi
+
+	# If log file doesn't exist, make it
+	if [ ! -f "$PLGLOGFILE" ]; then
+		mkdir -p "/var/log/minidlna"
+		touch "$PLGLOGFILE"
+	fi
+
+	# Echo the text to display and log, or just log file
+	if [ "$LOGVAR" == "all" ]; then
+		echo -e "${LOGTEXT}"
+		echo -e "${TIMESTAMP} ${TYPE}\t${LOGTEXT}" >> "$PLGLOGFILE"
+	elif [ "$LOGVAR" == "log" ]; then
+		echo -e "${TIMESTAMP} ${TYPE}\t${LOGTEXT}" >> "$PLGLOGFILE"
+	fi
+}
+
+app_enable() {
+	app_stop
+	SERVICE=enable
+	app_start
+}
+
+app_disable() {
+	app_stop
+	SERVICE=disable
+}
+
+app_curver() {
+	# This gets the current version installed
+	local CURVER=""
+	if [ "$ARRAYSTATE" == "Started" ]; then
+		[ -e "$APPEXECUTABLE" ] && CURVER=`sudo -H -u root /bin/bash -c ''$APPEXECUTABLE' -V 2>&1' | cut -f1 | awk '{print $2}'` || CURVER="NOT INSTALLED"
+	fi
+
+	echo "$CURVER"
+}
+
+case "$1" in
+	'start')
+		app_logger "*** Start Initiated ***" info log
+		[ "$2" == "force" ] && ARRAYSTATE="Started"
+		app_start
+	;;
+	'stop')
+		app_logger "*** Stop Initiated ***" info log
+		app_stop
+	;;
+	'restart')
+		app_logger "*** Restart Initiated ***" info log
+		app_restart
+	;;
+	'status')
+		app_status
+	;;
+	'currentversion')
+		app_curver
+	;;
+	'enable')
+		app_logger "*** Apply - Enable Initiated ***" info log
+		VAR="$2"
+		VAR=`echo "$VAR" | sed 's!@20! !g'`
+		VAR=`echo "$VAR" | sed 's!@@2200!@20!g'`
+		VARS=( $VAR )
+		app_enable ${VARS[0]} ${VARS[1]} ${VARS[2]} ${VARS[3]} ${VARS[4]} ${VARS[5]} ${VARS[6]} ${VARS[7]} ${VARS[8]} ${VARS[9]} ${VARS[10]} ${VARS[11]} ${VARS[12]} ${VARS[13]}
+	;;
+	'disable')
+		app_logger "*** Apply - Disable Initiated ***" info log
+		VAR="$2"
+		VAR=`echo "$VAR" | sed 's!@20! !g'`
+		VAR=`echo "$VAR" | sed 's!@@2200!@20!g'`
+		VARS=( $VAR )
+		app_disable ${VARS[0]} ${VARS[1]} ${VARS[2]} ${VARS[3]} ${VARS[4]} ${VARS[5]} ${VARS[6]} ${VARS[7]} ${VARS[8]} ${VARS[9]} ${VARS[10]} ${VARS[11]} ${VARS[12]} ${VARS[13]}
+	;;
+	*)
+	echo "usage $0 [start | stop | restart | status | install | update | updateplg | downgradeplg | removeplg | latestversion | currentversion]"
+esac

+ 3 - 0
usr/local/emhttp/plugins/ewft.minidlna/scripts/tail_log

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+exec /usr/bin/tail -n 42 -f "/var/log/minidlna/$1"

+ 310 - 0
usr/local/emhttp/plugins/ewft.minidlna/styles/ewft.minidlna.css

@@ -0,0 +1,310 @@
+<style type="text/css">
+.longver {
+	width: 235px;
+	min-width: 90%;
+	max-width: 290px;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	vertical-align: bottom;
+}
+#UPDATEBUTTON {
+	border-collapse: separate;
+	-moz-box-shadow:inset 0px 1px 0px 0px #dcecfb;
+	-webkit-box-shadow:inset 0px 1px 0px 0px #dcecfb;
+	box-shadow:inset 0px 1px 0px 0px #dcecfb;
+	background-color:#bddbfa;
+	background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#bddbfa), to(#80b5ea));
+	background-image: -moz-linear-gradient(#bddbfa, #80b5ea);
+	background-image: -o-linear-gradient(#bddbfa, #80b5ea);
+	background-image: linear-gradient(#bddbfa, #80b5ea);
+	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bddbfa', endColorstr='#80b5ea');
+	ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#bddbfa,EndColorStr=#80b5ea)";
+	text-indent:0;
+	border:1px solid #84bbf3;
+	display:inline-block;
+	color:#ffffff;
+	font-family:Arial;
+	font-size:15px;
+	font-weight:bold;
+	font-style:normal;
+	text-align:center;
+	text-shadow:1px 1px 0px #528ecc;
+	-webkit-transition: all 300ms ease-in;
+	-moz-transition: all 300ms ease-in;
+	-o-transition: all 300ms ease-in;
+	-ms-transition: all 300ms ease-in;
+	transition: all 300ms ease-in;
+	margin: auto;
+}
+#UPDATEBUTTON:hover {
+	border:1px solid #4fa1f4;
+	-moz-box-shadow:inset 0px 0px 8px 4px #67aef6;
+	-webkit-box-shadow:inset 0px 0px 8px 4px #67aef6;
+	box-shadow:inset 0px 0px 8px 4px #67aef6;
+	-webkit-transition: all 300ms ease-out;
+	-moz-transition: all 300ms ease-out;
+	-o-transition: all 300ms ease-out;
+	-ms-transition: all 300ms ease-out;
+	transition: all 300ms ease-out;
+}
+#UPDATEBUTTON:active {
+	border:1px solid #4fa1f4;
+	-moz-box-shadow:inset 0px 0px 8px 4px #67aef6;
+	-webkit-box-shadow:inset 0px 0px 8px 4px #67aef6;
+	box-shadow:inset 0px 0px 8px 4px #67aef6;
+	position:relative;
+	top:1px;
+	left:1px;
+}
+#UPDATEBUTTON.UPDATEBTN {
+	margin: 0px;
+	margin-top: 10px;
+}
+#UPDATEBUTTON.UIBUTTON {
+	display: inline-block;
+	font-size: 12px;
+	padding: 2px 7px 2px 7px;
+	border-radius: 5px;
+	line-height: 12px;
+	margin-top: -2px;
+	margin-right: -15px;
+}
+#STDSMBUTTON {
+	width: 60px;
+	margin: 0px;
+}
+#STDSMBUTTONR {
+	width: 60px;
+	margin: 0px;
+	margin-right: 5px;
+}
+#STDSMBUTTONL {
+	width: 60px;
+	margin: 0px;
+	margin-left: 5px;
+}
+#STDLGBUTTONR {
+	width: 110px;
+	margin: 0px;
+	margin-right: 5px;
+}
+#STDLGBUTTONL {
+	width: 110px;
+	margin: 0px;
+	margin-left: 5px;
+}
+#STDLGBUTTON {
+	width: 100px;
+	margin: 0px;
+}
+#VERSION {
+	display: inline-block;
+	margin-top: 5px;
+	margin-bottom: 5px;
+	text-align: center;
+}
+#TEXTLARGE {
+	width: 250px;
+}
+#TEXTSMALL {
+	width: 225px;
+}
+#TEXTUSER {
+	style="width: 165px"
+}
+#IMGICON {
+	margin-top: -2px;
+}
+#DIVIDER {
+	background-color: #FFFFFF;
+	border: 1px solid #000000;
+	height: 1px;
+	width: 100%;
+	font-size: 8px;
+}
+#ERRORPAD {
+	padding: 0px;
+}
+#ACTIVITYLINK {
+	color: inherit;
+}
+#BOTTOMPAD {
+	margin-bottom: 35px;
+}
+.green {
+	color: #33cc33;
+	padding-left: 5px;
+	padding-right: 5px;
+}
+.red {
+	color: #ff0000;
+	padding-left: 5px;
+	padding-right: 5px;
+}
+.orange {
+	color: #ff9900;
+	padding-left: 5px;
+	padding-right: 5px;
+}
+#PANELALL {
+	/* Not used in unRAID 6 */
+}
+#PANELLEFT {
+	float: left;
+	width: 50%;
+}
+#title.TITLEBARLEFT {
+	float: left;
+	width: 95%;
+	margin-top: 20px;
+	margin-bottom: 20px;
+	height: 18px;
+}
+#DIVLEFT {
+	float: left;
+	width: 100%;
+	display: table;
+}
+#T100LT {
+	width: 95%;
+	text-align: left;
+	vertical-align: top;
+	display: table-cell;
+	padding-bottom: 10px;
+}
+#T50LT {
+	width: 50%;
+	text-align: left;
+	vertical-align: top;
+	display: table-cell;
+}
+#T50LM {
+	width: 50%;
+	text-align: left;
+	vertical-align: middle;
+	display: table-cell;
+}
+#T50CM {
+	width: 50%;
+	text-align: center;
+	vertical-align: middle;
+	display: table-cell;
+}
+#T25RM {
+	width: 25%;
+	text-align: right;
+	vertical-align: middle;
+	display: table-cell;
+}
+#T25LM {
+	width: 25%;
+	text-align: left;
+	vertical-align: middle;
+	display: table-cell;
+}
+#PANELRIGHT {
+	float: right;
+	width: 50%;
+}
+#title.TITLEBARRIGHT {
+	float: right;
+	width: 95%;
+	margin-top: 20px;
+	margin-bottom: 20px;
+	height: 18px;
+}
+#DIVRIGHT {
+	float: right;
+	padding-right: 15px;
+	margin-left: 10px;
+	padding-top: 10px;
+	width: 95%;
+	display: table;
+}
+#PLINE {
+	margin: 5px;
+	margin-left: 10px;
+	text-align: left;
+}
+#FOOTER2 {
+	position: fixed;
+	font-size: 80%;
+	bottom: 25px;
+	right: 0px;
+	background-color: inherit;
+	padding-left: 5px;
+	padding-right: 5px;
+	z-index : 1;
+}
+.title {
+	vertical-align: middle;
+	margin: 20px 0 22px 0;
+	padding: 5px 10px;
+	-webkit-border-top-left-radius: 5px;
+	-webkit-border-top-right-radius: 5px;
+	-webkit-border-bottom-left-radius: 0;
+	-webkit-border-bottom-right-radius: 0;
+	-moz-border-radius-topleft: 5px;
+	-moz-border-radius-topright: 5px;
+	-moz-border-radius-bottomleft: 0;
+	-moz-border-radius-bottomright: 0;
+	border-top-left-radius: 5px;
+	border-top-right-radius: 5px;
+	border-bottom-left-radius: 0;
+	border-bottom-right-radius: 0;
+	border: 1px solid #E8E8E8;
+	border-bottom: 1px solid #C8C8C8;
+	background: #e6e6e6;
+	background: -moz-linear-gradient(top, #D0D0D0 0%, #C0C0C0 100%);
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#D0D0D0), color-stop(100%,#C0C0C0));
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D0D0D0', endColorstr='#C0C0C0', GradientType=0 );
+	clear: both;
+}
+#title span.left {
+	font-size: 14px;
+}
+#title span.right {
+	float: right;
+}
+#TABLESETTINGS {
+	width: 100%;
+	margin-left: 0px;
+}
+#TDSETTINGS {
+	text-align: left;
+	padding-left: 0px;
+}
+select {min-width: 0px;}
+.no-js #loading {display: none;}
+#loading {
+	display: none;
+	position: fixed;
+	left: 0px;
+	top: 190px;
+
+	width: 100%;
+	height: 100%;
+	z-index: 9999;
+}
+#loading-image {
+	position: absolute;
+	top: 20%;
+	left: 50%;
+	margin-top: -24px;
+	margin-left: -24px;
+	z-index: 10000;
+}
+#loading-text {
+	position: absolute;
+	top: 20%;
+	left: 50%;
+	margin-top: 40px;
+	margin-left: -150px;
+	padding: 0px;
+	width: 300px;
+	text-align: center;
+	background : none;
+	z-index: 10000;
+}
+</style>

Some files were not shown because too many files changed in this diff