Compare commits
4 Commits
c1103564bb
...
EpisodeGro
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b830659bc | |||
| c423d8f3ed | |||
| 25b214c0d7 | |||
| 310978054d |
@@ -13,12 +13,17 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
|
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
|
||||||
<PackageReference Include="TMDbLib" Version="2.2.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="appSettings.json">
|
<None Update="appSettings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="TMDbLib">
|
||||||
|
<HintPath>..\Libraries\TMDbLib.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -196,10 +196,44 @@ namespace AnimeAnnouncer
|
|||||||
|
|
||||||
|
|
||||||
if(latestSeasonNumber != int.Parse(season))
|
if(latestSeasonNumber != int.Parse(season))
|
||||||
|
{
|
||||||
|
var titleSeason = int.Parse(season);
|
||||||
|
bool seasonOverride = false;
|
||||||
|
if(latestSeasonNumber ==1 && titleSeason > 1 && latestEpisodeNumber > 3)
|
||||||
|
{ //Check episode groups to see if this is a single-season default show
|
||||||
|
var showResult = await tmdbClient.GetTvShowAsync(supposedShowId, TMDbLib.Objects.TvShows.TvShowMethods.EpisodeGroups);
|
||||||
|
var seasonEpisodeGroup = showResult.EpisodeGroups.Results.FirstOrDefault(eg => eg.Name == "Seasons");
|
||||||
|
if(seasonEpisodeGroup != null)
|
||||||
|
{ //Evaluate using new episode group
|
||||||
|
var targetEpisodeGroup = await tmdbClient.GetTvEpisodeGroupsAsync(seasonEpisodeGroup.Id);
|
||||||
|
if(targetEpisodeGroup != null)
|
||||||
|
{
|
||||||
|
var targetSeason = targetEpisodeGroup.Groups.FirstOrDefault(g => g.Order == titleSeason);
|
||||||
|
if(targetSeason != null)
|
||||||
|
{ //Episode_Type isn't making it with the current client, guess based on ordering
|
||||||
|
var targetFinale = targetSeason.Episodes.OrderByDescending(g => g.Order).FirstOrDefault(e => e.EpisodeType.Equals("finale", StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
//Confirm it's aired within the last week
|
||||||
|
if(targetFinale != null && targetEpisodeGroup.Groups.OrderByDescending(g => g.Order).FirstOrDefault() == targetSeason)
|
||||||
|
{ //confirm the episode is marked as finale and that this season is the latest one in the episode group
|
||||||
|
Console.WriteLine($"!!Choosing S{titleSeason}E{targetFinale.Order + 1} for finale using episode groups");
|
||||||
|
cachedShow.LatestSeasonNumber = latestSeasonNumber = titleSeason;
|
||||||
|
cachedShow.LastEpisodeNumber = latestEpisodeNumber = targetFinale.Order + 1;
|
||||||
|
seasonOverride = true;
|
||||||
|
_ = tmdbCache.SetCacheItem($"ShowCache-{title}", cachedShow);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Console.WriteLine("Could not find a finale episode.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!seasonOverride)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Failing release due to TMDB's season number {latestSeasonNumber} not matching title season {season}");
|
Console.WriteLine($"Failing release due to TMDB's season number {latestSeasonNumber} not matching title season {season}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(latestEpisodeNumber != int.Parse(episode))
|
if(latestEpisodeNumber != int.Parse(episode))
|
||||||
{
|
{
|
||||||
@@ -257,16 +291,21 @@ namespace AnimeAnnouncer
|
|||||||
//Prepare Status
|
//Prepare Status
|
||||||
String statusText = $"{cachedShow.Title} ({cachedShow.VoteAverage}/10) DUBBED has finished airing season {cachedShow.LatestSeasonNumber}! Episode {cachedShow.LastEpisodeNumber} is now available for download. {Environment.NewLine + Environment.NewLine}";
|
String statusText = $"{cachedShow.Title} ({cachedShow.VoteAverage}/10) DUBBED has finished airing season {cachedShow.LatestSeasonNumber}! Episode {cachedShow.LastEpisodeNumber} is now available for download. {Environment.NewLine + Environment.NewLine}";
|
||||||
String overview = !String.IsNullOrWhiteSpace(cachedShow.LatestSeasonOverview) ? cachedShow.LatestSeasonOverview : cachedShow.Overview ?? String.Empty;
|
String overview = !String.IsNullOrWhiteSpace(cachedShow.LatestSeasonOverview) ? cachedShow.LatestSeasonOverview : cachedShow.Overview ?? String.Empty;
|
||||||
if(!String.IsNullOrWhiteSpace(overview))
|
if (!String.IsNullOrWhiteSpace(overview))
|
||||||
{
|
{
|
||||||
statusText += $"Overview: {overview}";
|
statusText += $"{overview}";
|
||||||
}
|
}
|
||||||
if(statusText.Length >= 500)
|
String anidbLink = $"{Environment.NewLine}https://anilist.co/search/anime?search={cachedShow.Title.Replace(" ", "%20")}";
|
||||||
|
int linkLength = anidbLink.Length;
|
||||||
|
|
||||||
|
if (statusText.Length + linkLength + 3 >= 500)
|
||||||
{
|
{
|
||||||
statusText = statusText[..497] + "..";
|
statusText = statusText[..(500 - (linkLength + 3))];
|
||||||
}
|
}
|
||||||
|
statusText += $"..{anidbLink}";
|
||||||
|
|
||||||
_ = mastodonClient.PublishStatus(statusText,
|
_ = mastodonClient.PublishStatus(statusText,
|
||||||
Visibility.Public, mediaIds: attachment != null ? new String[] {attachment.Id} : null);
|
Visibility.Public, mediaIds: attachment != null ? new String[] { attachment.Id } : null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace MassTorrentAdd
|
|||||||
|
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
.AddJsonFile("appSettings.json", optional: false, reloadOnChange: true);
|
||||||
|
|
||||||
IConfigurationRoot configuration = builder.Build();
|
IConfigurationRoot configuration = builder.Build();
|
||||||
transmissionHost = configuration.GetValue<String>("transmissionURI");
|
transmissionHost = configuration.GetValue<String>("transmissionURI");
|
||||||
@@ -94,6 +94,14 @@ namespace MassTorrentAdd
|
|||||||
Metainfo = Convert.ToBase64String(torrentFileData)
|
Metainfo = Convert.ToBase64String(torrentFileData)
|
||||||
};
|
};
|
||||||
var torrentInfo = transmissionClient.TorrentAdd(newTorrent);
|
var torrentInfo = transmissionClient.TorrentAdd(newTorrent);
|
||||||
|
var seedSettings = new Transmission.API.RPC.Arguments.TorrentSettings()
|
||||||
|
{
|
||||||
|
SeedRatioLimit = 1.0,
|
||||||
|
SeedRatioMode = 1,
|
||||||
|
IDs = [torrentInfo.ID]
|
||||||
|
};
|
||||||
|
|
||||||
|
transmissionClient.TorrentSet(seedSettings);
|
||||||
//transmissionClient.TorrentVerify(new object[] { torrentInfo.ID });
|
//transmissionClient.TorrentVerify(new object[] { torrentInfo.ID });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user