Fix some songs not downloading hopefully
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
version: 43
|
||||
jobs:
|
||||
- name: build
|
||||
steps:
|
||||
- type: CheckoutStep
|
||||
name: Checkout code
|
||||
cloneCredential:
|
||||
type: DefaultCredential
|
||||
withLfs: true
|
||||
withSubmodules: true
|
||||
cloneDepth: 1
|
||||
condition: SUCCESSFUL
|
||||
optional: false
|
||||
- type: BuildImageStep
|
||||
name: build image
|
||||
output:
|
||||
type: RegistryOutput
|
||||
tags: onedev.site.tesses.net/tytd2025/tytdcompanion/tytdcompanion:latest
|
||||
registryLogins:
|
||||
- registryUrl: '@server_url@'
|
||||
userName: '@job_token@'
|
||||
passwordSecret: dockersecret
|
||||
condition: SUCCESSFUL
|
||||
optional: false
|
||||
triggers:
|
||||
- type: BranchUpdateTrigger
|
||||
branches: master
|
||||
userMatch: anyone
|
||||
projects: tytd2025/tytdcompanion
|
||||
retryCondition: never
|
||||
maxRetries: 3
|
||||
retryDelay: 30
|
||||
timeout: 14400
|
||||
+23
-20
@@ -17,6 +17,7 @@ using YoutubeExplode.Search;
|
||||
using YouTubeMusicAPI.Client;
|
||||
using YouTubeMusicAPI.Models.Search;
|
||||
using YouTubeMusicAPI.Pagination;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
|
||||
|
||||
@@ -420,7 +421,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
{
|
||||
VideoTitle = webhook.Video.Title;
|
||||
|
||||
ChannelTitle = webhook.Video.Channel;
|
||||
ChannelTitle = webhook.Video.Channel;
|
||||
}
|
||||
break;
|
||||
case "VideoFinished":
|
||||
@@ -642,7 +643,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
routeServer.Add("/music/fix-song", EnsureLoggedin(FixIncorrectPost), "POST");
|
||||
routeServer.Add("/fix-song-index", EnsureLoggedin(FixSongIndexGet));
|
||||
routeServer.Add("/fix-song-index", EnsureLoggedin(FixSongIndexPost), "POST");
|
||||
|
||||
|
||||
|
||||
routeServer.Add("/music/artist", EnsureLoggedin(Artist));
|
||||
routeServer.Add("/music/myartist", EnsureLoggedin(MyArtist));
|
||||
@@ -769,7 +770,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
}
|
||||
private static async Task ApiUnavailable(ServerContext ctx)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (!ctx.QueryParams.TryGetFirstInt64("offset", out var offset))
|
||||
offset = 0;
|
||||
@@ -782,7 +783,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
await ctx.SendJsonAsync(songs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static async Task ApiSongs(ServerContext ctx)
|
||||
{
|
||||
if (!ctx.QueryParams.TryGetFirst("q", out var q))
|
||||
@@ -896,12 +897,14 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
string path = mId.ToString();
|
||||
if (File.Exists(path))
|
||||
{
|
||||
ContentDisposition disposition = new ContentDisposition();
|
||||
disposition.FileName = Path.GetFileName(path);
|
||||
disposition.Inline = inline;
|
||||
disposition.ModificationDate = File.GetLastWriteTime(path);
|
||||
disposition.CreationDate = File.GetCreationTime(path);
|
||||
ctx.ResponseHeaders["Content-Disposition"] = [disposition.ToString()];
|
||||
string filename = Path.GetFileName(path);
|
||||
var cd = new ContentDispositionHeaderValue(inline ? "inline":"attachment");
|
||||
|
||||
cd.ModificationDate = File.GetLastWriteTime(path);
|
||||
cd.CreationDate = File.GetCreationTime(path);
|
||||
cd.FileName = filename;
|
||||
cd.FileNameStar = filename; // auto-encodes to RFC 5987
|
||||
ctx.ResponseHeaders["Content-Disposition"] = [cd.ToString()];
|
||||
await ctx.SendFileAsync(path);
|
||||
return;
|
||||
}
|
||||
@@ -949,7 +952,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
if(cfg is not null)
|
||||
{
|
||||
cfg.ThumbnailsThroughTYTD = tytdthumbnail;
|
||||
|
||||
|
||||
File.WriteAllText(AuthConfigPath, JsonConvert.SerializeObject(cfg));
|
||||
}
|
||||
}
|
||||
@@ -999,7 +1002,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static async Task<VideoId?> GetVideoIdFromSong(AlbumSongQuery.AlbumSongQueryMedia.AlbumSongQueryMediaTrack.AlbumSongQueryMediaTrackRecording recording, string albumName)
|
||||
{
|
||||
using (var db = new Database())
|
||||
@@ -1454,7 +1457,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static async Task FixIncorrectPost(ServerContext ctx)
|
||||
{
|
||||
ctx.ParseBody();
|
||||
@@ -1584,7 +1587,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Song? song = null;
|
||||
using (var db = new Database())
|
||||
{
|
||||
|
||||
|
||||
await foreach (var item in db.GetMediaEntriesAsync(songId.ToString()))
|
||||
{
|
||||
entries.Add(item);
|
||||
@@ -1704,11 +1707,11 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
{
|
||||
if(ctx.QueryParams.TryGetFirstGuid("id",out var id))
|
||||
{
|
||||
|
||||
|
||||
var songResp = await MusicBrainzRequestAsync<MusicBrainzSongInfo>($"/ws/2/recording/{HttpUtility.UrlEncode(id.ToString())}/?fmt=json&inc=artist-credits+releases");
|
||||
if(songResp is not null)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
List<AlbumLink> links = new List<AlbumLink>();
|
||||
@@ -1737,7 +1740,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
var songQuery = await MusicBrainzRequestAsync<SongQuery>($"/ws/2/recording?query={HttpUtility.UrlEncode(q)}&fmt=json&offset={(page - 1) * 25}&limit=25");
|
||||
if (songQuery is not null)
|
||||
{
|
||||
|
||||
|
||||
|
||||
foreach(var item in songQuery.Recordings)
|
||||
{
|
||||
@@ -1760,14 +1763,14 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
|
||||
songs.Add(new SongLink(builder.ToString(),item.Id.ToString()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
await ctx.SendTextAsync(Pages.SongListing(q,songs,page));
|
||||
}
|
||||
|
||||
|
||||
public static async Task Artists(ServerContext ctx)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user