mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-30 21:15:18 +00:00
feat(music): list and select playlist songs by their position
This commit is contained in:
@@ -271,14 +271,11 @@ server, uses the server's own cache and returns no `cache` field.
|
||||
}
|
||||
```
|
||||
|
||||
Each serialized title carries `type` (`"episode"`, `"movie"`, or `"other"`), `name`, `id`, `language`, `description`, `date`, and `cover_url`. Episodes and movies add `year`. Episodes also add `series_title`, `season`, and `number`.
|
||||
Each serialized title carries `type` (`"episode"`, `"movie"`, `"song"`, or `"other"`), `name`, `id`, `language`, `description`, `date`, and `cover_url`. Episodes and movies add `year`. Episodes also add `series_title`, `season`, and `number`.
|
||||
|
||||
!!! warning "A song serializes as `"other"`"
|
||||
A song has no `type` of its own. The server sends it as `"other"`, and the response
|
||||
carries none of its music fields: no artist, no album, no track or disc number, and no
|
||||
`year`. `name` holds the song name. To read the disc and track numbers of a release,
|
||||
operate the CLI with `--list-titles`. You can still select songs over the API,
|
||||
through the `wanted` parameter.
|
||||
!!! info "The number that `wanted` takes for a song"
|
||||
A song adds `year` and its music fields, such as `artist`, `album`, `disc`, `track` and
|
||||
`position`. `wanted` takes `position` when it is not `null`, else `disc` and `track` as in `"2x3"`.
|
||||
|
||||
These keys are sent only when the title carries them, so a title without them serializes exactly as before:
|
||||
|
||||
@@ -322,7 +319,7 @@ Show the video, audio, and subtitle tracks for a title. For series, you can scop
|
||||
| --- | --- | --- | --- |
|
||||
| `service` | string | yes | Service tag. |
|
||||
| `title_id` | string | yes | Title identifier. |
|
||||
| `wanted` | string / string[] | no | Episode/season range (e.g. `"S01E01-S01E03"`), or a song selector (e.g. `"1-5"`, `"1,3,7"`, or `"2x3"` for disc 2 track 3). A list of selectors is accepted too. |
|
||||
| `wanted` | string / string[] | no | Episode/season range (e.g. `"S01E01-S01E03"`), or a song by its number in the track list (e.g. `"1-5"`, `"1,3,7"`, or `"2x3"` for disc 2 track 3). A list of selectors is accepted too. |
|
||||
| `season` | int/string | no | Season number (combined with `episode`). |
|
||||
| `episode` | int/string | no | Episode number (combined with `season`). |
|
||||
| `part` | int/string | no | Part index of a split episode (combined with `season` and `episode`). |
|
||||
@@ -451,7 +448,7 @@ Make a download job. It requires `service` and `title_id`. Every other field is
|
||||
| `range` | string[] | `["SDR"]` | Dynamic range(s). |
|
||||
| `channels` | number | `null` | Audio channel layout. |
|
||||
| `no_atmos` | boolean | `false` | Exclude Atmos tracks. |
|
||||
| `wanted` | string / string[] | `[]` | Episode/season selectors, as a list or as one comma-separated string. Accepts the part form, `"S01E01.2"`, and the air-date form, `"2026-08-11"` or `"2026-08-01:2026-08-31"`. For a music release, a selector is a track number, `"1-5"` or `"1,3,7"`, or `"{disc}x{track}"` such as `"2x3"`. |
|
||||
| `wanted` | string / string[] | `[]` | Episode/season selectors, as a list or as one comma-separated string. Accepts the part form, `"S01E01.2"`, and the air-date form, `"2026-08-11"` or `"2026-08-01:2026-08-31"`. For a music release, a selector is a number of the track list, `"1-5"` or `"1,3,7"`, or `"{disc}x{track}"` such as `"2x3"`. |
|
||||
| `latest_episode` | boolean | `false` | Only the newest episode. |
|
||||
| `latest_episodes` | integer | `null` | Only the N newest episodes. A positive integer. When set, it overrides `latest_episode`. |
|
||||
| `lang` / `v_lang` / `a_lang` / `s_lang` | string[] | `["orig"]` / `[]` / `[]` / `["all"]` | Language filters. A missing `s_lang` language gives a warning and the job continues. |
|
||||
|
||||
@@ -204,6 +204,12 @@ Each subclass adds its own required fields on top of `id_` and `service`:
|
||||
final audio file under that suffix.
|
||||
You can set these fields in `get_tracks()` too, and a remote client gets them back.
|
||||
|
||||
For a playlist whose songs keep the tags of their own album, give `position` (a positive integer,
|
||||
from 1) to every song. The track list, the download order and `-w` then use that number. The
|
||||
tags, the file name and the folder keep `track`, `disc` and `album`. Set it in `get_titles()`,
|
||||
because a remote client does not read it again after the listing. Such a song also needs an `id` that
|
||||
stays the same in each listing: `position` does not identify it.
|
||||
|
||||
The tagger also falls back to `Song.data` for fields the constructor did not get, such
|
||||
as the composer or a full release date. It reads the top level of that dict and a
|
||||
nested `metadata` sub-dict, with the nested keys winning, so either shape works. The keys
|
||||
|
||||
@@ -122,7 +122,7 @@ unshackle honours the special language tokens `orig`, `all`, and `best` everywhe
|
||||
|
||||
| Flag | Description |
|
||||
|---|---|
|
||||
| `-w`, `--wanted` | Wanted episodes, e.g. `S01-S05,S07`, `S01E01-S02E03`. Supports exclusions with a leading `-` (e.g. `-S03`). For a [split episode](downloading.md#split-episodes), `.N` picks one part (`S01E01.2`), a range must stay inside the episode (`S01E01.1-S01E01.3`), and `S01E01` on its own takes every part. For a [dated episode](downloading.md#daily-and-date-based-content), a token can also be an ISO air date (`2026-08-11`) or a date range with a colon (`2026-08-01:2026-08-31`). For a [music release](downloading.md#music-tracks), a token is a track number (`1-5`, `1,3,7`), or `{disc}x{track}` (`2x3`) when the release has more than one disc. |
|
||||
| `-w`, `--wanted` | Wanted episodes, e.g. `S01-S05,S07`, `S01E01-S02E03`. Supports exclusions with a leading `-` (e.g. `-S03`). For a [split episode](downloading.md#split-episodes), `.N` picks one part (`S01E01.2`), a range must stay inside the episode (`S01E01.1-S01E01.3`), and `S01E01` on its own takes every part. For a [dated episode](downloading.md#daily-and-date-based-content), a token can also be an ISO air date (`2026-08-11`) or a date range with a colon (`2026-08-01:2026-08-31`). For a [music release](downloading.md#music-tracks), a token is a number of the track list (`1-5`, `1,3,7`), or `{disc}x{track}` (`2x3`) when the release has more than one disc. |
|
||||
| `--select-titles` | Interactively select what to download: episodes of a series, or films when a title has more than one. **Cannot combine with `-w`.** |
|
||||
| `--latest-episode` | Download only the single most recent episode. |
|
||||
| `--latest-episodes N` | Download only the N most recent episodes. |
|
||||
|
||||
@@ -654,7 +654,9 @@ with `-` to exclude it. For a music release, the same option takes track numbers
|
||||
|
||||
`-w` selects the tracks of an album, EP, single, or playlist. Give a track by its number.
|
||||
A release with more than one disc uses the `{disc}x{track}` form. A number on its own is a
|
||||
track on disc 1, which is the number the track list shows for a single-disc release.
|
||||
track on disc 1, which is the number the track list shows for a single-disc release. The
|
||||
songs of a playlist can have a position in the playlist. The track list then shows that position,
|
||||
and `-w` takes it. The tags and the file name keep the album track number.
|
||||
|
||||
=== "Tracks"
|
||||
|
||||
@@ -690,8 +692,7 @@ track on disc 1, which is the number the track list shows for a single-disc rele
|
||||
```
|
||||
|
||||
!!! tip "Read the track list first"
|
||||
`--list-titles` prints the release with its disc and track numbers, so you can see
|
||||
which numbers to give `-w`.
|
||||
`--list-titles` prints the release with the numbers that `-w` takes.
|
||||
|
||||
### Daily and date-based content
|
||||
|
||||
@@ -1254,7 +1255,7 @@ authoritative list.
|
||||
| `--forced-s-lang` | `-fsl` | Forced subtitle language(s); implies `-fs`. `-` excludes. |
|
||||
| `--sub-format` | | Output subtitle format. |
|
||||
| `--sub-font` | | Font for subtitles converted to ASS; implies `--sub-format ASS`. |
|
||||
| `--wanted` | `-w` | Episode/season range, an air date, or a track number for a music release (`1-5`, `2x3`). |
|
||||
| `--wanted` | `-w` | Episode/season range, an air date, or a number of the track list for a music release (`1-5`, `2x3`). |
|
||||
| `--daily` | | Fill missing air dates from TVDB during `--enrich`. |
|
||||
| `--select-titles` | | Interactively pick episodes or films. |
|
||||
| `--latest-episode` | | Only the newest episode. |
|
||||
|
||||
Reference in New Issue
Block a user