| 1 | /* |
| 2 | * HTTPDirFS - HTTP Directory Filesystem |
| 3 | * |
| 4 | * Copyright (C) 2020-2026 Fufu Fang <[email protected]> |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * In addition, as a special exception, the copyright holders give |
| 20 | * permission to link the code of portions of this program with the OpenSSL |
| 21 | * library. |
| 22 | */ |
| 23 | |
| 24 | #ifndef SONIC_H |
| 25 | #define SONIC_H |
| 26 | /** |
| 27 | * \file sonic.h |
| 28 | * \brief Airsonic / Subsonic server API integration header |
| 29 | */ |
| 30 | |
| 31 | typedef struct { |
| 32 | /** |
| 33 | * \brief Sonic id field |
| 34 | * \details This is used to store the following: |
| 35 | * - Arist ID |
| 36 | * - Album ID |
| 37 | * - Song ID |
| 38 | * - Sub-directory ID (in the XML response, this is the ID on the "child" |
| 39 | * element) |
| 40 | */ |
| 41 | char *id; |
| 42 | /** |
| 43 | * \brief Sonic directory depth |
| 44 | * \details This is used exclusively in ID3 mode to store the depth of the |
| 45 | * current directory. |
| 46 | */ |
| 47 | int depth; |
| 48 | } Sonic; |
| 49 | |
| 50 | typedef struct LinkTable LinkTable; |
| 51 | |
| 52 | /** |
| 53 | * \brief Initialise Sonic configuration. |
| 54 | */ |
| 55 | void sonic_config_init(const char *server, const char *username, |
| 56 | const char *password); |
| 57 | |
| 58 | /** |
| 59 | * \brief Create a new Sonic LinkTable in index mode |
| 60 | */ |
| 61 | LinkTable *sonic_LinkTable_new_index(const char *id); |
| 62 | |
| 63 | /** |
| 64 | * \brief Create a new Sonic LinkTable in ID3 mode |
| 65 | * \details In this mode, the filesystem effectively has 5 levels of which are: |
| 66 | * 0. Root table |
| 67 | * 1. Index table |
| 68 | * 2. Artist table |
| 69 | * 3. Album table |
| 70 | * 4. Song table |
| 71 | * 5. Individual song (not a table) |
| 72 | * \param[in] depth the level of the requested table |
| 73 | * \param[in] id the id of the requested table |
| 74 | */ |
| 75 | LinkTable *sonic_LinkTable_new_id3(int depth, const char *id); |
| 76 | |
| 77 | #endif |