This is the back-end (Server) part of Limited Media Server. The site portion is located here.
Limited Media Server is a platform for sharing media and manga in a local network environment.
A common use case for this sever, is accessing it via a VPN to read manga or watch videos on the go, all streaming from your home. A 2nd use case is running the server locally on your desktop to stream content to compitable apps, such as Mobile VR Station.
Do not expose this server to the general internet, you have been warned. It should always be ran on a private network, and if internet access is desired, put it behind a VPN.
I built this server to take advantage of the new Raspberry PI 5 feature to run on NVMe drives, which offers a substantial speed boost and larger storage.
- User Management
- Manage Users
- Control what content is visible
- Control the features each user has access to
- Platform management
- Configure most features via the browser (Properties)
- Binding IP address
- PORT #
- Authentication timeout
- Primary Media Folder path
- Archived Media Folder path
- Temp Media Folder path
- Volume Folder path
- Configure security groups
- Lock media to certain groups
- Configure most features via the browser (Properties)
- Volume Features (Manga)
- Organize your manga and track what you have read
- It has features to scrape websites, but this edition has been altered to remove those features
- Media Features
- View Videos, Music & Images
- All files are accessed via a ID
- Access to media is verified before delivering content
- Download from YouTube (Make sure yt-dlp is installed)
- Download music as a single file or split by track. Cover art is turned into the icon.
- De-duplicate music basic upon the name
- Assign MP3 tags
- Download from M3u8 sources (Make sure ffmpeg is installed)
- Security features
- Volumes and Media Folders can have a rating limit 2. G, PG, PG-13, R-17, Rx, Unrated
- Security groups
- Users can inherit a security group, groups can be assigned to a folder
- Hard Sessions
- For devices where typing the password can be challenging, use a pin instead. The device must login normally first, then the user can establish a Hard Session.
- Admin notices
- APP Admins don't have to follow the Security Group rules
- Plugins
- The system can discover and utilize plugins to extend basic functionality
- Plugins can use Arguments or Properties
Use the Limited Media Tracker Firefox Extension to easily add content to your server directly from your browser.
In this example the user could select items on the left side to delete or move them to the right side.
- User Listing lets you Add, Edit and Remove users
- Group Listing lets you setup a security group, which users can have a group and media folders can have a group
- Property Listings lets you change how the server works. Paths to folders, ports and other settings.
To run the server, you need Python 3.x installed. Follow these steps to install Python:
-
Download Python
Visit the official Python website and download the latest version of Python 3.x:
Python Downloads -
Install Python
During the installation process:- Select "Install for all users" to ensure Python is available for the entire machine, not just your user account.
- Check the box to "Add Python to PATH" at the beginning of the installation wizard. This step is crucial for Python to work seamlessly from the command line.
-
Verify Installation
After the installation is complete, verify it by opening a terminal or Command Prompt and running the following commands:
python --versionor (depending on your system setup):
python3 --versionYou should see the installed version of Python printed.
To develop with Angular 17, you need Node.js, NPM, and Angular CLI (ng) installed. Follow the steps below to set up your environment:
-
Download Node.js
Visit the official Node.js website and download the LTS version for your platform:
Node.js Downloads -
Install Node.js
During the installation:- Check the option to install "Tools for Native Modules" if prompted (this ensures compatibility with certain npm packages).
- Confirm that Node.js is added to the system PATH (this is typically done automatically).
-
Verify Installation
Open a terminal or Command Prompt and run:
node -vThis will print the installed Node.js version. Ensure it is a version supported by Angular 17 (16.x or later).
- Check NPM
NPM is bundled with Node.js. Verify it by running:
npm -vThis will print the installed NPM version.
- Install the CLI
Use NPM to globally install Angular CLI:
npm install -g @angular/cli- Verify the Installation
Confirm that Angular CLI is installed by running:
ng versionThis command displays the installed Angular CLI version and ensures your setup is working. Ensure the CLI version supports Angular 17 (you may need the latest Angular CLI).
- Update NPM (Optional)
If you encounter issues with NPM or want to ensure you're using the latest version, update NPM:
npm install -g npm@latestVerify the update with:
npm -vGit is essential for version control in development. Follow these steps to install and configure Git:
Visit the official Git website to download the latest version of Git for your operating system:
Git Downloads
-
Run the Installer
- Open the downloaded installer file and follow the setup wizard.
-
Configuration Options
During the installation, you will encounter several configuration options. Recommended settings include:- Select Components: Leave all default options checked.
- Adjust Path Environment: Choose "Git from the command line and also from 3rd-party software" (recommended for most users).
- Default Editor: Select your preferred text editor (e.g., Vim, Visual Studio Code, Notepad++).
- Configuring Line Endings: Choose "Checkout Windows-style, commit Unix-style line endings" for cross-platform projects.
- Extra Options: Enable "Enable symbolic links" if needed for your projects.
-
Complete the Installation
Click Finish to complete the installation.
- Open a terminal or Command Prompt and run:
git --versionYou should see the installed version of Git.
Open bash or a terminal on the target server to your desired root folder.
git clone https://github.com/mgatelabs/LimitedMediaServer.git
git clone https://github.com/mgatelabs/LimitedMediaServerSite.git
cd LimitedMediaServerSite
npm install
ng build
cd ..
cd LimitedMediaServer
pip install -r requirements.txt
python server.pyAlso, incase you want to update to latest source code:
cd LimitedMediaServerSite
git fetch
git pull
npm install
ng build
cd ..
cd LimitedMediaServer
git fetch
git pull
pip install -r requirements.txtIf everything is worked, open your browser to http://serveraddress:5000/ (Linux), http://serveraddress/ (Windows), for your local windows machine it would be http://localhost.
To begin using the server, you can log in with the default admin account:
- Username:
admin - Password:
admin
However, this default account is intentionally limited and should not be used for regular operations. Follow these steps to set up your own account and secure the server:
-
Log in with the Default Admin Account
Use the default credentials to access the system. -
Create a New User Account
- Navigate to Management (Top Right Icon).
- Go to User Listing.
- Click New User (2nd Right Icon) to create a new account with the appropriate username, password, and permissions.
-
Log Out and Log In as the New User
After creating your new user account, log out of the defaultadminaccount.
Log back in using your newly created account to ensure everything is set up correctly. -
Delete the Default Admin Account
Once you are successfully logged in with your new account, delete the defaultadminaccount to improve security:- Return to User Listing under Management.
- Select the default
adminaccount and delete it.
By removing the default admin account, you significantly improve the security of your server.
Properties are key values stored in the database that control how the application operates. Without configuring these properties, certain features, such as viewing books or media, will not function properly.
To set up properties:
- Navigate to Management (Top-right icon).
- Select Management > Property Listing.
- Adjust the following properties as needed:
Note: A server restart is required after making property changes to apply them.
-
SERVER.MEDIA.PRIMARY.FOLDER- Description: The path to the folder where primary media files are stored.
- Recommendation: Store this folder on a fast disk for optimal performance.
-
SERVER.MEDIA.ARCHIVE.FOLDER- Description: The path to the folder where archived media files are stored.
- Recommendation: Use a separate disk for this folder to avoid overloading the primary disk.
-
SERVER.MEDIA.TEMP.FOLDER- Description: The path to the folder for temporary media files.
- Recommendation: Store this folder on a fast disk for quick read/write operations.
-
SERVER.VOLUME.FOLDER- Description: The path to the folder for volume/manga-related folders.
- Recommendation: Store this folder on a fast disk to enhance access speed.
Use Management (Top Right Icon) use Restart or Stop server. When you press Restart Server, the process will end with the code 69, nice.
This is an example script used on a Raspberry Pi 5 to control the execution of the server. On restart, it will do the following:
- Download Site Source Code
- Build Site from Source
- Download Latest Site Source Code
- Install requirements
- Update the DB is needed
- Start the server
In this example this script it was placed in the /home/admin folder as limitedmediaserver_script.sh. Also, the projects were cloned into /home/admin.
#!/bin/bash
echo "Limited Media Server Start!"
while true; do
cd LimitedMediaServerSite
git fetch
# Check if the current branch is behind the remote
if [[ $(git status -uno | grep 'Your branch is behind') ]]; then
git pull
npm install
ng build
else
echo "The current branch is up to date with its remote."
# Add any other actions you want to perform if the repo is up to date
fi
cd ..
cd LimitedMediaServer
git fetch
# Check if the current branch is behind the remote
if [[ $(git status -uno | grep 'Your branch is behind') ]]; then
git pull
pip install -r requirements.txt --break-system-packages
/home/admin/.local/bin/alembic upgrade head
else
echo "The current branch is up to date with its remote."
# Add any other actions you want to perform if the repo is up to date
fi
# Call your Python program here and capture its output
python server.py
result=$?
echo "Result: $result"
if [ "$result" = "69" ]; then
echo "Result is 69, looping..."
else
echo "Result is not 69, exiting loop."
break
fi
cd ..
done
echo "Limited Media Server End!"
With this file in place, you would be able to create a service to start automatically.
chmod +x /home/admin/limitedmediaserver_script.shsudo nano /etc/systemd/system/limitedmediaserver.service[Unit]
Description=Limited Media Server
After=network.target
[Service]
ExecStart=/home/admin/limitedmediaserver_script.sh
WorkingDirectory=/home/admin/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=admin
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload # Reload systemd manager configuration
sudo systemctl enable limitedmediaserver.service # Enable the service to start on boot
sudo systemctl start limitedmediaserver.service # Start the service nowsudo systemctl start limitedmediaserver.service # Start the service
sudo systemctl stop limitedmediaserver.service # Stop the service
sudo systemctl restart limitedmediaserver.service # Restart the service
sudo systemctl status limitedmediaserver.service # Check the status of the servicejournalctl -u limitedmediaserver.servicejournalctl --follow -u limitedmediaserver.serviceThis is what I built
- Raspberry PI 5 with NVMe shield
- NVMe drive with minimal 2+ TB of storage
- External drive compatible with RP5 with 7+ TB storage
- RP5 is wired into the network
- RP5 configured for SSH access with no desktop
- iOS Won't Play Audio / Video
- It seems like the new privacy settings are blocking the app from sending cookies. Turn off "Prevent Cross-Site Tracking" in Safari settings and it will work.
The App will list the current Plugins to the command line / terminal.
The App will list the current Processors to the command line / terminal.
The App will stop early. Useful for testing
Force the app to start on the specified Port number.
While it's possible to run the server with a self-signed certificate, doing so may cause issues with Mobile VR Station. Instead, a more reliable solution is to proxy your server via HTTPS to ensure a secure connection. Below, we’ll guide you through setting up NGINX as a reverse proxy on a Linux-based system, such as a Raspberry Pi.
The instructions provided will be for a linux based machince, like a Raspberry PI.
Turn off Limited Media Server, so the Nginx install won't get angry with you holding onto port 80.
For a local server, generating a self-signed certificate is a quick and cost-effective solution. However, be warned: the browser will absolutely dislike using this certificate and will throw up warnings about the connection not being secure. This happens because the certificate isn't issued by a trusted Certificate Authority (CA), but it's the only way to make your server accessible securely without spending money on a trusted certificate — especially when dealing with a local, non-production server.
You can generate an SSL certificate pair (certificate and key) that will last for 365 days with the following command:
mkdir /home/admin/ssl/
cd /home/admin/ssl/
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
cd /home/admin/We put the cert into a ssl folder for simplisity.
Also after the cert expires, you can re-issue the command to make a new pair.
If Nginx is not already installed, you can install it using the following command:
sudo apt update
sudo apt install nginx -yBy default, Nginx is installed as a systemd service, so you can enable it to start on boot:
sudo systemctl enable nginxThis ensures that Nginx starts automatically whenever your Raspberry Pi is rebooted.
To start Nginx immediately, use the following command:
sudo systemctl start nginxCheck the status of the Nginx service:
sudo systemctl status nginxYou should see output indicating that the service is active and running.
Next, configure Nginx to securely proxy HTTPS traffic to your Flask application. To do so, you'll need to edit the Nginx configuration file:
sudo nano /etc/nginx/sites-available/defaultReplace the contents with this example configuration:
server {
listen 80;
server_name limitedmediaserver;
client_max_body_size 1600M;
location / {
proxy_pass http://127.0.0.1:5000; # Port your Flask app is running on
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443 ssl;
server_name limitedmediaserver;
client_max_body_size 1600M;
ssl_certificate /home/admin/ssl/cert.pem;
ssl_certificate_key /home/admin/ssl/key.pem;
location / {
proxy_pass http://127.0.0.1:5000; # Port your Flask app is running on
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Note: Replace /path/to/cert.pem and /path/to/key.pem with the actual paths to your SSL certificate and key files.
Save and close the file (Ctrl+O, Enter, then Ctrl+X).
Before applying the changes, ensure there are no syntax errors in your Nginx configuration:
sudo nginx -tIf the test is successful, you’ll see a message like:
nginx: configuration file /etc/nginx/nginx.conf test is successful
To activate the new configuration, reload Nginx:
sudo systemctl reload nginxWith these steps, your server should now be securely proxying HTTPS traffic to your Flask application, ensuring that Mobile VR Station and other services can connect without issues.





