Navidrome - Open source music server [Build your own music player] "Port mapping" to listen anytime, anywhere

1 Introduction

I don’t know when, the music software we can use is less and less. The author has used Xiaomi mobile phones for a long time. Since the built-in music player of Xiaomi mobile phones has changed to QQ Music, many music in my mobile phone can no longer be freely played. Listen, you need to pay to add membership to listen to the song, otherwise you have to endure the cut trial version. The most important thing is not to let the music downloaded by yourself be played! ! ! This is a headache. In order to avoid this situation, the author intends to use the Cpolar intranet penetration + Navidrome solution to build a private music server so that he can enjoy music freely again.

2. Navidrome website construction

Navidrome is an open source music server, and it can also be easily used as an independent music server with web interface, which means we can access it on mobile phones, tablets or other computers. As long as it is installed on the local computer and combined with the intranet penetration software cpolar, we can access the Navidrome webpage on the home computer anywhere and enjoy the relaxation brought by music.

It should be noted that since Navidrome does not depend on the webpage operating environment, its installation process is not the usual website installation process.

2.1 Navidrome download and installation

2.1.1 Install and add ffmpeg

First, we need to download and install ffmpeg. After all, Navidrome is based on it, so we need to install a ffmpeg (many music and video software rely on it to run). Just visit the ffmpeg official website ( ffmpeg.org ), you can find the download.

20230413092401

20230413092402

20230413092403

Next, add ffmpeg to the path environment variable. Remember to bring the folder in the environment variable binso that we can call ffmpeg.exe in any cmd window.

20230413092404

20230413092405

20230413092406

2.1.2 Download and configure Navidrome

Next, we visit Navidrome's official website ( www.navidrome.org ), click the download button on the official website, and enter the installation guidance page. On this page, we can see instructions for installing Navidrome on different systems. Many open source software will be placed on github (Navidrome is no exception), so its download page will go to github.

20230413092407

20230413092408

The author uses a windows system, so I choose the Windows version to download.

20230413092409

20230413092410

After completing the download of Navidrome, unzip it to the location where you plan to install it. Here, I put it in the program file64 folder of the D drive for easy management. According to the installation guide of Navidrome, we also need to modify the configuration file of Navidrome to let Navidrome know which folder to look for music files.

20230413092411

The configuration file of Navidrome navidrome.tomlis usually placed in the same folder as navidrome.exe. If there is no such file, you can create a new one (create a new text file and change the suffix name to .toml), and add the following command line to this file.

# This is just an example! Please see available options to customize Navidrome for your needs at
# https://www.navidrome.org/docs/usage/configuration-options/#available-options

LogLevel = 'DEBUG'
ScanSchedule = '@every 24h'
TranscodingCacheSize = '150MiB'

# IMPORTANT: Use single quotes for paths in Windows
MusicFolder = 'D:\Music'

# Set this to the path of your ffmpeg executable
FFmpegPath = ' D:\Program Files\ffmpegfull\ffmpegfull\bin\ffmpeg.exe'

In these command lines, some parameters are modified according to the actual situation, including MusicFolder = 'D:\Music'and FFmpegPath = ' D:\Program Files\ffmpegfull\ffmpegfull\bin\ffmpeg.exe'.

20230413092412

20230413092413

For more detailed configuration parameter comments, please refer to the comment page of navidrome official website: https://www.navidrome.org/docs/usage/configuration-options/

After editing the configuration file, you can run the file in the cmd window navidrome.exe(double-clicking the .exe file does not work, you must run it in the command line window) to officially install Navidrome.

20230413092414

During the installation process, there may be a network security query, we just need to choose to allow access.

20230413092415

After the command line program finishes running, don't close the cmd window, let's try to visit the navidrome webpage to see if the installation is successful. Enter in the browser address bar localhost:4533(4533 is the default output port of navidrome). As long as the navidrome login interface is displayed, it means that our setup is successful. You can directly set the login name and password on the login interface. Remember the user information you entered, otherwise you may not be able to log in later.

20230413092416

20230413092417

It should be noted that our navidrome has not been added to the Windows system service at this time, as long as the cmd window is closed, the navidrome page cannot be accessed. So in the next step, we will add navidrome to the Windows service.

2.1.3 Add Navidrome to system service

In order to access the navidrome web page at any time without having to open the cmd window all the time, we need to add navidrome to the Windows system service. According to the suggestion of navidrome official website, you can use Shawl, NSSM and WinSW to add navidrome to the startup directory. NSSMHere I set it according to the official website guidelines .

20230413092418

20230413092419

After downloading the NSSM compressed package, unzip it and find the .exe installation file in the win64 folder. I use the 64-bit version of Windows, so I choose the win64 installation package.

20230413092420

Since NSSM is a green program, it does not need to be installed, so it can be run directly in cmd. That is, enter cmd in the search bar of the win64 folder, open the cmd program in this path, and then enter the command

nssm install

You can open the graphical interface of nssm.

20230413092421

20230413092422

In the nssm graphical interface, find Paththe field, enter navidrome.exe into it (select the path through the "..." button behind the Path field), and enter the service namename below to distinguish it. Then click install serviceOK to add the service.

20230413092423

Finally, we open 服务the page (you can directly enter "service" in the search bar and open it in the search results), and start the service item set in Nssm (in this example, it is the navid service item set by the author).

20230413092424

20230413092425

2.2. Navidrome web page test

After adding Navidrome to the Windows service, you can open the Navidrome webpage without starting the cmd window. Similarly, in order to test whether Navidrome can work normally, we enter it in the address bar of the browser localhost:4533and try to open the main page of Navidrome. As long as it can be displayed normally, it means that we have successfully installed the Navidrome music website on the local computer.

