Comments (9)
same here!
from tmdblib.
Is this on .NET core or Framework?
GetTrendingMoviesAsync(Day)
works fine in .NET Core.
from tmdblib.
.NET6
from tmdblib.
This is TestApplication built for net5.0, with SDK 7.x, run like:
var p1 = await client.GetTrendingMoviesAsync(TimeWindow.Day);
Console.WriteLine(p1.Page);
foreach (var searchMovie in p1.Results)
Console.WriteLine(searchMovie.Id + " " + searchMovie.Title);
from tmdblib.
TimeWindow.Day
adds a "Day" to the end of calling url, I cloned the project and convert it to lowercase (day), now it's working fine. I'm using .NET 7
from tmdblib.
It is also a good practice to keep everything lowercase while they are in a URL.
from tmdblib.
Sure - and it is. In this library, all enum values follow C#'s Camel Case standard, so it's Day
. I have then annotated all enums with [EnumValue()]
with the value to use in some cases, which for Day
is day
. This is used in the Client, whenever it calls .GetDescription()
on the enum value.
I'm not sure why you're getting Day
. I asked about the .NET version because maybe the custom attributes behavior is different for .NET Framework. Another alternative is a minimal .NET that does not have reflection capabilities. EnumValue
is defined within TMDbLib, so that should rule out any mixing of library versions.
If EnumValue
truly does not work, you would also not be able to:
- Use any of the Account methods
- Call the Discover* API's and apply a sorting
- Call the GetMovie* methods, with any
extraMethods
set.
The code for GetDescription
does end up with a .ToString()
, so if it wasn't possible to find the custom attribute, you would see Day
.
from tmdblib.
Thank you for explanation.
Is there any specific reason that you are not using [Description("")]
This is works for me!
using System.ComponentModel;
Console.WriteLine(TimeWindow.Day);
Console.WriteLine(GetEnumDescription(TimeWindow.Day));
static string GetEnumDescription(Enum value)
{
// Get the Description attribute value for the enum value
var fi = value.GetType().GetField(value.ToString());
if (fi == null)
return value.ToString();
var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
return attributes.Length > 0 ? attributes[0].Description : value.ToString();
}
public enum TimeWindow
{
[Description("day")] Day,
[Description("week")] Week
}
Output:
Day
day
(process 21480) exited with code 0.
Press any key to close this window . . .
from tmdblib.
TMDbLib.Objects.Trending.Tim
thanks for fixing the bug...
from tmdblib.
Related Issues (20)
- Small changes from TMDb cause bug HOT 3
- Video class missing Official and PublishedAt HOT 2
- MediaType for episode changes to tv_episode
- Test API key HOT 4
- Error converting value {null} to type 'System.Double'. Path 'popularity'
- Person NullReferenceException for TaggedImage
- DiscoverMovie missing 'with_release_type' parameter HOT 1
- The SSL connection could not be established HOT 1
- Updated TranslationData model in Nuget Package HOT 1
- MediaType error
- DiscoverMoviesAsync().IncludeWithAnyProviders() missing :'(
- Deserialization fails for Popular Persons data
- Add V4..
- Support native names in countries
- Security Vulnerability in Newtonsoft.Json 9.0.1 HOT 3
- RobiniaDocs API Explorer
- Update official Nuget with latest dependencies
- DiscoverTv.cs > WhereGenresExclude calls WhereGenresInclude
- some rudimentary tooling to deal with provider ids HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmdblib.