Skip to content

Commit

Permalink
Changed add-on name to tools.plocate.search as suggested by 'chewitt'
Browse files Browse the repository at this point in the history
- v0.2.0
  • Loading branch information
plinkr committed Jun 19, 2024
1 parent 3a1c89a commit f850f17
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add-on for LibreELEC/Kodi `plocate Search`

`plocate Search` | `script.plocate.search` is a LibreELEC/Kodi add-on designed to provide efficient offline search functionality for your multimedia library. By leveraging [`plocate`](https://plocate.sesse.net/) and [`updatedb`](https://plocate.sesse.net/), this add-on allows you to quickly locate files within your library, even when offline. The add-on integrates seamlessly with Kodi, offering an intuitive graphical interface for searching and navigating your media files.
`plocate Search` | `tools.plocate.search` is a LibreELEC/Kodi add-on designed to provide efficient offline search functionality for your multimedia library. By leveraging [`plocate`](https://plocate.sesse.net/) and [`updatedb`](https://plocate.sesse.net/), this add-on allows you to quickly locate files within your library, even when offline. The add-on integrates seamlessly with Kodi, offering an intuitive graphical interface for searching and navigating your media files.

## Table of Contents

Expand All @@ -25,12 +25,12 @@
## Installation

1. **Download the Add-on:**
- Download the `script.plocate.search.zip` file from the releases section of this repository.
- Download the `tools.plocate.search.zip` file from the releases section of this repository.

2. **Install via Kodi:**
- Open Kodi and navigate to `Add-ons`.
- Select `Install from zip file`.
- Locate and select the downloaded `script.plocate.search.zip` file.
- Locate and select the downloaded `tools.plocate.search.zip` file.
- Wait for the add-on installed notification.

3. **Post-Installation Script:**
Expand Down Expand Up @@ -60,7 +60,7 @@

- **Index Management:**
- The add-on automatically handles index updates for connected storage devices.
- Indexes are stored in `/storage/.kodi/addons/script.plocate.search/resources/databases/`.
- Indexes are stored in `/storage/.kodi/addons/tools.plocate.search/resources/databases/`.
- Each index is named after the UUID of the storage device partition, ensuring uniqueness for every drive you connect to your LibreELEC device.

## Dependencies
Expand All @@ -73,7 +73,7 @@ Provided in this repo are the binaries of `plocate` and `updatedb` version `1.1.

## Contributing

We welcome contributions to `script.plocate.search`. To contribute:
We welcome contributions to `tools.plocate.search`. To contribute:

1. Fork the repository.
2. Create a new branch with a descriptive name and change what you want.
Expand All @@ -99,15 +99,15 @@ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file

Developed on a Raspberry Pi 4 with **LibreELEC 12.0.0** and **Kodi 21.0.0**, `plocate` scans and builds the index of a 5TB disk filled with multimedia (containing 17,502 files) in about 12 seconds on the first run:
```
LibreELEC:~ # time /storage/.kodi/addons/script.plocate.search/resources/lib/updatedb --database-root /var/media/easystore/ --output /storage/plinkr/plocate/plocate.db
LibreELEC:~ # time /storage/.kodi/addons/tools.plocate.search/resources/lib/updatedb --database-root /var/media/easystore/ --output /storage/plinkr/plocate/plocate.db
real 0m 12.10s
user 0m 0.64s
sys 0m 0.23s
```

Subsequent runs are faster, taking less than 1 second (depending on file changes):
```
LibreELEC:~ # time /storage/.kodi/addons/script.plocate.search/resources/lib/updatedb --database-root /var/media/easystore/ --output /storage/plinkr/plocate/plocate.db
LibreELEC:~ # time /storage/.kodi/addons/tools.plocate.search/resources/lib/updatedb --database-root /var/media/easystore/ --output /storage/plinkr/plocate/plocate.db
real 0m 0.77s
user 0m 0.54s
sys 0m 0.23s
Expand Down
11 changes: 7 additions & 4 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.plocate.search" name="plocate Search" version="0.1.0" provider-name="plinkr">
<addon id="tools.plocate.search" name="plocate Search" version="0.2.0" provider-name="plinkr">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
Expand Down Expand Up @@ -67,12 +67,15 @@
<description lang="zh_CN">此插件可以使用plocate离线搜索您的视频和音乐资料库中的任何项目。</description>
<platform>linux</platform>
<license>MIT License</license>
<forum>https://github.com/plinkr/script.plocate.search/issues</forum>
<source>https://github.com/plinkr/script.plocate.search</source>
<forum>https://github.com/plinkr/tools.plocate.search/issues</forum>
<source>https://github.com/plinkr/tools.plocate.search</source>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.png</fanart>
</assets>
<news>- First concept version, still in Beta</news>
<news>- 0.2.0
- Renamed add-on to 'tools.plocate.search' as recommended by 'chewitt'
- 0.1.0
- First concept version, still in Beta</news>
</extension>
</addon>
8 changes: 4 additions & 4 deletions resources/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Define the path to the script that creates the index
script_path = "/storage/.kodi/addons/script.plocate.search/resources/scripts/update_index.sh"
script_path = "/storage/.kodi/addons/tools.plocate.search/resources/scripts/update_index.sh"
# Define the path to `plocate`
plocate_path = "/storage/.kodi/addons/script.plocate.search/resources/lib/plocate"
plocate_path = "/storage/.kodi/addons/tools.plocate.search/resources/lib/plocate"
# Define the path to `updatedb`
updatedb_path = "/storage/.kodi/addons/script.plocate.search/resources/lib/updatedb"
updatedb_path = "/storage/.kodi/addons/tools.plocate.search/resources/lib/updatedb"
# Define the directory of the databases
database_dir = "/storage/.kodi/addons/script.plocate.search/resources/databases/"
database_dir = "/storage/.kodi/addons/tools.plocate.search/resources/databases/"
2 changes: 1 addition & 1 deletion resources/lib/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def make_binary_file_executable(path_to_binary_file):
def create_udev_rules_if_not_exists():
# Check if the udev rules file exists
if not os.path.exists("/storage/.config/udev.rules.d/95-udevil-mount.rules"):
# If doesn't exists, call the function to create it
# If doesn't exist, call the function to create it
copy_and_modify_udevil_rules(script_path)


Expand Down
Binary file removed resources/lib/plocate
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/lib/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def search_files(options, query):

if not database_files:
raise FileNotFoundError(
"No databases found in the addon `script.plocate.search/resources/databases/` directory.\n"
f"No databases found in the addon `{database_dir}` directory.\n"
"Try reconnecting the device.")

# Create the variable database_path with the full path of the files separated by ':'
Expand Down
Binary file removed resources/lib/updatedb
Binary file not shown.
6 changes: 3 additions & 3 deletions resources/scripts/update_index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DEVICE=$1

# Ignore partitions belonging to the same SD, e.g., if using multiboot on your rpi
# Ignore partitions belonging to the same SD, e.g., if using multiboot on your RPi
case "$DEVICE" in
"/dev/mmcblk0"*)
exit 0 ;;
Expand All @@ -15,11 +15,11 @@ MOUNT_POINT=$(grep "$DEVICE" /proc/mounts | awk '{print $2}')
UUID=$(blkid -s UUID -o value "$DEVICE")

# Database path
DB_PATH="/storage/.kodi/addons/script.plocate.search/resources/databases/${UUID}.db"
DB_PATH="/storage/.kodi/addons/tools.plocate.search/resources/databases/${UUID}.db"

# Execute updatedb
if [ -n "$MOUNT_POINT" ]; then
/storage/.kodi/addons/script.plocate.search/resources/lib/updatedb --require-visibility no --output "$DB_PATH" --database-root "$MOUNT_POINT"
/storage/.kodi/addons/tools.plocate.search/resources/lib/updatedb --require-visibility no --output "$DB_PATH" --database-root "$MOUNT_POINT"
fi

exit 0

0 comments on commit f850f17

Please sign in to comment.