Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cue sheet support #4200

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
31016bc
Add support to read cuesheet file and import a single-file release.
zhangdoa Oct 1, 2023
16a3fbe
Add the support to copy .cue files to the media library folder.
zhangdoa Oct 2, 2023
c87efac
Add multi-disc support for single file releases.
zhangdoa Oct 4, 2023
a7f07df
Add multi-file/track support to the cue sheet loader.
zhangdoa Oct 8, 2023
72b504f
Fix an issue that "Is Single File Release" column is not added to Tra…
zhangdoa Oct 8, 2023
cb7a7ec
Refactor the cue sheet file loader to read the track titles, disc ID …
zhangdoa Oct 11, 2023
efd9a63
Fix a crash caused by missing track files.
zhangdoa Oct 11, 2023
1f9adce
Create a cue file for the move file operation in the same way as the …
zhangdoa Oct 12, 2023
14bf913
Only process cue-originated audio files if there is any.
zhangdoa Oct 12, 2023
2d5b6a1
Centralize most of the cue sheet-related features to a service.
zhangdoa Oct 13, 2023
0bb5a10
Move the cue sheet info list into ImportDecisionMakerInfo to eliminat…
zhangdoa Oct 15, 2023
88abe75
Add multi-performer support to the cue sheet parser.
zhangdoa Nov 5, 2023
853fdf7
Add encoding detector support for the cue sheet parser.
zhangdoa Nov 5, 2023
26678e7
Implement the track distance calculation for cue sheet tracks.
zhangdoa Nov 19, 2023
a7ab35f
Bump the database version for cue support to 076.
zhangdoa Jan 6, 2024
a581e64
Only detect the .cue file encoding for the manual import service.
zhangdoa Jan 6, 2024
6140d5a
Do not display "Is Single File Release" flag.
zhangdoa Jan 7, 2024
fec96dc
Remove "Is Single File Release" property from the track resource clas…
zhangdoa Jan 7, 2024
cd248ed
Check against the .cue file directory when importing the media files …
zhangdoa Jan 7, 2024
29e36e4
Bump the database version for cue support to 078.
zhangdoa Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/src/Album/Details/TrackRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TrackRow extends Component {
absoluteTrackNumber,
title,
duration,
isSingleFileRelease,
trackFilePath,
trackFileSize,
customFormats,
Expand Down Expand Up @@ -86,7 +87,7 @@ class TrackRow extends Component {
return (
<TableRowCell key={name}>
{
trackFilePath
isSingleFileRelease ? `${trackFilePath} (Single File)` : trackFilePath
}
</TableRowCell>
);
Expand Down Expand Up @@ -203,6 +204,7 @@ TrackRow.propTypes = {
absoluteTrackNumber: PropTypes.number,
title: PropTypes.string.isRequired,
duration: PropTypes.number.isRequired,
isSingleFileRelease: PropTypes.bool.isRequired,
isSaving: PropTypes.bool,
trackFilePath: PropTypes.string,
trackFileSize: PropTypes.number,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/Album/Details/TrackRowConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function createMapStateToProps() {
trackFilePath: trackFile ? trackFile.path : null,
trackFileSize: trackFile ? trackFile.size : null,
customFormats: trackFile ? trackFile.customFormats : [],
customFormatScore: trackFile ? trackFile.customFormatScore : 0
customFormatScore: trackFile ? trackFile.customFormatScore : 0,
isSingleFileRelease: trackFile ? trackFile.isSingleFileRelease : false
};
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ const columns = [
label: () => translate('Tracks'),
isVisible: true
},
{
name: 'cueSheetPath',
label: () => 'Cue Sheet Path',
isVisible: true
},
{
name: 'releaseGroup',
label: () => translate('ReleaseGroup'),
Expand Down Expand Up @@ -435,6 +440,8 @@ class InteractiveImportModalContent extends Component {
allowArtistChange={allowArtistChange}
onSelectedChange={this.onSelectedChange}
onValidRowChange={this.onValidRowChange}
isSingleFileRelease={item.isSingleFileRelease}
cueSheetPath={item.cueSheetPath}
/>
);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class InteractiveImportModalContentConnector extends Component {
album,
albumReleaseId,
tracks,
isSingleFileRelease,
cueSheetPath,
quality,
disableReleaseSwitching
} = item;
Expand All @@ -148,7 +150,7 @@ class InteractiveImportModalContentConnector extends Component {
return false;
}

if (!tracks || !tracks.length) {
if (!(isSingleFileRelease && cueSheetPath) && (!tracks || !tracks.length)) {
this.setState({ interactiveImportErrorMessage: 'One or more tracks must be chosen for each selected file' });
return false;
}
Expand All @@ -164,6 +166,8 @@ class InteractiveImportModalContentConnector extends Component {
albumId: album.id,
albumReleaseId,
trackIds: _.map(tracks, 'id'),
isSingleFileRelease: item.isSingleFileRelease,
cueSheetPath: item.cueSheetPath,
quality,
downloadId: this.props.downloadId,
disableReleaseSwitching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class InteractiveImportRow extends Component {
album,
albumReleaseId,
tracks,
cueSheetPath,
quality,
releaseGroup,
size,
Expand Down Expand Up @@ -267,8 +268,18 @@ class InteractiveImportRow extends Component {
{
showTrackNumbersPlaceholder ? <InteractiveImportRowCellPlaceholder /> : trackNumbers
}

</TableRowCellButton>

<TableRowCell
zhangdoa marked this conversation as resolved.
Show resolved Hide resolved
id={id}
title={'Cue Sheet Path'}
>
{
cueSheetPath
}
</TableRowCell>

<TableRowCellButton
title={translate('ClickToChangeReleaseGroup')}
onPress={this.onSelectReleaseGroupPress}
Expand Down Expand Up @@ -408,7 +419,9 @@ InteractiveImportRow.propTypes = {
artist: PropTypes.object,
album: PropTypes.object,
albumReleaseId: PropTypes.number,
tracks: PropTypes.arrayOf(PropTypes.object).isRequired,
tracks: PropTypes.arrayOf(PropTypes.object),
isSingleFileRelease: PropTypes.bool.isRequired,
cueSheetPath: PropTypes.string.isRequired,
releaseGroup: PropTypes.string,
quality: PropTypes.object,
size: PropTypes.number.isRequired,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/Store/Actions/interactiveImportActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export const actionHandlers = handleThunks({
albumId: item.album ? item.album.id : undefined,
albumReleaseId: item.albumReleaseId ? item.albumReleaseId : undefined,
trackIds: (item.tracks || []).map((e) => e.id),
isSingleFileRelease: item.isSingleFileRelease,
cueSheetPath: item.cueSheetPath,
quality: item.quality,
releaseGroup: item.releaseGroup,
downloadId: item.downloadId,
Expand Down
4 changes: 3 additions & 1 deletion src/Lidarr.Api.V1/ManualImport/ManualImportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ private List<ManualImportResource> UpdateImportItems(List<ManualImportUpdateReso
DownloadId = resource.DownloadId,
AdditionalFile = resource.AdditionalFile,
ReplaceExistingFiles = resource.ReplaceExistingFiles,
DisableReleaseSwitching = resource.DisableReleaseSwitching
DisableReleaseSwitching = resource.DisableReleaseSwitching,
IsSingleFileRelease = resource.IsSingleFileRelease,
CueSheetPath = resource.CueSheetPath,
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/Lidarr.Api.V1/ManualImport/ManualImportResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class ManualImportResource : RestResource
public bool AdditionalFile { get; set; }
public bool ReplaceExistingFiles { get; set; }
public bool DisableReleaseSwitching { get; set; }
public bool IsSingleFileRelease { get; set; }
public string CueSheetPath { get; set; }
}

public static class ManualImportResourceMapper
Expand All @@ -52,6 +54,8 @@ public static ManualImportResource ToResource(this ManualImportItem model)
Tracks = model.Tracks.ToResource(),
Quality = model.Quality,
ReleaseGroup = model.ReleaseGroup,
IsSingleFileRelease = model.IsSingleFileRelease,
CueSheetPath = model.CueSheetPath,

// QualityWeight
DownloadId = model.DownloadId,
Expand Down
3 changes: 2 additions & 1 deletion src/Lidarr.Api.V1/ManualImport/ManualImportUpdateResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class ManualImportUpdateResource : RestResource
public bool AdditionalFile { get; set; }
public bool ReplaceExistingFiles { get; set; }
public bool DisableReleaseSwitching { get; set; }

public bool IsSingleFileRelease { get; set; }
public string CueSheetPath { get; set; }
public IEnumerable<Rejection> Rejections { get; set; }
}
}
14 changes: 14 additions & 0 deletions src/NzbDrone.Core/Datastore/Migration/078_add_flac_cue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;

namespace NzbDrone.Core.Datastore.Migration
{
[Migration(078)]
public class add_flac_cue : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("TrackFiles").AddColumn("IsSingleFileRelease").AsBoolean().WithDefaultValue(false);
}
}
}
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/Lidarr.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Diacritics" Version="3.3.18" />
<PackageReference Include="Diacritical.Net" Version="1.0.4" />
<PackageReference Include="Polly" Version="8.2.1" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
Expand All @@ -29,6 +30,7 @@
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
<PackageReference Include="Equ" Version="2.3.0" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />
<PackageReference Include="UTF.Unknown" Version="2.5.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\Lidarr.Common.csproj" />
Expand Down
38 changes: 38 additions & 0 deletions src/NzbDrone.Core/MediaFiles/CueSheet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Collections.Generic;
using NzbDrone.Core.Datastore;

namespace NzbDrone.Core.MediaFiles
{
public class CueSheet : ModelBase
{
public class IndexEntry
{
public int Key { get; set; }
public string Time { get; set; }
}

public class TrackEntry
{
public int Number { get; set; }
public string Title { get; set; }
public List<string> Performers { get; set; } = new List<string>();
public List<IndexEntry> Indices { get; set; } = new List<IndexEntry>();
}

public class FileEntry
{
public string Name { get; set; }
public IndexEntry Index { get; set; }
public List<TrackEntry> Tracks { get; set; } = new List<TrackEntry>();
}

public string Path { get; set; }
public bool IsSingleFileRelease { get; set; }
public List<FileEntry> Files { get; set; } = new List<FileEntry>();
public string Genre { get; set; }
public string Date { get; set; }
public string DiscID { get; set; }
public string Title { get; set; }
public List<string> Performers { get; set; } = new List<string>();
}
}
Loading
Loading