20230413092426

20230413092427

3. Local web publishing

After the above steps, we have successfully installed the Navidrome music website server, and then we can use it to cpolar内网穿透create a public Internet address connected to the local Navidrome page, so that we can access the Navidrome webpage on the LAN computer on the public Internet.

cpolar official website: https://www.cpolar.com/

3.1 Installation and registration of cpolar

After completing the installation of the Navidrome music website on the local computer, you can switch to the installation of cpolar. Compared with the Navidrome music website, the installation of cpolar is much simpler. We directly visit cpolar's official website page and find 下载the button.

20230413092428

The author uses the Windows operating system, so choose the Windows version to download.

20230413092429

After the download of Cpolar is complete, decompress the downloaded file, double-click the decompressed .msifile to execute the automatic installation program, and press "Next" all the way to complete the installation.

20230413092430

20230413092431

cpolar will create an exclusive data tunnel for each independent user, and use user password and token code to ensure the data security of each user. So before using cpolar, it needs to be done 用户注册.

The new registration procedure is very simple, just click "User Registration" on the upper right corner of the cpolar homepage, fill in the necessary information on the registration page, and the registration can be completed.

20230413092432

20230413092433

3.2 Cpolar cloud settings

Due to cpolar intranet penetration, the data tunnel of the free version is reset every 24 hours. I don't want to set up the connection settings of the Navidrome music web page every day, so I upgraded cpolar to the VIP version to obtain a long-term stable intranet penetration data tunnel.

To create an intranet penetration tunnel that can exist stably for a long time, it needs to be divided into two steps. First log in to cpolar's official website, find the button on the left side of the user's main page 预留, and click to enter cpolar's data tunnel reservation page. Here, a public Internet address is generated for the local Navidrome webpage (it can also be regarded as the entrance of the data tunnel). At this time, this address is not connected to the local software output port, so it can also be regarded as a blank data tunnel.

20230413092434

On the reservation page, you can see many kinds of data tunnels that can be reserved, because Navidrome is a web music server, so we choose 保留二级子域名the field.

20230413092435

In the field of "reserved second-level subdomain name", several simple information must be set to create a unique public Internet address. The information that needs to be set is:

  • 地区: The area where the server is located, just select the nearest one;
  • 二级域名: will eventually appear in the generated public Internet address as one of the identifiers of the network address;
  • 描述: It can be regarded as the description of the data tunnel, as long as it can be distinguished from other tunnels.

After completing these settings, you can click 保留the button on the right to keep this data tunnel.

20230413092436

Of course, if this data tunnel is no longer intended to be used, you can click the "x" on the right to delete it easily, saving valuable tunnel quota.

20230413092437

3.3 Cpolar Local Settings

After setting up and keeping the blank tunnel in the cpolar cloud, we go back to the local cpolar client and connect the blank data tunnel generated in the cloud with the local test page.

Open and log in the cpolar client locally (you can directly access it by typing in the browser localhost:9200, or click the shortcut of the cpolar client in the start menu).

20230413092438

隧道管理Click the button on the left side of the main interface of the client 创建隧道to enter the local tunnel creation page (if you want to create a temporary data tunnel without a 24-hour reset address, you can directly set it here instead of setting a blank data tunnel on the cpolar official website).

On this page, several information settings also need to be made, including:

  • 1. 隧道名称: It can be regarded as the local tunnel information annotation of cpolar, as long as it is convenient to distinguish;
  • 2. 协议: Since the Navidrome music service is in the form of a web page, choose the http protocol;
  • 3. 本地地址: The local address is the output port number of the local website, and the default output port of Navidrome is 4533, so fill in 4533 here;
  • 4. 域名类型: Since the author has reserved the data tunnel of the second-level sub-domain name in the cpolar cloud, check the "second-level sub-domain name" (if the reserved domain name is a custom domain name, then check the custom domain name)
  • 5. Sub Domain: Fill in the reserved second-level sub-domain name, which is "Navidromeweb" in this example (Note: If you are creating a temporary data tunnel, directly check "Random domain name", and the cpolar client will generate the network address by itself);
  • 6. 地区: Same as the information reserved in the cpolar cloud, we can fill it in according to the actual use;

20230413092439

After completing these settings, you can click 创建the button at the bottom of the page to connect the blank data tunnel on the cpolar cloud with the local Navidrome music station, which provides us with a data tunnel that can access the local Navidrome music station on the public Internet. cpolar will also automatically jump to the "Tunnel List" page under the "Tunnel Management" item.

20230413092440

On the "Tunnel List" page under the "Tunnel Management" item, you can manage this data tunnel, including opening, closing or deleting this tunnel. You can also click the "Edit" button to modify the information of this data tunnel .

4. Public network access test

We can click the button 状态under the item on 在线隧道列表the left to find the public Internet address of this page, paste this address into the browser, and then we can see the local Navidrome music station page and build our own private music station.

20230413092441

20230413092442

5 Conclusion

At this point, we have completed the work of using Cpolar+Navidrome to build a private music station. Although the steps seem to be many and complicated, it is mainly to show each step in detail for everyone. The actual operation only takes more than ten minutes. I don’t know if you have noticed that during the construction of the Navidrome music server, the configuration of common webpage operating environments such as apache and MySQL is not involved, but Navidrome itself is installed throughout the process, which undoubtedly greatly reduces the difficulty of building the Navidrome music station, and can Play downloaded music yourself.

Guess you like

Origin blog.csdn.net/2301_76369174/article/details/130123151