Closed host505 closed 4 years ago
hey @host505 can you explain the reasoning for your changes a bit more plz and thank you? :)
This adds a 'size' key on the infos that each torrent source carries. The value of that key should always be a floating point number (float()), corresponding to the fetched by the source size in GB. This makes it very easy for add-on devs to do stuff with sizes. Eg sorting their torrent sources results by size makes it almost a one-liner for exodus-based add-ons. Size filtering shouldn't be much harder as well.
Also, I noticed that the code that calculated sizes to GB was common for 25 out of 28 torrent sources (highly repeated), so I decided to turn that code to a function (_size) and use that instead. This function returns 2 values: size in float() and size in string format (with 2 decimals) . First one is to be used on the new 'size' key, second one is to be appended to the 'info' key.
ok thank you for your response. PR has been merged :)
...to make life easier of add-on devs on working with sizes (sort, limit etc)