Skip to content

Commit c55445d

Browse files
author
Meyn
committed
Implement UNIX support and adding ProtocolItem to DelayProfile if missing
1 parent 925312e commit c55445d

File tree

13 files changed

+109
-55
lines changed

13 files changed

+109
-55
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,4 @@ MigrationBackup/
363363
FodyWeavers.xsd
364364
/_plugins/SpotiarrTube
365365
/_plugins/Tubifarry
366+
/enc_temp_folder/f7b6bdaa49df014838e55dd376c78df

README.md

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,77 @@
11
# Tubifarry for Lidarr 🎶
22
![Downloads](https://img.shields.io/github/downloads/TypNull/Tubifarry/total) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/TypNull/Tubifarry) ![GitHub last commit](https://img.shields.io/github/last-commit/TypNull/Tubifarry) ![License](https://img.shields.io/github/license/TypNull/Tubifarry) ![GitHub stars](https://img.shields.io/github/stars/TypNull/Tubifarry)
33

4-
This plugin fetches metadata from **Spotify** and **YouTube** to download music directly from YouTube. It builds on the groundwork laid by trevTV's projects and utilizes the YouTube API for seamless integration. 🛠️
4+
Tubifarry is a plugin for **Lidarr** that fetches metadata from **Spotify** and **YouTube**, enabling direct music downloads from YouTube. Built on the foundation of trevTV's projects, it leverages the YouTube API for smooth integration. 🛠️
55

66
---
77

88
## Installation 🚀
9-
To use Tubifarry, your Lidarr setup must be on the `plugins` branch. Below is a detailed guide to get started.
9+
To use Tubifarry, ensure your Lidarr setup is on the `plugins` branch. Follow the steps below to get started.
1010

1111
### Docker Setup (Hotio Image) 🐳
12-
Here’s the Docker path for Hotio's image:
12+
For Docker users using Hotio's image, use the following path:
1313
```yml
1414
image: ghcr.io/hotio/lidarr:pr-plugins
1515
```
1616
17+
### Non-Docker Installation
18+
To switch to the Plugins Branch:
19+
1. Open Lidarr and navigate to `System -> General`.
20+
2. Scroll down to the **Branch** section.
21+
3. Replace "master" with "plugins".
22+
4. Force an update check to update Lidarr to the plugins branch.
23+
1724
---
1825

1926
### Prerequisites ⚙️
20-
1. **FFmpeg**: FFmpeg is **required** for converting downloaded files to MP3 format. Ensure FFmpeg is installed and available on Windows system PATH or the specified ffmpeg path. If not, you can attempt to download it automatically during setup. Without FFmpeg, many songs fail to process correctly because they are downloaded as MP4 files, and TagLib cannot add metadata to MP4 formats.
27+
1. **FFmpeg**: FFmpeg is **essential** for converting downloaded files to MP3 format. Ensure FFmpeg is installed and accessible in your system's PATH or the specified FFmpeg path. If not, you can attempt to download it automatically during setup. Without FFmpeg, many songs may fail to process correctly, as they are downloaded as MP4 files, and TagLib cannot add metadata to MP4 formats.
28+
29+
2. **Max Audio Quality**: Tubifarry supports a maximum audio quality of **256kb/s** for downloaded files. However, most files are in **MP3-VBR-V0** format.
2130

22-
2. **Max Audio Quality**: Tubifarry supports a maximum audio quality of **128 kb/s** for downloaded files. Ensure your settings align with this for optimal performance.
31+
**What is MP3-VBR-V0?**
32+
MP3-VBR-V0 is a high-quality audio format that uses **Variable Bitrate (VBR)** to optimize both sound quality and file size. Unlike a fixed bitrate (e.g., 128kb/s), VBR adjusts the bitrate dynamically based on the complexity of the audio. For example, it uses a higher bitrate for detailed parts of a song (like a chorus) and a lower bitrate for simpler parts (like silence).
2333

2434
---
2535

2636
### Plugin Installation 📥
37+
38+
#### **For Docker Users**:
2739
1. **Install the Plugin**:
28-
- In Lidarr, navigate to `System -> Plugins`.
29-
- Paste `https://github.com/TypNull/Tubifarry` into the GitHub URL box and press **Install**.
40+
- In Lidarr, go to `System -> Plugins`.
41+
- Paste `https://github.com/TypNull/Tubifarry` into the GitHub URL box and click **Install**.
3042

3143
2. **Configure the Indexer**:
32-
- Go to `Settings -> Indexers` and press **Add**.
33-
- In the modal, select `Tubifarry` (found under **Other** at the bottom).
44+
- Navigate to `Settings -> Indexers` and click **Add**.
45+
- In the modal, select `Tubifarry` (located under **Other** at the bottom).
3446

3547
3. **Set Up the Download Client**:
36-
- Go to `Settings -> Download Clients` and press **Add**.
48+
- Go to `Settings -> Download Clients` and click **Add**.
3749
- In the modal, choose `Youtube` (under **Other** at the bottom).
38-
- Set the download path and adjust other settings to your preference.
39-
40-
4. **Enable Tubifarry in Delay Profiles**:
41-
- Go to `Settings -> Profiles -> Delay Profiles`.
42-
- For each profile, click the **wrench icon** on the right and enable Tubifarry.
50+
- Set the download path and adjust other settings as needed.
51+
- **Important**: Ensure the FFmpeg path is correctly configured!
4352

4453
---
4554

4655
### Troubleshooting 🛠️
47-
- **FFmpeg Issues**: If songs fail to process, ensure FFmpeg is correctly installed and accessible in your system's PATH. If not, try reinstalling or downloading it manually.
48-
- **MP4 Metadata**: If metadata is not being added to downloaded files, verify that FFmpeg is converting files to MP3 format. MP4 files are not supported for metadata tagging by TagLib.
56+
- **FFmpeg Issues**: If songs fail to process, verify that FFmpeg is correctly installed and accessible in your system's PATH. If not, try reinstalling or downloading it manually.
57+
- **MP4 Metadata**: If metadata is not being added to downloaded files, confirm that FFmpeg is converting files to MP3 format (check debug logs). MP4 files are not supported for metadata tagging by TagLib.
4958
- **Audio Quality**: Ensure the maximum audio quality is set to **128 kb/s** in your settings to avoid compatibility issues.
5059

5160
---
5261

5362
## Acknowledgments 🙌
54-
Special thanks to **trevTV** for the groundwork with [Lidarr.Plugin.Tidal](https://github.com/TrevTV/Lidarr.Plugin.Tidal), [Lidarr.Plugin.Deezer](https://github.com/TrevTV/Lidarr.Plugin.Deezer), and [Lidarr.Plugin.Qobuz](https://github.com/TrevTV/Lidarr.Plugin.Qobuz). Additionally, thanks to [IcySnex/YouTubeMusicAPI](https://github.com/IcySnex/YouTubeMusicAPI) for providing the YouTube API. 🎉
63+
Special thanks to **trevTV** for laying the groundwork with [Lidarr.Plugin.Tidal](https://github.com/TrevTV/Lidarr.Plugin.Tidal), [Lidarr.Plugin.Deezer](https://github.com/TrevTV/Lidarr.Plugin.Deezer), and [Lidarr.Plugin.Qobuz](https://github.com/TrevTV/Lidarr.Plugin.Qobuz). Additionally, thanks to [IcySnex/YouTubeMusicAPI](https://github.com/IcySnex/YouTubeMusicAPI) for providing the YouTube API. 🎉
64+
65+
---
66+
67+
## Contributing 🤝
68+
If you'd like to contribute to Tubifarry, feel free to open issues or submit pull requests on the [GitHub repository](https://github.com/TypNull/Tubifarry). Your feedback and contributions are highly appreciated!
69+
70+
---
71+
72+
## License 📄
73+
Tubifarry is licensed under the MIT License. See the [LICENSE](https://github.com/TypNull/Tubifarry/blob/main/LICENSE) file for more details.
74+
75+
---
5576

77+
Enjoy seamless music downloads with Tubifarry! 🎧

Tubifarry/Blocklisting/TubifarryBlocklist.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class TubifarryBlocklist : IBlocklistForProtocol
1111

1212
public TubifarryBlocklist(IBlocklistRepository blocklistRepository) => _blocklistRepository = blocklistRepository;
1313

14-
public string Protocol => nameof(TubifarryDownloadProtocol);
14+
public string Protocol => nameof(YoutubeDownloadProtocol);
1515

1616
public bool IsBlocklisted(int artistId, ReleaseInfo release) => _blocklistRepository.BlocklistedByTorrentInfoHash(artistId, release.Guid).Any(b => SameRelease(b, release));
1717

Tubifarry/Core/AlbumData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ReleaseInfo ToReleaseInfo()
4141
DownloadUrl = AlbumId,
4242
InfoUrl = SpotifyUrl,
4343
PublishDate = ReleaseDateTime,
44-
DownloadProtocol = nameof(TubifarryDownloadProtocol),
44+
DownloadProtocol = nameof(YoutubeDownloadProtocol),
4545
Title = ConstructTitle(),
4646
Codec = "MP3",
4747
Resolution = CoverResolution,

Tubifarry/Download/Clients/YouTube/Youtube.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@ public class Youtube : DownloadClientBase<YoutubeProviderSettings>
1818

1919
public Youtube(IYoutubeDownloadManager dlManager, IConfigService configService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, Logger logger) : base(configService, diskProvider, remotePathMappingService, logger) => _dlManager = dlManager;
2020

21-
2221
public override string Name => "Youtube";
2322

2423
public bool _tested = false;
2524

26-
public override string Protocol => nameof(TubifarryDownloadProtocol);
25+
public override string Protocol => nameof(YoutubeDownloadProtocol);
2726

2827
public new YoutubeProviderSettings Settings => base.Settings;
2928

3029
public override Task<string> Download(RemoteAlbum remoteAlbum, IIndexer indexer) => _dlManager.Download(remoteAlbum, indexer, this);
3130

32-
3331
public override IEnumerable<DownloadClientItem> GetItems() => _dlManager.GetItems();
3432

3533
public override void RemoveItem(DownloadClientItem item, bool deleteData)
@@ -77,9 +75,7 @@ public async Task TestFFmpeg(List<ValidationFailure> failures)
7775
}
7876

7977
if (Settings.ReEncode == ReEncodeOptions.UseCustomFFmpeg && !AudioMetadataHandler.FFmpegIsInstalled)
80-
{
8178
failures.Add(new ValidationFailure("FFmpegPath", $"The specified FFmpeg path does not exist: {Settings.FFmpegPath}"));
82-
}
8379
}
8480
}
8581
}

