New Running from Source and Build gubbins

For testing by users, particularly Linux and macOS.
This commit is contained in:
Hydrus Network Developer 2022-11-01 23:17:15 -05:00
parent e670054e48
commit 880eec5034
39 changed files with 653 additions and 353 deletions

View File

@ -5,7 +5,7 @@ on:
- 'v*'
jobs:
build-macos-Qt6:
build-macos:
runs-on: macos-11
steps:
-
@ -32,7 +32,7 @@ jobs:
cd $GITHUB_WORKSPACE
cp ${{ steps.setup_ffmpeg.outputs.ffmpeg-path }} bin/
cp static/build_files/macos/pyoxidizer.bzl pyoxidizer.bzl
cp static/build_files/macos/requirementsQt6.txt requirements.txt
cp static/build_files/macos/requirements.txt requirements.txt
basename $(rustc --print sysroot) | sed -e "s/^stable-//" > triple.txt
pyoxidizer build --release
cd build/$(head -n 1 triple.txt)/release
@ -52,17 +52,17 @@ jobs:
cd $GITHUB_WORKSPACE
temp_dmg="$(mktemp).dmg"
hdiutil create "$temp_dmg" -ov -volname "HydrusNetwork" -fs HFS+ -format UDZO -srcfolder "$GITHUB_WORKSPACE/build/$(head -n 1 triple.txt)/release"
mv "$temp_dmg" HydrusNetwork6.dmg
mv "$temp_dmg" HydrusNetwork.dmg
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: MacOS-DMG6
path: HydrusNetwork6.dmg
name: MacOS-DMG
path: HydrusNetwork.dmg
if-no-files-found: error
retention-days: 2
build-ubuntu-Qt6:
build-ubuntu:
runs-on: ubuntu-20.04
steps:
-
@ -83,7 +83,7 @@ jobs:
sudo apt-get install -y libmpv1
-
name: Pip Install
run: python3 -m pip install -r hydrus/static/build_files/linux/requirementsQt6.txt
run: python3 -m pip install -r hydrus/static/build_files/linux/requirements.txt
-
name: Build docs to /help
run: mkdocs build -d help
@ -128,17 +128,17 @@ jobs:
name: Compress Client
run: |
mv dist/client "dist/Hydrus Network"
tar -czvf Ubuntu-Extract6.tar.gz -C dist "Hydrus Network"
tar -czvf Ubuntu-Extract.tar.gz -C dist "Hydrus Network"
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: Ubuntu-Extract6
path: Ubuntu-Extract6.tar.gz
name: Ubuntu-Extract
path: Ubuntu-Extract.tar.gz
if-no-files-found: error
retention-days: 2
build-windows-Qt6:
build-windows:
runs-on: windows-2019
steps:
-
@ -160,7 +160,7 @@ jobs:
architecture: x64
-
name: Pip Install
run: python3 -m pip install -r hydrus/static/build_files/linux/requirementsQt6.txt
run: python3 -m pip install -r hydrus/static/build_files/linux/requirements.txt
-
name: Build docs to /help
run: mkdocs build -d help
@ -199,7 +199,7 @@ jobs:
move ${{ steps.setup_ffmpeg.outputs.ffmpeg-path }} hydrus\bin\
move hydrus\static\build_files\windows\sqlite3.dll hydrus\
move hydrus\static\build_files\windows\sqlite3.exe hydrus\db
move hydrus\static\build_files\windows\client-winQt6.spec client-win.spec
move hydrus\static\build_files\windows\client-win.spec client-win.spec
move hydrus\static\build_files\windows\server-win.spec server-win.spec
pyinstaller server-win.spec
pyinstaller client-win.spec
@ -215,7 +215,7 @@ jobs:
name: Compress Client
run: |
cd .\dist
7z.exe a -tzip -mm=Deflate -mx=5 ..\Windows-Extract6.zip 'Hydrus Network'
7z.exe a -tzip -mm=Deflate -mx=5 ..\Windows-Extract.zip 'Hydrus Network'
cd ..
-
name: Upload a Build Artifact
@ -229,15 +229,15 @@ jobs:
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: Windows-Extract6
path: Windows-Extract6.zip
name: Windows-Extract
path: Windows-Extract.zip
if-no-files-found: error
retention-days: 2
create-release:
name: Create Release Entry
runs-on: ubuntu-20.04
needs: [build-windows-Qt6, build-ubuntu-Qt6, build-macos-Qt6]
needs: [build-windows, build-ubuntu, build-macos]
steps:
-
name: Checkout code
@ -256,9 +256,9 @@ jobs:
run: |
mkdir ubuntu windows
mv Windows-Install/HydrusInstaller.exe Hydrus.Network.${{ env.version_short }}.-.Windows.-.Installer.exe
mv Windows-Extract6/Windows-Extract6.zip Hydrus.Network.${{ env.version_short }}.-.Windows.-.Extract.only.zip
mv Ubuntu-Extract6/Ubuntu-Extract6.tar.gz Hydrus.Network.${{ env.version_short }}.-.Linux.-.Executable.tar.gz
mv MacOS-DMG6/HydrusNetwork6.dmg Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg
mv Windows-Extract/Windows-Extract.zip Hydrus.Network.${{ env.version_short }}.-.Windows.-.Extract.only.zip
mv Ubuntu-Extract/Ubuntu-Extract.tar.gz Hydrus.Network.${{ env.version_short }}.-.Linux.-.Executable.tar.gz
mv MacOS-DMG/HydrusNetwork.dmg Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg
-
name: Release new
uses: softprops/action-gh-release@v1

2
.gitignore vendored
View File

@ -69,6 +69,8 @@ venv.bak/
# User-changeable files
/client-user.bat
/client-user.sh
/client-user.command
# docs builds
/site/

