-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
599 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ tmpcache | |
main-packr.go | ||
a_main-packr.go | ||
packrd | ||
mediaweb | ||
mediaweb.exe | ||
mediaweb.log | ||
mediaweb_windows_x64_setup.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[{000214A0-0000-0000-C000-000000000046}] | ||
Prop3=19,2 | ||
[InternetShortcut] | ||
IDList= | ||
URL=http://localhost:9834/ | ||
IconIndex=0 | ||
HotKey=0 | ||
IconFile=C:\Users\Joel\Go\src\github.com\midstar\mediaweb\testmedia\logo.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
####################################################### | ||
# This is a configuration file for mediaweb | ||
####################################################### | ||
|
||
# Server network port. | ||
# This parameter is MANDATORY | ||
port = 9834 | ||
|
||
# Media path, i.e. where is your media located | ||
# This parameter is MANADTORY | ||
# | ||
# For example: | ||
# mediapath = /home/fobar/pictures | ||
# mediapath = c:\users\fobar\pictures | ||
mediapath = pictures | ||
|
||
# Thumb cache path is by default your operating systems | ||
# temp folder + mediaweb. Uncomment below to set to | ||
# another location. Not used if enablethumbcache = off. | ||
# thumbpath = tmpcache | ||
|
||
# Thumb cache is by default on. Uncomment below to | ||
# disable thumb cache | ||
#enablethumbcache = off | ||
|
||
# Auto rotate of JPEG is by default on. Uncomment below | ||
# to disable auto rotate of JPEG. | ||
#autorotate = off | ||
|
||
# Logging is by default output on stderr. | ||
logfile = mediaweb.log | ||
|
||
# Logging level is by default info. Available levels | ||
# are trace, debug, info, warn, error and panic. | ||
#loglevel = trace | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Main method for Linux systems | ||
package main | ||
|
||
func main() { | ||
webAPI := mainCommon() | ||
httpServerDone := webAPI.Start() | ||
<-httpServerDone // Block until http server is done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Main method for Windows systems | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/kardianos/service" | ||
) | ||
|
||
var logger service.Logger | ||
|
||
type program struct { | ||
webAPI *WebAPI | ||
workingDir string | ||
} | ||
|
||
func (p *program) Start(s service.Service) error { | ||
// Start should not block. Do the actual work async. | ||
if p.workingDir != "" { | ||
os.Chdir(p.workingDir) | ||
} | ||
p.webAPI = mainCommon() | ||
go p.run() | ||
return nil | ||
} | ||
func (p *program) run() { | ||
p.webAPI.Start() | ||
} | ||
func (p *program) Stop(s service.Service) error { | ||
// Stop should not block. Return with a few seconds. | ||
p.webAPI.Stop() | ||
return nil | ||
} | ||
|
||
func main() { | ||
workingDir := "" | ||
if len(os.Args) > 1 { | ||
workingDir = os.Args[1] | ||
} | ||
svcConfig := &service.Config{ | ||
Name: "MediaWEB", | ||
DisplayName: "MediaWEB", | ||
Description: "WEB server for photos and videos", | ||
} | ||
|
||
prg := &program{workingDir: workingDir} | ||
s, err := service.New(prg, svcConfig) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
logger, err = s.Logger(nil) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
err = s.Run() | ||
if err != nil { | ||
logger.Error(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
@echo off | ||
|
||
REM MediaWEB windows service (un)installation batch script | ||
|
||
if [%1] EQU [install] ( | ||
|
||
if not exist mediaweb.exe ( | ||
echo ERROR! mediaweb.exe needs to be in current directory | ||
exit /b 1 | ||
) | ||
|
||
if not exist mediaweb.conf ( | ||
echo ERROR! mediaweb.conf needs to be in current directory | ||
exit /b 1 | ||
) | ||
|
||
echo ------------------------------------------ | ||
echo Installing MediaWEB windows service | ||
echo ------------------------------------------ | ||
sc create mediaweb binpath="\"%cd%\mediaweb.exe\" \"%cd%\"" start= auto DisplayName= "MediaWEB" || ( | ||
echo ERROR! Unable to create mediaweb service | ||
exit /b 1 | ||
) | ||
sc description mediaweb "MediaWEB Service" || ( | ||
echo ERROR! Unable to create description for mediaweb service | ||
echo. | ||
echo Make sure you are running cmd.exe as an administrator | ||
exit /b 1 | ||
) | ||
sc start mediaweb || ( | ||
echo ERROR! Unable to start mediaweb service | ||
exit /b 1 | ||
) | ||
sc query mediaweb || ( | ||
echo ERROR! Unable to query mediaweb service | ||
exit /b 1 | ||
) | ||
|
||
echo MediaWEB service successfully installed! | ||
exit /b 0 | ||
|
||
) else if [%1] EQU [uninstall] ( | ||
|
||
echo ------------------------------------------ | ||
echo Uninstalling MediaWEB windows service | ||
echo ------------------------------------------ | ||
|
||
sc stop mediaweb | ||
sc delete mediaweb || ( | ||
exit /b 1 | ||
) | ||
|
||
echo Uninstallation complete! | ||
exit /b 0 | ||
|
||
) else if [%1] EQU [] ( | ||
call :print_usage | ||
) else ( | ||
echo ERROR! Unknown command '%1' | ||
call :print_usage | ||
) | ||
|
||
exit /b 0 | ||
|
||
:print_usage | ||
echo. | ||
echo Usage: | ||
echo. | ||
echo.NOTE! Start cmd.exe with administrator privileges. | ||
echo. | ||
echo.Update mediaweb.conf before installation. | ||
echo. | ||
echo For MediaWEB service installation: | ||
echo. | ||
echo service.bat install | ||
echo. | ||
echo. | ||
echo For MediaWEB service uninstallation: | ||
echo. | ||
echo sudo sh service.sh uninstall | ||
echo. | ||
exit /b 1 |
Oops, something went wrong.