Tubifarry/Download/Clients/YouTube/YoutubeDownloadManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public Task<string> Download(RemoteAlbum remoteAlbum, IIndexer indexer, Youtube
6666

6767
public IEnumerable<DownloadClientItem> GetItems() => _queue.Select(x => x.ClientItem);
6868

69-
7069
public void RemoveItem(DownloadClientItem item)
7170
{
7271
YouTubeAlbumRequest? req = _queue.ToList().Find(x => x.ID == item.DownloadId);

Tubifarry/Download/Clients/YouTube/YoutubeProviderSettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class YoutubeProviderSettings : IProviderConfig
3737
public string DownloadPath { get; set; } = "";
3838

3939
[FieldDefinition(1, Label = "Use LRCLIB Lyric Provider", HelpText = "Enable this option to fetch lyrics from LRCLIB.", Type = FieldType.Checkbox)]
40-
public bool UseLRCLIB { get; set; } = true;
40+
public bool UseLRCLIB { get; set; } = false;
4141

4242
[FieldDefinition(2, Label = "Save Synced Lyrics", HelpText = "Enable this option to save synced lyrics to a separate .lrc file, if available. Requires .lrc to be allowed under Import Extra Files.", Type = FieldType.Checkbox)]
4343
public bool SaveSyncedLyrics { get; set; } = false;
@@ -49,10 +49,10 @@ public class YoutubeProviderSettings : IProviderConfig
4949
public int Chunks { get; set; } = 2;
5050

5151
[FieldDefinition(5, Label = "ReEncode", Type = FieldType.Select, SelectOptions = typeof(ReEncodeOptions), HelpText = "Specify whether to re-encode audio files and how to handle FFmpeg.")]
52-
public ReEncodeOptions ReEncode { get; set; } = ReEncodeOptions.Disabled;
52+
public ReEncodeOptions ReEncode { get; set; } = ReEncodeOptions.UseFFmpegOrInstall;
5353

54-
[FieldDefinition(6, Label = "FFmpeg Path", Type = FieldType.Path, HelpText = "Specify the path to the FFmpeg binary. Required if 'Use Custom FFmpeg' is selected.", Advanced = true)]
55-
public string FFmpegPath { get; set; } = "";
54+
[FieldDefinition(6, Label = "FFmpeg Path", Type = FieldType.Path, Placeholder = "/downloads/FFmpeg", HelpText = "Specify the path to the FFmpeg binary. Not required if 'Disabled' is selected.", Advanced = false)]
55+
public string FFmpegPath { get; set; } = string.Empty;
5656

5757
public NzbDroneValidationResult Validate() => new(Validator.Validate(this));
5858
}

Tubifarry/Download/Clients/YouTubeAlbumRequest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Requests.Options;
1010
using System.Text;
1111
using Tubifarry.Core;
12+
using YouTubeMusicAPI.Client;
1213
using YouTubeMusicAPI.Models;
1314
using YouTubeMusicAPI.Models.Info;
1415
using YouTubeMusicAPI.Models.Streaming;
@@ -31,7 +32,7 @@ internal class YouTubeAlbumRequest : Request<YouTubeAlbumOptions, string, string
3132
private readonly ReleaseInfo _releaseInfo;
3233
private readonly DownloadClientItem _clientItem;
3334

34-
private double _smoothedBytesPerSecond = 0;
35+
private double _smoothedBytesPerSecond;
3536

3637
private Logger? Logger => Options.Logger;
3738

@@ -55,7 +56,7 @@ public DownloadClientItem ClientItem
5556

5657
public YouTubeAlbumRequest(RemoteAlbum remoteAlbum, YouTubeAlbumOptions? options) : base(options)
5758
{
58-
Options.YouTubeMusicClient ??= new();
59+
Options.YouTubeMusicClient ??= new YouTubeMusicClient();
5960
_releaseInfo = remoteAlbum.Release;
6061
_requestContainer.Add(_trackContainer);
6162
_destinationPath = new(Path.Combine(Options.DownloadPath, _releaseInfo.Artist, _releaseInfo.Album));
@@ -71,8 +72,8 @@ private void ProcessAlbum()
7172
AlbumInfo albumInfo = await Options.YouTubeMusicClient.GetAlbumInfoAsync(albumBrowseID, token);
7273
if (albumInfo?.Songs == null || !albumInfo.Songs.Any())
7374
{
74-
_message.AppendLine("No tracks to download found in the album.");
75-
Logger?.Debug("No tracks to download found in the album.");
75+
_message.AppendLine($"No tracks to download found in the album: {_releaseInfo.Album}.");
76+
Logger?.Debug($"No tracks to download found in the album: {_releaseInfo.Album}.");
7677
return false;
7778
}
7879

@@ -198,7 +199,7 @@ private async Task<bool> SongDownloadCompletedAsync(AlbumInfo albumInfo, AlbumSo
198199
if (Options.TryIncludeSycLrc)
199200
await audioData.TryCreateLrcFileAsync(token);
200201

201-
GetRemainingSize();
202+
GetRemainingTime();
202203
return true;
203204
}
204205

@@ -210,6 +211,7 @@ private async Task<bool> SongDownloadCompletedAsync(AlbumInfo albumInfo, AlbumSo
210211
DownloadClientInfo = Options.ClientInfo,
211212
OutputPath = _destinationPath,
212213
};
214+
213215
private TimeSpan? GetRemainingTime()
214216
{
215217
long remainingSize = GetRemainingSize();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
namespace NzbDrone.Core.Indexers
22
{
3-
public class TubifarryDownloadProtocol : IDownloadProtocol { }
3+
public class YoutubeDownloadProtocol : IDownloadProtocol { }
44
}

Tubifarry/Indexers/Spotify/Spotify.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace NzbDrone.Core.Indexers.Spotify
99
internal class Spotify : HttpIndexerBase<SpotifyIndexerSettings>
1010
{
1111
public override string Name => "Tubifarry";
12-
public override string Protocol => nameof(TubifarryDownloadProtocol);
12+
public override string Protocol => nameof(YoutubeDownloadProtocol);
1313
public override bool SupportsRss => false;
1414
public override bool SupportsSearch => true;
1515
public override int PageSize => 50;

0 commit comments

Comments
 (0)