View File

@ -6,9 +6,15 @@ I am continually working on the software and try to put out a new release every
This github repository is currently a weekly sync with my home dev environment, where I work on hydrus by myself. **Feel free to fork and do whatever you like with my code, but please do not make pull requests.** The [issue tracker here on Github](https://github.com/hydrusnetwork/hydrus/issues) is active and run by blessed volunteer users. I am not active here on Github, and I have difficulty keeping up with social media in general, but I welcome feedback of any sort and will eventually catch up with and reply to email, the 8chan or Endchan, tumblr, twitter, or the discord.
The client can do quite a lot! Please check out the help inside the release or [here](https://hydrusnetwork.github.io/hydrus/), which includes a comprehensive getting started guide. If you are running from source and would like a local copy of the help, check [here](https://hydrusnetwork.github.io/hydrus/about_docs.html)!
## Start Here!
A rudimentary documentation for the [container](https://github.com/hydrusnetwork/hydrus/pkgs/container/hydrus) setup can be found [here](https://github.com/hydrusnetwork/hydrus/blob/master/static/build_files/docker/README.md).
**[Getting Started Guide](https://hydrusnetwork.github.io/hydrus/introduction.html)**
This help will walk you through installation and teach you the main systems of the program. Hydrus can do a lot, so while you can skim it, do not skip it.
The help is also included in every release.
# Links
* [homepage](https://hydrusnetwork.github.io/hydrus/)
* [issue tracker](https://github.com/hydrusnetwork/hydrus/issues)

16
client.command Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
if [ ! -d "venv" ]; then
echo "You need to set up a venv! Check the running from source help for more info!"
exit 1
fi
source venv/bin/activate
# You can copy this file to 'client-user.sh' and add in your own launch parameters here if you like, and a git pull won't overwrite the file.
# Just tack new params on like this:
# python client.py -d="/path/to/hydrus/db"
python client.py
deactivate

16
client.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
if [ ! -d "venv" ]; then
echo "You need to set up a venv! Check the running from source help for more info!"
exit 1
fi
source venv/bin/activate
# You can copy this file to 'client-user.sh' and add in your own launch parameters here if you like, and a git pull won't overwrite the file.
# Just tack new params on like this:
# python client.py -d="/path/to/hydrus/db"
python client.py
deactivate

View File

@ -1491,7 +1491,7 @@ Response:
"file_id": 123,
"hash": "4c77267f93415de0bc33b7725b8c331a809a924084bee03ab2f5fae1c6019eb2",
"size": 63405,
"mime": "image/jpg",
"mime": "image/jpeg",
"ext": ".jpg",
"width": 640,
"height": 480,
@ -1618,7 +1618,7 @@ Response:
"file_id": 123,
"hash": "4c77267f93415de0bc33b7725b8c331a809a924084bee03ab2f5fae1c6019eb2",
"size": 63405,
"mime": "image/jpg",
"mime": "image/jpeg",
"ext": ".jpg",
"width": 640,
"height": 480,

View File

@ -8,7 +8,7 @@ If any of this is confusing, a simpler guide is [here](https://github.com/Zweiba
## downloading
You can get the latest release at [my github releases page](https://github.com/hydrusnetwork/hydrus/releases).
You can get the latest release at [the github releases page](https://github.com/hydrusnetwork/hydrus/releases).
I try to release a new version every Wednesday by 8pm EST and write an accompanying post on [my tumblr](http://hydrus.tumblr.com/) and a Hydrus Network General thread on [8chan.moe /t/](https://8chan.moe/t/catalog.html).
@ -61,6 +61,10 @@ I try to release a new version every Wednesday by 8pm EST and write an accompany
* [flatpak](https://flathub.org/apps/details/io.github.hydrusnetwork.hydrus)
=== "Docker"
* A rudimentary documentation for the [container](https://github.com/hydrusnetwork/hydrus/pkgs/container/hydrus) setup can be found [here](https://github.com/hydrusnetwork/hydrus/blob/master/static/build_files/docker/README.md).
=== "From Source"
* You can also [run from source](running_from_source.md). This is often the best way to fix compatibility problems.
@ -177,6 +181,7 @@ Hydrus's database engine, SQLite, is excellent at keeping data safe, but it cann
* Accidental overwrite (usually during a borked update)
* Encrypted partition auto-dismount/other borked settings
* Cloud backup interfering with ongoing writes
* An automatic OS backup routine misfiring and causing a rollback, wiping out more than a year of progress
* A laptop that incorrectly and roughly disconnected an external USB drive on every sleep
* Network drive location not guaranteeing accurate file locks
* Windows NVMe driver bugs necessitating a different SQLite journalling method

View File

@ -31,7 +31,9 @@ And can be extended to download from more locations using easily shareable user-
The program's emphasis is on your freedom. There is no DRM, no spying, no censorship. The program never phones home.
If you would like to try it, I _**strongly**_ recommend you check out the [help and getting started guide](introduction.md). A copy of all this help is included with the release as well.
## Start Here
If you would like to try hydrus, I _**strongly**_ recommend you check out the **[help and getting started guide](introduction.md)**. It will take you through all the main systems.
## links

View File

@ -4,37 +4,49 @@ title: Introduction and Statement of Principles
# introduction and statement of principles
## this help { id="this_help" }
Click the links on the left to go through the getting started guide. Please at least skim every page in turn, as it will introduce you to the main systems in the client. There is a lot, so you do not have to do it all in one go.
The section on installing, updating, and **backing up** is very important.
This help is available locally in every release. Open `install_dir/help/index.html`.
## on having too many files { id="files" }
I've been on the internet and imageboards for a <span style="color:red">lo</span><span style="color:green">ng</span> time, saving everything I like to my hard drive. After a while, the whole collection was just too large to manage on my own. I couldn't find anything in the mess, and I just saved new files in there with names like 'image1257.jpg'.
There aren't many solutions to this problem that aren't online, and I didn't want to lose my privacy or control.
## on being anonymous { id="anonymous" }
Nearly all sites use the same pseudonymous username/password system, and nearly all of them have the same drama, sockpuppets, and egotistical mods. Censorship is routine. That works for many people, but not for me.
I enjoy being anonymous online. When you aren't afraid of repercussions, you can be as truthful as you want and share interesting things, no matter how unusual. You can have unique conversations and tackle some otherwise unsolvable problems. It's fun!
I enjoy being anonymous online. When you aren't afraid of repercussions, you can be as truthful as you want. You can have conversations that can happen nowhere else. It's fun!
I've been on the imageboards for a long time, saving everything I like to my hard drive. After a while, the whole collection was just too large to manage on my own.
I'm a normal Anon, nothing special. :^)
## the hydrus network { id="hydrus_network" }
So! I'm developing a program that helps people organise their files together anonymously. I want to help you do what you want with your stuff, and that's it. You can share some tags and files with other people if you want to, but you don't have to connect to anything if you don't. **The default is complete privacy, no sharing**, and every upload requires a conscious action on your part. I don't plan to ever record metrics on users, nor serve ads, nor charge for my software. The software never phones home.
So! I'm developing a program that helps people organise their files on their own terms and, if they want to, collaborate with others anonymously. I want to help you do what you want with your stuff, and that's it. You can share some tags (and files, but this is limited) with other people if you want to, but you don't have to connect to anything if you don't. **The default is complete privacy, no sharing**, and every upload requires a conscious action on your part. I don't plan to ever record metrics on users, nor serve ads, nor charge for my software. The software never phones home.
This does a lot more than a normal image viewer. If you are totally new to the idea of personal media collections and tagging, I suggest you start slow, walk through the getting started guides, and experiment doing different things. If you aren't sure on what a button does, try clicking it! You'll be importing thousands of files and applying _tens_ of thousands of tags in no time.
This does a lot more than a normal image viewer. If you are totally new to the idea of personal media collections and booru-style tagging, I suggest you start slow, walk through the getting started guides, and experiment doing different things. If you aren't sure on what a button does, try clicking it! You'll be importing thousands of files and applying _tens_ of thousands of tags in no time. The best way to learn is just to try things out.
The client is chiefly a file database. It stores your files inside its own folders, managing them far better than an explorer window or some online gallery. Here's a screenshot of one of my test installs with a search showing all files:
[![](images/example_client.png "WELCOME TO INTERNET")](images/example_client.png)
As well as the client, there is also a server that anyone can run to store files or tags for sharing between many users. The mechanics of running a server is usually confusing to new users, so wait a little while before you explore this. Some users run a public tag repository with hundreds of millions of tags that you can access and contribute to if you wish.
As well as the client, there is also a server that anyone can run to store files or tags for sharing between many users. This is advanced, and almost always confusing to new users, do not explore this until you know what you are doing. There is however, a user-run **public tag repository**, with more than a billion tags, that you can access and contribute to if you wish.
I have many plans to expand the client and the network.
## statement of principles { id="principles" }
* No speech should be outlawed.
* Speech should be as free as possible.
* Everyone should be able to control their own media diet.
* Computer data and network logs should be absolutely private.
None of the above are currently true, but I would love to live in a world where they were. My software is an attempt to move us a little closer.
I try to side with the person over the authority, the distributed over the centralised. I still use gmail and youtube just like pretty much everyone, but I would rather be using different systems, especially in ten years. No one seemed to be making what I wanted for file management, so I decided to do it myself, and here we are.
Where possible, I prefer decentralised systems that are focused on people. I still use gmail and youtube IRL just like pretty much everyone, but I would rather we have alternative systems for alternate work, especially in the future. No one seemed to be making what I wanted for file management, particularly as everything rushed to the cloud space, so I decided to make a local solution myself, and here we are.
If, after a few months, you find you enjoy the software and would like to further support it, I have set up a simple no-reward patreon, which you can read more about [here](support.md).

View File

@ -4,137 +4,214 @@ title: Running From Source
# running from source
I write the client and server entirely in [python](https://python.org), which can run straight from source. It is getting simpler and simpler to run python programs like this, so don't be afraid of it. If none of the built packages work for you (for instance if you use Windows 7 or a non-Ubuntu-compatible flavour of Linux), it may be the only way you can get the program to run. Also, if you have a general interest in exploring the code or wish to otherwise modify the program, you will obviously need to do this.
I write the client and server entirely in [python](https://python.org), which can run straight from source. It is getting simpler and simpler to run python programs like this, so don't be afraid of it. If none of the built packages work for you (for instance if you use Windows 7 or 18.04 Ubuntu (or equivalent)), it may be the only way you can get the program to run. Also, if you have a general interest in exploring the code or wish to otherwise modify the program, you will obviously need to do this.
## Simple Windows Guide
## Simple Setup Guide
There are now batch files that make setup easy. You do not need any python experience.
There are now setup scripts that make this easy on Windows and Linux. You do not need any python experience.
### Summary:
1. Get Python.
2. Get Hydrus source.
3. Get FFMPEG/mpv/sqlite.
4. Run 'setup_venv.bat'.
5. Run 'setup_help.bat'.
6. Run 'client.bat'.
3. Get mpv/SQLite/FFMPEG.
4. Run setup_venv script.
5. Run setup_help script.
6. Run client script.
### Walkthrough
#### Core
First of all, if you do not have python installed, get 3.8.x or 3.9.x [here](https://www.python.org/downloads/windows/). During the install process, make sure it has something like 'Add Python to PATH' checked. This makes Python available to your Windows.
!!! warning ".sh and .command are in testing"
Hey, the .sh and .command setup files for Linux/macOS are new. I cannot promise they are bug free, so please only test them if you are brave and/or know a little about this, and let me know how it goes.
=== "Windows"
First of all, you will need to install Python. Get 3.8.x or 3.9.x [here](https://www.python.org/downloads/windows/). During the install process, make sure it has something like 'Add Python to PATH' checked. This makes Python available to your Windows.
=== "Linux"
You should already have a fairly new python. Ideally, you want 3.8.x or 3.9.x. If you are on 3.10.x, run the 'advanced' setup script later on and choose the newer OpenCV.
=== "macOS"
You should already have python of about the correct version.
Then, get the hydrus source. The github repo is [https://github.com/hydrusnetwork/hydrus](https://github.com/hydrusnetwork/hydrus). If you are familiar with git, you can just clone the repo to the location you want with `git clone https://github.com/hydrusnetwork/hydrus`, but if not, then just go to the [latest release](https://github.com/hydrusnetwork/hydrus/releases/latest) and download and extract the source code .zip somewhere. Make sure the directory has write permissions (e.g. don't put it in "Program Files"). Extracting straight to a spare drive, something like "D:\Hydrus Network", is ideal.
We will call the base extract directory, the one with 'client.py' in it, `install_dir`.
!!! info "Notes"
Don't mix and match build extracts and source extracts. The process that runs the code gets confused if there are extra .dlls in the directory. If you need to convert between built and source releases, perform a [clean install](getting_started_installing.md#clean_installs).
!!! info "Mixed Builds"
Don't mix and match build extracts and source extracts. The process that runs the code gets confused if there are unexpected extra .dlls in the directory. If you need to convert between built and source releases, perform a [clean install](getting_started_installing.md#clean_installs).
#### Built Programs
There are three external libraries. You just have to get them and put them in the correct place:
1. mpv
1. If you are on Windows 7, get [this](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/mpv-dev-x86_64-20210228-git-d1be8bb.7z).
2. If you are on Windows 8 or newer, get [this](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/mpv-dev-x86_64-20220501-git-9ffaa6b.7z).
Then open that archive and place the 'mpv-1.dll' or 'mpv-2.dll' into `install_dir`.
2. sqlite3
Go to `install_dir/static/build_files/windows` and copy 'sqlite3.dll' into `install_dir`.
3. ffmpeg
Get a Windows build of FFMPEG [here](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z).
Extract the ffmpeg.exe into `install_dir/bin`.
=== "Windows"
1. mpv
1. If you are on Windows 7, get [this](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/mpv-dev-x86_64-20210228-git-d1be8bb.7z).
2. If you are on Windows 8 or newer, get [this](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/mpv-dev-x86_64-20220501-git-9ffaa6b.7z).
Then open that archive and place the 'mpv-1.dll' or 'mpv-2.dll' into `install_dir`.
2. SQLite3
Go to `install_dir/static/build_files/windows` and copy 'sqlite3.dll' into `install_dir`.
3. FFMPEG
Get a Windows build of FFMPEG [here](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z).
Extract the ffmpeg.exe into `install_dir/bin`.
=== "Linux"
1. mpv
Try running `apt-get install libmpv1` in a new terminal. You can type `apt show libmpv1` to see your current version. Or, if you use a different package manager, try searching `libmpv` or `libmpv1` on that.
1. If you have earlier than 0.34.1, you will be looking at running the 'advanced' setup script in the next section and selecting the 'old' mpv.
2. If you have 0.34.1 or later, you can run the normal setup script.
2. SQLite3
No action needed.
3. FFMPEG
You should already have ffmpeg. Just type `ffmpeg` into a new terminal, and it should give a basic version response. If you somehow don't have ffmpeg, check your package manager.
=== "macOS"
1. mpv
Unfortunately, mpv is not well supported in macOS yet. You may be able to install it in brew, but it seems to freeze the client as soon as it is loaded. Hydev is thinking about fixes here.
2. SQLite3
No action needed.
3. FFMPEG
You should already have ffmpeg.
#### Environment setup
1. If you are on Windows 7, you cannot run Qt6, so you want 'setup_venv_qt5.bat'.
2. If you are on Windows 8 or newer, go for 'setup_venv.bat'.
=== "Windows"
Just double-click the batch file, and it will take you through the setup. It should take a minute to download and a couple minutes to install. If it seems like it hung, just give it time to finish. It'll say 'Done!' when it is done.
1. If you are on Windows 7, you want 'setup_venv_advanced.bat'.
2. Everyone else go for 'setup_venv.bat'.
Just double-click the file.
If something messes up, or you want to switch between Qt5/Qt6, just run the batch again and you will have an option to reinstall everything. Everything these scripts do ends up in the 'venv' directory, so you can also just delete that folder to 'uninstall'. It should 'just work' on most normal computers, but let me know if you have any trouble.
=== "Linux"
Then run 'setup_help.bat' to build the help. This isn't necessary, but it is nice to have it built locally. You can run this again at any time to rebuild the current help.
1. If you are on or below Ubuntu 20.04 or equivalent, or are otherwise stuck with an older mpv version, you want 'setup_venv_advanced.sh'.
2. Everyone else go for 'setup_venv.sh'.
You might be able to double-click the file. Otherwise, open a terminal in the folder and type:
`. setup_venv.sh`
=== "macOS"
I do not know which versions of macOS are unable to run Qt6, so you probably want to try setup_venv.command, and if that fails, experiment with setup_venv_advanced.command. Try Qt5 and the other older libraries first, then test the newer ones later.
Please let me know what you discover.
The setup should take a minute to download its packages and a couple minutes to install them. Do not close it until it is finished installing everything and says 'Done!'. If it seems like it hung, just give it time to finish.
!!! info "Advanced Setup"
The advanced setup script allows you to choose between old or newer versions of several libraries:
1. Qt: Win 7 and Ubuntu 18.04 equivalents should go for Qt5, everyone else Qt6.
2. mpv: Win 7 and Ubuntu 20.04 equivalents should go for the old one, everyone else the new.
3. OpenCV: Does not matter much, but Python 3.10 users may need the new.
If something messes up, or you want to switch between Qt5/Qt6, just run the setup script again and it will reinstall everything. Everything these scripts do ends up in the 'venv' directory, so you can also just delete that folder to 'uninstall'. It should _just work_ on most normal computers, but let me know if you have any trouble.
Then run the 'setup_help' script to build the help. This isn't necessary, but it is nice to have it built locally. You can run this again at any time to rebuild the current help.
#### Running it
Then run 'client.bat' to start the client. The first start will take a little longer. It will operate just like a normal build, putting your database in the 'db' directory.
=== "Windows"
If you want to redirect your database or use any other launch arguments, then copy 'client.bat' to 'client-user.bat' and edit it, inserting your desired db path. Run this instead of 'client.bat'. New `git pull` commands will not affect 'client-user.bat'.
Run 'client.bat' to start the client.
You probably can't pin your .bat file to your Taskbar or Start (and if you try and pin the running program to your taskbar, its icon may revert to Python), but you can make a shortcut to the .bat file, pin that to Start, and in its properties set a custom icon. There's a nice hydrus one in `install_dir/static`.
=== "Linux"
## Simple Windows Updating Guide
Run 'client.sh' to start the client.
=== "macOS"
Run 'client.command' to start the client.
The first start will take a little longer. It will operate just like a normal build, putting your database in the 'db' directory.
!!! warning "Missing a Library"
If the client fails to boot, it should place a 'hydrus_crash.log' in your 'db' directory or your desktop, or, if it got far enough, it may write the error straight to the 'client - date.log' file in your db directory.
If that error talks about a missing library, then try reinstalling your venv. Are you sure it finished correctly? Are you sure you have the correct Qt version?
=== "Windows"
If you want to redirect your database or use any other launch arguments, then copy 'client.bat' to 'client-user.bat' and edit it, inserting your desired db path. Run this instead of 'client.bat'. New `git pull` commands will not affect 'client-user.bat'.
You probably can't pin your .bat file to your Taskbar or Start (and if you try and pin the running program to your taskbar, its icon may revert to Python), but you can make a shortcut to the .bat file, pin that to Start, and in its properties set a custom icon. There's a nice hydrus one in `install_dir/static`.
=== "Linux"
If you want to redirect your database or use any other launch arguments, then copy 'client.sh' to 'client-user.sh' and edit it, inserting your desired db path. Run this instead of 'client.sh'. New `git pull` commands will not affect 'client-user.sh'.
=== "macOS"
If you want to redirect your database or use any other launch arguments, then copy 'client.command' to 'client-user.command' and edit it, inserting your desired db path. Run this instead of 'client.command'. New `git pull` commands will not affect 'client-user.command'.
## Simple Updating Guide
To update, you do the same thing as for the extract builds.
1. If you installed by extracting the source zip, then download the [latest release](https://github.com/hydrusnetwork/hydrus/releases/latest) source zip and extract it over the top of the folder you have, overwriting the existing source files.
2. If you installed with git, then just run `git pull` as normal. I added a 'git_pull.bat' file to do it with a couple clicks.
2. If you installed with git, then just run `git pull` as normal.
It is worth running 'setup_venv.bat' or 'setup_venv_qt5.bat' again every now and then just to stay up to date with any version changes. It will give you an option to update, which typically only takes a couple of seconds.
If you get a library version error when you try to boot, run the venv setup again. It is worth doing this anyway, every now and then, just to stay up to date.
## doing it manually { id="what_you_need" }
_This is for advanced users only._
I hope to have similar easy-setup scripts for Linux and macOS soon. For now, if this is you, you will have to do it manually. If you are comfortable, check out the 'setup_venv' scripts to see what is going on under the hood.
Inside the extract should be client.py and server.py. You will be treating these basically the same as the 'client' and 'server' executables--you should be able to launch them the same way and they take the same launch parameters as the exes.
Hydrus needs a whole bunch of libraries, so let's now set your python up. I strongly recommend you create a virtual environment.
Hydrus needs a whole bunch of libraries, so let's now set your python up. I **strongly** recommend you create a virtual environment. It is easy and doesn't mess up your system python.
_Note, if you are on Linux and you have trouble with venv, it may be easier to use your package manager instead. A user has written a great summary with all needed packages [here](running_from_source_linux_packages.txt)._
To create a new venv environment:
* (navigate to your hydrus extract folder in a terminal)
* ```pip3 install virtualenv``` (if you need it)
* `pip3 install wheel` (if you need it)
* `python3 -m venv venv`
* `. venv/bin/activate`
* Open a terminal at your hydrus extract folder.
* `pip3 install virtualenv` (if you need it)
* `python3 -m venv venv`
* `source venv/bin/activate`
* `python -m pip install --upgrade pip`
* `pip3 install --upgrade wheel`
That `. venv/bin/activate` line turns on your venv, which is an isolated copy of python that you can install modules to without worrying about breaking something system-wide, and will be needed every time you run the `client.py`/`server.py` files. You should see your terminal note you are now in the venv. You can easily tuck this venv activation line into a launch script.
That `source venv/bin/activate` line turns on your venv, which is an isolated copy of python that you can install modules to without worrying about breaking something system-wide. This line will be needed every time you run the `client.py`/`server.py` files. You should see your terminal note you are now in the venv. You can easily tuck this venv activation line into a launch script--check the easy setup files for examples.
On Windows Powershell, the command is `.\venv\Scripts\activate`, but you may find the whole deal is done much easier in cmd than Powershell. When in Powershell, just type `cmd` to get an old fashioned command line. In cmd, the launch command is just `venv\scripts\activate.bat`, no leading period.
After you have activated the venv, you can use pip to install everything you need to it from the appropriate requirements.txt in the base install directory. If you are on an older OS that cannot run Qt6, use the 'qt5' version. Otherwise:
After you have activated the venv, you can use pip to install everything you need to it from the requirements.txt in the install_dir:
```
pip install -r requirements.txt
```
If you prefer to do things manually, inspect the document and install the modules yourself.
There are some '_build' variants of the requirements.txts. You can ignore these unless you intend to make your own frozen build like the official releases.
## building packages on windows { id="windows_build" }
Almost everything is provided as pre-compiled 'wheels' these days, but if you get an error about Visual Studio C++ when you try to pip something, it may be you need that compiler tech.
You also need this if you want to build a frozen release locally.
Although these tools are free, it can be a pain to get them through the official (and often huge) downloader installer from Microsoft. Instead, install [Chocolatey](https://chocolatey.org/) and use this one simple line:
```
choco install -y vcbuildtools visualstudio2017buildtools
```
Trust me, just do this, it will save a ton of headaches!
This can also be helpful for Windows 10 python work generally:
```
choco install -y windows-sdk-10.0
```
You can also pick and choose from the other advanced requirements. Check and compare their contents to the main requirements.txt to see what is going on.
## Qt { id="qt" }
@ -152,13 +229,7 @@ If you want to set QT_API in a batch file, do this:
`set QT_API=pyqt6`
If you run Windows 7, you cannot run Qt6. Please try PySide2 or PyQt5.
## FFMPEG { id="ffmpeg" }
If you don't have FFMPEG in your PATH and you want to import anything more fun than jpegs, you will need to put a static [FFMPEG](https://ffmpeg.org/) executable in your PATH or the `install_dir/bin` directory. [This](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) should always point to a new build.
Alternately, you can just copy the exe from one of my extractable Windows releases.
If you run Windows 7 or Ubuntu 18.04, you cannot run Qt6. Please try PySide2 or PyQt5.
## mpv support { id="mpv" }
@ -188,9 +259,35 @@ You can also just grab the 'sqlite3.dll' I bundle in my extractable Windows rele
I don't know how to do this for Linux or macOS, so if you do, please let me know!
!!! info "Extremely safe no way it can go wrong"
!!! warning "Extremely safe no way it can go wrong"
If you want to update sqlite for your system python install, you can also drop it into `C:\Python38\DLLs` or wherever you have python installed. You'll be overwriting the old file, so make a backup if you want to (I have never had trouble updating like this, however).
## FFMPEG { id="ffmpeg" }
If you don't have FFMPEG in your PATH and you want to import anything more fun than jpegs, you will need to put a static [FFMPEG](https://ffmpeg.org/) executable in your PATH or the `install_dir/bin` directory. [This](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) should always point to a new build.
Alternately, you can just copy the exe from one of my extractable Windows releases.
## building packages on windows { id="windows_build" }
Almost everything is provided as pre-compiled 'wheels' these days, but if you get an error about Visual Studio C++ when you try to pip something, it may be you need that compiler tech.
You also need this if you want to build a frozen release locally.
Although these tools are free, it can be a pain to get them through the official (and often huge) downloader installer from Microsoft. Instead, install [Chocolatey](https://chocolatey.org/) and use this one simple line:
```
choco install -y vcbuildtools visualstudio2017buildtools
```
Trust me, just do this, it will save a ton of headaches!
This can also be helpful for Windows 10 python work generally:
```
choco install -y windows-sdk-10.0
```
## additional windows info { id="additional_windows" }
This does not matter much any more, but in the old days, Windows pip could have problems building modules like lz4 and lxml, and Visual Studio was tricky to get working. [This page](http://www.lfd.uci.edu/~gohlke/pythonlibs/) has a lot of prebuilt binaries--I have found it very helpful many times.
@ -202,7 +299,7 @@ I have a fair bit of experience with Windows python, so send me a mail if you ne
Once you have everything set up, client.py and server.py should look for and run off client.db and server.db just like the executables. They will look in the 'db' directory by default, or anywhere you point them with the "-d" parameter, again just like the executables. Explictly, you will be entering something like this in the terminal:
```
. venv/bin/activate
source venv/bin/activate
python client.py -d="/path/to/database"
```

7
git_pull.command Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
git pull
Done!
read

7
git_pull.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
git pull
Done!
read

17
open_venv.bat Normal file
View File

@ -0,0 +1,17 @@
@ECHO off
IF EXIST "venv\" goto :venv_exists
goto :venv_missing
:venv_exists
start venv\Scripts\activate.bat
goto :done
:venv_missing
SET /P done=Sorry, you do not seem to have a venv!
:done

View File

@ -19,10 +19,5 @@ service-identity>=18.1.0
six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==1.0.1
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1
PySide2==5.15.2.1

1
requirements_new_mpv.txt Normal file
View File

@ -0,0 +1 @@
python-mpv==1.0.1

View File

@ -0,0 +1 @@
opencv-python-headless==4.5.5.64

View File

@ -1,28 +1 @@
cbor2
python-dateutil
beautifulsoup4>=4.0.0
chardet>=3.0.4
cloudscraper>=1.2.33
html5lib>=1.0.1
lxml>=4.5.0
lz4>=3.0.0
nose>=1.3.0
numpy>=1.16.0
Pillow>=6.0.0
psutil>=5.0.0
pyOpenSSL>=19.1.0
PySocks>=1.7.0
PyYAML>=5.0.0
Send2Trash>=1.5.0
service-identity>=18.1.0
six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==0.5.2
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1
PySide6==6.3.2

View File

@ -0,0 +1 @@
opencv-python-headless==4.5.3.56

View File

@ -1,28 +1,2 @@
cbor2
python-dateutil
beautifulsoup4>=4.0.0
chardet>=3.0.4
cloudscraper>=1.2.33
html5lib>=1.0.1
lxml>=4.5.0
lz4>=3.0.0
nose>=1.3.0
numpy>=1.16.0
Pillow>=6.0.0
psutil>=5.0.0
pyOpenSSL>=19.1.0
PySocks>=1.7.0
PyYAML>=5.0.0
Send2Trash>=1.5.0
service-identity>=18.1.0
six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==1.0.1
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1
PySide2==5.15.2.1

2
requirements_qt6.txt Normal file
View File

@ -0,0 +1,2 @@
QtPy==2.2.1
PySide6==6.3.2

25
setup_help.command Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
if [ ! -d "venv" ]; then
echo "You need to set up a venv! Check the running from source help for more info!"
exit 1
fi
if [ -d "help" ]; then
echo "Deleting old help..."
rm -rf help
fi
echo "Creating new help..."
source venv/bin/activate
pip install mkdocs-material
mkdocs build -d help
deactivate
echo "Done!"
read

25
setup_help.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
if [ ! -d "venv" ]; then
echo "You need to set up a venv! Check the running from source help for more info!"
exit 1
fi
if [ -d "help" ]; then
echo "Deleting old help..."
rm -rf help
fi
echo "Creating new help..."
source venv/bin/activate
pip install mkdocs-material
mkdocs build -d help
deactivate
echo "Done!"
read

View File

@ -8,13 +8,7 @@ goto :create
:venv_exists
SET /P install_type=venv folder already exists. Do you want to: (r)einstall, (u)pdate?
IF "%install_type%" == "r" goto :delete
IF "%install_type%" == "u" goto :update
goto :done
:delete
SET /P Virtual environment will be reinstalled. Hit Enter to start.
echo Deleting old venv...
@ -26,8 +20,6 @@ echo Creating new venv...
python -m venv venv
:update
CALL venv\Scripts\activate.bat
python -m pip install --upgrade pip
@ -38,6 +30,9 @@ pip3 install -r requirements.txt
CALL venv\Scripts\deactivate.bat
SET /P done=Done!
goto :done
:done
SET /P done=Done!

28
setup_venv.command Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
if [ -d "venv" ]; then
echo "Virtual environment will be reinstalled. Hit Enter to start."
read
echo "Deleting old venv..."
rm -rf venv
else
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
read
fi
echo "Creating new venv..."
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements.txt
deactivate
echo "Done!"
read

28
setup_venv.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
if [ -d "venv" ]; then
echo "Virtual environment will be reinstalled. Hit Enter to start."
read
echo "Deleting old venv..."
rm -rf venv
else
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
read
fi
echo "Creating new venv..."
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements.txt
deactivate
echo "Done!"
read

76
setup_venv_advanced.bat Normal file
View File

@ -0,0 +1,76 @@
@ECHO off
IF EXIST "venv\" goto :venv_exists
SET /P ready=If you do not have Python 3 installed yet, check the 'running from source' help. Hit Enter to start.
goto :questions
:venv_exists
SET /P install_type=Virtual environment will be reinstalled. Hit Enter to start.
echo Deleting old venv...
rmdir /s /q venv
:questions
SET /P qt=Do you want Qt(5) or Qt(6)?
IF "%qt%" == "5" goto :qt_ok
IF "%qt%" == "6" goto :qt_ok
goto :parse_fail
:qt_ok
SET /P mpv=Do you want (o)ld mpv or (n)ew mpv?
IF "%mpv%" == "o" goto :mpv_ok
IF "%mpv%" == "n" goto :mpv_ok
goto :parse_fail
:mpv_ok
SET /P opencv=Do you want (o)ld OpenCV or (n)ew OpenCV?
IF "%opencv%" == "o" goto :opencv_ok
IF "%opencv%" == "n" goto :opencv_ok
goto :parse_fail
:opencv_ok
:create
echo Creating new venv...
python -m venv venv
CALL venv\Scripts\activate.bat
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements_core.txt
IF "%qt%" == "5" pip3 install -r requirements_qt5.txt
IF "%qt%" == "6" pip3 install -r requirements_qt6.txt
IF "%mpv%" == "o" pip3 install -r requirements_old_mpv.txt
IF "%mpv%" == "n" pip3 install -r requirements_new_mpv.txt
IF "%opencv%" == "o" pip3 install -r requirements_old_opencv.txt
IF "%opencv%" == "n" pip3 install -r requirements_new_opencv.txt
CALL venv\Scripts\deactivate.bat
goto :done
:parse_fail
echo Sorry, did not understand that input!
:done
SET /P done=Done!

View File

@ -0,0 +1,79 @@
#!/bin/bash
if [ -d "venv" ]; then
echo "Virtual environment will be reinstalled. Hit Enter to start."
read
echo "Deleting old venv..."
rm -rf venv
else
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
read
fi
echo "Do you want Qt(5) or Qt(6)? "
read qt
if [ $qt = "5" ]; then
:
elif [ $qt = "6" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Do you want (o)ld mpv or (n)ew mpv? "
read mpv
if [ $mpv = "o" ]; then
:
elif [ $mpv = "n" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Do you want (o)ld OpenCV or (n)ew OpenCV? "
read opencv
if [ $opencv = "o" ]; then
:
elif [ $opencv = "n" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Creating new venv..."
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements_core.txt
if [ $qt = "5" ]; then
pip3 install -r requirements_qt5.txt
elif [ $qt = "6" ]; then
pip3 install -r requirements_qt6.txt
fi
if [ $mpv = "o" ]; then
pip3 install -r requirements_old_mpv.txt
elif [ $mpv = "n" ]; then
pip3 install -r requirements_new_mpv.txt
fi
if [ $opencv = "o" ]; then
pip3 install -r requirements_old_opencv.txt
elif [ $opencv = "n" ]; then
pip3 install -r requirements_new_opencv.txt
fi
deactivate
echo "Done!"
read

79
setup_venv_advanced.sh Normal file
View File

@ -0,0 +1,79 @@
#!/bin/bash
if [ -d "venv" ]; then
echo "Virtual environment will be reinstalled. Hit Enter to start."
read
echo "Deleting old venv..."
rm -rf venv
else
echo "If you do not know what this is, check the 'running from source' help. Hit Enter to start."
read
fi
echo "Do you want Qt(5) or Qt(6)? "
read qt
if [ $qt = "5" ]; then
:
elif [ $qt = "6" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Do you want (o)ld mpv or (n)ew mpv? "
read mpv
if [ $mpv = "o" ]; then
:
elif [ $mpv = "n" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Do you want (o)ld OpenCV or (n)ew OpenCV? "
read opencv
if [ $opencv = "o" ]; then
:
elif [ $opencv = "n" ]; then
:
else
echo "Sorry, did not understand that input!"
exit 1
fi
echo "Creating new venv..."
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements_core.txt
if [ $qt = "5" ]; then
pip3 install -r requirements_qt5.txt
elif [ $qt = "6" ]; then
pip3 install -r requirements_qt6.txt
fi
if [ $mpv = "o" ]; then
pip3 install -r requirements_old_mpv.txt
elif [ $mpv = "n" ]; then
pip3 install -r requirements_new_mpv.txt
fi
if [ $opencv = "o" ]; then
pip3 install -r requirements_old_opencv.txt
elif [ $opencv = "n" ]; then
pip3 install -r requirements_new_opencv.txt
fi
deactivate
echo "Done!"
read

View File

@ -1,43 +0,0 @@
@ECHO off
IF EXIST "venv\" goto :venv_exists
SET /P ready=If you do not have Python 3 installed yet, check the 'running from source' help. Hit Enter to start.
goto :create
:venv_exists
SET /P install_type=venv folder already exists. Do you want to: (r)einstall, (u)pdate?
IF "%install_type%" == "r" goto :delete
IF "%install_type%" == "u" goto :update
goto :done
:delete
echo Deleting old venv...
rmdir /s /q venv
:create
echo Creating new venv...
python -m venv venv
:update
CALL venv\Scripts\activate.bat
python -m pip install --upgrade pip
pip3 install --upgrade wheel
pip3 install -r requirements_qt5.txt
CALL venv\Scripts\deactivate.bat
SET /P done=Done!
:done

View File

@ -20,7 +20,7 @@ six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==1.0.1
python-mpv==0.5.2
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1

View File

@ -1,31 +0,0 @@
cbor2
python-dateutil
beautifulsoup4>=4.0.0
chardet>=3.0.4
cloudscraper>=1.2.33
html5lib>=1.0.1
lxml>=4.5.0
lz4>=3.0.0
nose>=1.3.0
numpy>=1.16.0
Pillow>=6.0.0
psutil>=5.0.0
pyOpenSSL>=19.1.0
PySocks>=1.7.0
PyYAML>=5.0.0
Send2Trash>=1.5.0
service-identity>=18.1.0
six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==1.0.1
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1
PySide2==5.15.2.1
pyinstaller==5.5
mkdocs-material

View File

@ -1,59 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
import cloudscraper
import shiboken2
import os
import glob
cloudscraper_dir = os.path.dirname( cloudscraper.__file__ )
shiboken_dir = os.path.join( os.path.dirname( shiboken2.__file__ ), 'files.dir' )
block_cipher = None
a = Analysis(['hydrus\\client.pyw'],
pathex=['.'],
binaries=[],
datas=[
('hydrus\\bin', 'bin'),
('hydrus\\help', 'help'),
('hydrus\\static', 'static'),
('dist\\server\\server.exe*', '.'),
('hydrus\\license.txt', '.'),
('hydrus\\README.md', '.'),
('hydrus\\help my client will not boot.txt', '.'),
('hydrus\\db', 'db'),
('hydrus\\hydrus', 'hydrus'),
('hydrus\\sqlite3.dll', '.'),
('hydrus\\mpv-1.dll', '.'),
(cloudscraper_dir, 'cloudscraper'),
(shiboken_dir, 'shiboken2\\files.dir')
],
hiddenimports=['hydrus\\server.py', 'cloudscraper'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='client',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
icon='hydrus\\static\\hydrus.ico' )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name='Hydrus Network')

View File

@ -1,36 +0,0 @@
cbor2
python-dateutil
beautifulsoup4>=4.0.0
chardet>=3.0.4
cloudscraper>=1.2.33
html5lib>=1.0.1
lxml>=4.5.0
lz4>=3.0.0
nose>=1.3.0
numpy>=1.16.0
Pillow>=6.0.0
psutil>=5.0.0
pyOpenSSL>=19.1.0
PySocks>=1.7.0
PyYAML>=5.0.0
Send2Trash>=1.5.0
service-identity>=18.1.0
six>=1.14.0
Twisted>=20.3.0
opencv-python-headless==4.5.3.56
python-mpv==1.0.1
QtPy==2.2.1
requests==2.28.1
setuptools==65.4.1
PySide2==5.15.2.1
pyinstaller==5.5
mkdocs-material
PyWin32
pypiwin32
pywin32-ctypes
pefile