sleepyfran / itunespy

:snake: A simple library to fetch data from the iTunes Store API made for Python >= 3.5
MIT License
64 stars 6 forks source link

[Feature Request] Add a setter method for track_time #11

Closed deepjyoti30 closed 4 years ago

deepjyoti30 commented 4 years ago

Hey there, thanks for the nice project!

I am the developer of ytmdl and my project has been dependent on your library since the beginning.

It was later that I noticed that the track_time property of the songs are returned in miliseconds, however, my requirement was to get them in seconds, so I added a bit of code that updates the track_time value and then passed the whole results container along.

It was working all nice and well until the last release. You made the move to change track_time to a property and it turns out the property doesn't have a setter method which is why my code was unable to update the track_time value and so as a result a lot of users started facing the issue.

However, a few days ago a fellow user pointed out the issue to me and I found out about the latest release that broke my code.

I just wanted to request to please add a setter method for the track_time property so that I can go back to using all the latest releases as currently I have forced the version 1.5.5 in the setup.

Cheers! Thanks for the awesome library, really appreciate it.

sleepyfran commented 4 years ago

Hey! Awesome to see that such an amazing project is using itunespy 😄

I understand the use case, however I think it'd be much better if instead of exposing a setter (I'd like to keep everything inside the objects as immutable as possible) the library could expose a method to return the time in a given time span (milliseconds, seconds, minutes, etc.), how does that sound?

deepjyoti30 commented 4 years ago

@sleepyfran That would be perfect. I'd be glad to have something like that, it'd save me a bit of extra code.

sleepyfran commented 4 years ago

@deepjyoti30 Awesome! I'll take a look as soon as I have time 😄

sleepyfran commented 4 years ago

Hey @deepjyoti30! I've been looking into it and I just remembered that there's already a method in the track that might help you with it. All tracks expose a get_track_time_minutes and get_track_time_hours that I think should be exactly what you're looking for. Is there any reason why you're not using those? 😄

Sorry I didn't come up with it before, it's been a while since I've worked on the library.

deepjyoti30 commented 4 years ago

@sleepyfran Wow, I was not aware that it was available.

I had also implemented the code that had itunespy a while back so I guess I never looked through the available methods. Thanks a lot for that, I'll close the issue.