Add more descriptive feed name (#25)

This commit is contained in:
Cody Robibero 2024-05-14 13:26:30 -06:00 committed by GitHub
parent 89c170323d
commit 63cc8f946e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,7 +60,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
new LinkDto("search", baseUrl + "/opds/osd", "application/opensearchdescription+xml"),
new LinkDto("search", baseUrl + "/opds/search/{searchTerms}", "application/atom+xml", "Search")
},
Title = GetServerName(),
Title = GetFeedName("Feeds"),
Author = PluginAuthor,
Entries = new List<EntryDto>
{
@ -156,7 +156,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName("Alphabetical"),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/books?", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -176,7 +176,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName("Genres"),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/genres?", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -237,7 +237,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName("Recently Added"),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/recentlyadded?", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -322,7 +322,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName("Favorites"),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/books/favorite", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -374,11 +374,15 @@ public class OpdsFeedProvider : IOpdsFeedProvider
}
}
var title = string.IsNullOrEmpty(filterStart)
? "Books"
: "Books - " + filterStart;
return new FeedDto
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName(title),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/books/letter/" + filterStart + "?", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -424,11 +428,13 @@ public class OpdsFeedProvider : IOpdsFeedProvider
}
}
var genre = _libraryManager.GetItemById(genreId);
return new FeedDto
{
Id = Guid.NewGuid().ToString(),
Author = PluginAuthor,
Title = GetServerName(),
Title = GetFeedName(genre?.Name ?? "Genre"),
Links = new[]
{
new LinkDto("self", baseUrl + "/opds/genres/" + genreId + "?", "application/atom+xml;profile=opds-catalog;type=feed;kind=navigation"),
@ -486,7 +492,7 @@ public class OpdsFeedProvider : IOpdsFeedProvider
new LinkDto("search", baseUrl + "/opds/osd", "application/opensearchdescription+xml"),
new LinkDto("search", baseUrl + "/opds/search/{searchTerms}", "application/atom+xml", "Search")
},
Title = GetServerName(),
Title = GetFeedName(searchTerm),
Author = PluginAuthor,
Entries = entries
};
@ -505,8 +511,8 @@ public class OpdsFeedProvider : IOpdsFeedProvider
Language = "en-EN",
OutputEncoding = "UTF-8",
InputEncoding = "UTF-8",
ShortName = GetServerName(),
LongName = GetServerName(),
ShortName = GetFeedName("Search"),
LongName = GetFeedName("Search"),
Url = new[]
{
new OpenSearchUrlDto
@ -525,10 +531,10 @@ public class OpdsFeedProvider : IOpdsFeedProvider
return dto;
}
private string GetServerName()
private string GetFeedName(string title)
{
var serverName = _serverApplicationHost.FriendlyName;
return string.IsNullOrEmpty(serverName) ? "Jellyfin" : serverName;
return title + " - " + (string.IsNullOrEmpty(serverName) ? "Jellyfin" : serverName);
}
private EntryDto CreateEntry(Book book, string baseUrl)