--------------------------------
| P5 Server Installation Guide |
--------------------------------

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

- Unzip the package
- Run the installer script
- Access the server
- Viewing logs
- Other install options
- Usage guide

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

Unzip the downloaded package file using the command:
# unzip p5-linux-0.1.zip

Switch to the folder:
# cd p5-linux-0.1

1.2 - Run the installer script
-------------------------------

Review the contents of the package:
- install.sh
- p5.jar
- p5.service
- p5-install-linux.txt
- License_Play5.txt

Make sure that the install.sh is executable:
# sudo chmod +x install.sh

Run the script:
# ./install.sh

The installation process will install Java 17, copy the files to the /opt/p5 folder and install and enable the p5 service.
In addition, the script will also install ffmpeg library for additional features.

Note: The p5.service starts the web server on port 80 by default. You can change the port to a different one if required. Just modify the p5.service file before running the install script.

1.3 - Access the server
------------------------

The play5 server is accessible on the URL
http://[IP_ADDRESS]/

For example, if the IP of the installation machine is 192.168.1.100, URL will be:
http://192.168.1.100/

The server can be stopped and started with the commands below:
# sudo systemctl stop p5
# sudo systemctl start p5

1.4 - Viewing the logs
-----------------------

The server logs can be viewed by using the commands below:
# sudo journalctl -u p5

View the logs from the last 30 minutes
# sudo journalctl -u p5 --since "30 min ago"

1.5 - Other install options
----------------------------

The server can be run manually, by running the jar file using the Java runtime.
For that, you must manually install the Java runtime using the instructions below.


1.5.1 - Install Java 17
------------------------

The p5 media server JAR file is a cross-platform build of the media server that can be run on any operating system that has Java Runtime 17 or above installed. 

Check if Java is installed by running the command:

java -version

If Java is installed, the version of java is displayed. 
If Java is not installed, a message is displayed that the command java is not found but can be installed, along with the install commands.

Use the command that corresponds to the version 17.

In this case, the command will be:

sudo apt install openjdk-17-jre-headless

Once the install is complete, run java -version again to make sure the correct version is installed.

1.5.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, use the command:

sudo apt install ffmpeg

Verify by using the command:

ffmpeg

The output will show the version and all the enabled flags

1.5.3 - Copy the JAR file
--------------------------

Copy the JAR file in the package to any location of your choice, for example /opt/p5
# mkdir /opt
# mkdir /opt/p5
# cp p5-0.1.jar /opt/p5

Finally, run the server
# java -jar /opt/p5/p5-0.1.jar --server.port=80

1.6 - Usage guide
------------------

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.


