Skip to main content

Dakara Feeder

PyPI version PyPI Python versions License Tests status Code coverage status Code style: black Imports: isort

Allows to feed the database of the Dakara server remotely.

Installation

This repo is tied with the Dakara server, so you should setup it first:

Other important parts of the project include:

System requirements

  • Python3, to make everything up and running (supported versions: see above);
  • ffmpeg, to extract lyrics and extract metadata from files (preferred way);
  • MediaInfo, to extract metadata from files (slower, alternative way).

Linux, Windows, and MacOS are supported.

Virtual environment

It is strongly recommended to use the Dakara feeder within a virtual environment.

Install

Please ensure you have a recent enough version of setuptools:

pip install --upgrade "setuptools>=46.4.0"

Install the package with:

pip install dakarafeeder

If you have downloaded the repo, you can install the package directly with:

pip install .

Usage

Commands

The package provides the dakara-feeder feed command for creating data on a running instance of the Dakara server. Several sub-commands are available. To begin, dakara-feeder feed songs will find songs in the configured directory, parse them and send their data:

dakara-feeder feed songs
# or
python -m dakara_feeder feed songs

One instance of the Dakara server should be running.

The data extracted from songs are very limited in this package by default, as data can be stored in various ways. You are encouraged to make your own parser (see this section for more details).

Then, dakara-feeder feed tags and dakara-feeder feed work-types will find tags and work types in a YAML file (see this section for more details):

dakara-feeder feed tags path/to/tags.yaml
# or
python -m dakara_feeder feed tags path/to/tags.yaml

and:

dakara-feeder feed work-types path/to/work_types.yaml
# or
python -m dakara_feeder feed work-types path/to/work_types.yaml

Also, dakara-feeder feed works will find works in a JSON file (see this section for more details):

dakara-feeder feed works path/to/works.json
# or
python -m dakara_feeder feed works path/to/works.json

For more help:

dakara-feeder -h
# or
python -m dakara_feeder -h

Before calling any command, you should create a config file with:

dakara-feeder create-config
# or
python -m dakara_feeder create-config

and complete it with your values. The file is stored in your user space: ~/.config/dakara on Linux, or $APPDATA\DakaraProject\dakara on Windows.

Configuration

The configuration is created with the previously cited command. Several aspect of the feeder can be configured with this file. Please check with the file documentation.

Authentication to the server can be done with username and password, or with a token that can be copied from the web client. Please note that only a library manager can use the feeder.

Making a custom parser

To override the extraction of data from song files, you should create a class derived from dakara_feeder.song.BaseSong. Please refer to the documentation of this class to learn which methods to override, and what attributes and helpers are at your disposal.

Here is a basic example. It considers that the song video file is formatted in the way "title - main artist.ext":

# my_song.py
from dakara_feeder.song import BaseSong

class Song(BaseSong):
    def get_title(self):
        return self.video_path.stem.split(" - ")[0]

    def get_artists(self):
        return [{"name": self.video_path.stem.split(" - ")[1]}]

To register your customized Song class, you simply indicate it in the configuration file. You can either indicate an importable module or a file:

custom_song_class: path/to/my_song.py::Song
# or
custom_song_class: my_song.Song

Now, dakara-feeder will use your customized Song class instead of the default one.

Tags and work types file

Whilst data from songs are extracted directly from song files, data from tags and work types are extracted from a YAML file. All data can coexist in the same file.

Tags

Tags will be searched in the key tags. Tags are identified by their name (it will be displayed in upper case, it should be just one word). You can provide a color hue (positive integer from 0 to 360):

tags:
  - name: PV
    color_hue: 162
  - name: AMV
    color_hue: 140

Work types

Work types will be searched in the key worktypes Work types are identified by their query name (hyphenated name, with no special characters, used as keyword for querying). You can provide a work type display name (singular and plural) and an icon name (choosen among the FontAwesome font glyphes):

worktypes:
  - query_name: anime
    name: Anime
    name_plural: Animes
    icon_name: television
  - query_name: live-action
    name: Live action
    name_plural: Live actions
    icon_name: film

Works file

You can provide more information about works (especially alternative names) from a JSON file. The file should contain a dictionary where keys are work types query name and values lists of works representation:

{
  "work_type_1":
    [
      {
        "title": "Work 1",
        "subtitle": "Subtitle 1",
        "alternative_titles": [
          {
            "title": "AltTitle 1"
          },
          {
            "title": "AltTitle 2"
          }
        ]
      },
      {
        "title": "Work 2",
        "subtitle": "Subtitle 2"
      }
    ],
  "work_type_2": []
}

Identification with existing works on the server is made with the work type, the title and the subtitle, case insensitively.

Development

Please read the developers documentation.

Metadata

Release files for dakarafeeder 1.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dakarafeeder 1.10.0
File Size Uploaded Provenance
dakarafeeder-1.10.0.tar.gz 52.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dakarafeeder 1.10.0
File Interpreter ABI Platform
dakarafeeder-1.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 87.7 kB

Release files / dakarafeeder-1.10.0.tar.gz

Download URL dakarafeeder-1.10.0.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
14c9c2dc59b61c37f9cef33acf31e46e27a87ca8ae7fde4650d10b70f4f5e692
BLAKE2b-256 checksum
How to use checksums
42b0d0015de2fe83411a26a32de9f86f221ca5db361c0ab692d9e0afaa99d872
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dakarafeeder-1.10.0-py3-none-any.whl

Download URL dakarafeeder-1.10.0-py3-none-any.whl
Size 35.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b95055b23695f016f5643b9cfb223369f95d8c84a24611746708d87d710b5ce
BLAKE2b-256 checksum
How to use checksums
afe1d1a8701cbbf35a1ac72a9752bb828b2689db8761ff5049f088e7df773162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for dakarafeeder 1.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page