-------------------------------------------
| P5 Server Installation  and Usage Guide |
-------------------------------------------

1.0 - Summary
--------------

- Unzip the package
- Install FFMpeg
- Install as a service
- Run using the executable (Alternative method)
- Run using the JAR (2nd Alternative)
- Access the server
- Usage guide


1.1 - Unzip the package contents
---------------------------------

Unzip the package in a folder, for example, C:\apps\p5-win-0.1
Using the command prompt, switch into the directory where the unzipped contents are located and review the files

- p5-win-0.1
  - <jre>
  - play5.exe
  - p5.bat
  - p5.jar
  - play5-svc.exe
  - play5-svc.xml
  - p5-32.ico
  - License_Play5.txt
  - p5-install-win.txt
  - setup.bat

The package has a bundled Java runtime environment suitable for running the server and is located in the folder jre.
Note: You can install Java 17 or newer, if you choose to manually execute the JAR file.

1.2 - Install FFMpeg
---------------------

P5 Media Server can take advantage of the FFMpeg software to get detailed media information and to transcode the non-compatible media. If you decide to not install FFMpeg, the server will display limited media information and you can only play contents that are encoded using H264 video codec, AAC audio codec in MP4 container.

To install FFMpeg, go to the website:

https://github.com/BtbN/FFmpeg-Builds/releases

Download the latest master windows based 64-bit GPL zip file.
The zip file will have the executables ffprobe.exe and ffmpeg.exe. Place them in the same folder where the p5 package is unzipped, this is the same folder where play5.exe file is located.

Finally, you must edit the system environment variables and edit the Path variable and add the path to ffprobe.exe and ffmpeg.exe to the system path.

Test by opening a command prompt and run the command ffprobe. You should see the version and build information.


1.3 - Installation Script
-------------------------

Open the command prompt and switch to the folder where the package is unzipped

Execute the setup.bat batch script. This will install the server files in the folder %userprofile%\p5

The script will also setup the play5 media server as a windows service

You can use the steps in the sections below to manually setup the service and also run the server without even needing to add it as a windows service, if you prefer.

1.4 - Install as a service
---------------------------

Install the service by running the command:

play5-svc install

Command to start the service:

play5-svc start

Command to stop the service:

play5-svc stop

Command to to uninstall the service:

play5-svc uninstall

The service will start/stop with the Windows.

Note: If port 80 is already in use, modify the play5-svc.xml and change the server port within the <argument> element if needed, before installing the service.

Note: Windows does not allow access to mapped network drives in the application running as services. If you are going to use the videos through a mapped network drive, consider running the application using the executable file or the JAR directly.

1.5 - Run using the executable (Alternative Method)
---------------------------------------------------------

Alternative to installing as a service, you can also start the server using the executable file.
Using the Command Prompt, switch over to the unzipped directory

Start the server by using the command:

play5.exe --server.port=80

Note: You can specify any port you want if port 80 is already in use.

1.5 - Run using the JAR (2nd Alternative Method)
--------------------------------------------------

The server can be started by simply executing the bundled JAR file, you you prefer.
Using the Command Prompt, switch to the unzipped directory.
Execute the included .bat file to start the server

p5.bat

Note: Edit the .bat file to change the server port, if needed.


1.6 - Access the server
------------------------

The media server can be accessed using the URL:

http://[IP_OF_THE_SERVER]/

If you modified the server port, the URL will be:

http://[IP_OF_THE_SERVER]:[PORT]/

First-run wizard is displayed when the server is accessed for the very first time. Specify the admin password and source path to at least one of the libraries for either movies or TV shows.

The media server will scan the media files and download metadata.

Login to the server using the username admin and the password you just created.

Java Requirements and Information
----------------------------------

The p5 media server is a cross-platform application server that can be run on any operating system that has Java Runtime 17 or above installed.
The package contains the Java 17 runtime bundled with it. If you have a Java version already installed and it is lower than version 17, you may want to install Java 17 in case you run into any issues.

1.7 - Usage guide
------------------

Movies Source Folder
---------------------

The source path for the movies can be flat or contain sub-folders. The movie library scanner will scan for the common video file extensions.
The movie files must be named as one of the following patterns:

- Movie Name.ext
- Movie Name (YEAR).ext

For example

Iron Man.mp4
Iron Man (2008).mp4

TV Shows Source Folder
-----------------------

The TV Shows folder must contain a sub folder for each TV show as the name of the show. Within the sub folder of the TV show, there should be video files named as season and episode numbers and optionally, the episode name.

For example

- /media/tv
	- Game of Thrones
		- S01E01.mp4
		- S01E02.mp4

OR

- /media/tv
	- Game of Thrones
		- S01E01 Winter Is Coming.mp4
		- S01E02 The Kingsroad.mp4


Scanning for the media
-----------------------

The media server will start the scanner after the library source paths are provided as part of the initial setup. The scan can also be started from the Movies or TV menus and selecting the menu item Scan Movies Library or Scan TV Library.

Reset the metadata
-------------------

Initial Setup can be forced to run by going to the menu Manage and selecting the Settings menu item. For the init option, type true and hit the update button below.



